int produce(void);
void myEntry(void)
{
int x = 0;
while (produce())
{
x += 1;
if (produce())
{
break;
}
x += 2;
}
}
; ModuleID = '/tmp/semicompiled-1Videmob-9632204705707288088/source.c'
source_filename = "/tmp/semicompiled-1Videmob-9632204705707288088/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
; Function Attrs: noinline nounwind optnone uwtable
define dso_local void @myEntry() #0 {
%1 = alloca i32, align 4
store i32 0, i32* %1, align 4
br label %2
2: ; preds = %11, %0
%3 = call i32 @produce()
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %14
5: ; preds = %2
%6 = load i32, i32* %1, align 4
%7 = add nsw i32 %6, 1
store i32 %7, i32* %1, align 4
%8 = call i32 @produce()
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %5
br label %14
11: ; preds = %5
%12 = load i32, i32* %1, align 4
%13 = add nsw i32 %12, 2
store i32 %13, i32* %1, align 4
br label %2
14: ; preds = %10, %2
ret void
}
declare dso_local i32 @produce() #1
attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{!"Debian clang version 11.0.1-2"}
; ModuleID = '/tmp/semicompiled-1Videmob-9632204705707288088/source.c'
source_filename = "/tmp/semicompiled-1Videmob-9632204705707288088/source.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
; Function Attrs: noinline nounwind optnone uwtable
define dso_local void @myEntry() #0 !dbg !7 {
%1 = alloca i32, align 4
call void @llvm.dbg.declare(metadata i32* %1, metadata !11, metadata !DIExpression()), !dbg !13
store i32 0, i32* %1, align 4, !dbg !13
br label %2, !dbg !14
2: ; preds = %11, %0
%3 = call i32 @produce(), !dbg !15
%4 = icmp ne i32 %3, 0, !dbg !14
br i1 %4, label %5, label %14, !dbg !14
5: ; preds = %2
%6 = load i32, i32* %1, align 4, !dbg !16
%7 = add nsw i32 %6, 1, !dbg !16
store i32 %7, i32* %1, align 4, !dbg !16
%8 = call i32 @produce(), !dbg !18
%9 = icmp ne i32 %8, 0, !dbg !18
br i1 %9, label %10, label %11, !dbg !20
10: ; preds = %5
br label %14, !dbg !21
11: ; preds = %5
%12 = load i32, i32* %1, align 4, !dbg !23
%13 = add nsw i32 %12, 2, !dbg !23
store i32 %13, i32* %1, align 4, !dbg !23
br label %2, !dbg !14, !llvm.loop !24
14: ; preds = %10, %2
ret void, !dbg !26
}
; Function Attrs: nounwind readnone speculatable willreturn
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
declare dso_local i32 @produce() #2
attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind readnone speculatable willreturn }
attributes #2 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="all" "less-precise-fpmad"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4, !5}
!llvm.ident = !{!6}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "Debian clang version 11.0.1-2", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "/tmp/semicompiled-1Videmob-9632204705707288088/source.c", directory: "/__w/semicompiled/semicompiled")
!2 = !{}
!3 = !{i32 7, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{!"Debian clang version 11.0.1-2"}
!7 = distinct !DISubprogram(name: "myEntry", scope: !8, file: !8, line: 2, type: !9, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
!8 = !DIFile(filename: "/tmp/semicompiled-1Videmob-9632204705707288088/source.c", directory: "")
!9 = !DISubroutineType(types: !10)
!10 = !{null}
!11 = !DILocalVariable(name: "x", scope: !7, file: !8, line: 4, type: !12)
!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!13 = !DILocation(line: 4, column: 9, scope: !7)
!14 = !DILocation(line: 5, column: 5, scope: !7)
!15 = !DILocation(line: 5, column: 12, scope: !7)
!16 = !DILocation(line: 7, column: 11, scope: !17)
!17 = distinct !DILexicalBlock(scope: !7, file: !8, line: 6, column: 5)
!18 = !DILocation(line: 8, column: 13, scope: !19)
!19 = distinct !DILexicalBlock(scope: !17, file: !8, line: 8, column: 13)
!20 = !DILocation(line: 8, column: 13, scope: !17)
!21 = !DILocation(line: 10, column: 13, scope: !22)
!22 = distinct !DILexicalBlock(scope: !19, file: !8, line: 9, column: 9)
!23 = !DILocation(line: 12, column: 11, scope: !17)
!24 = distinct !{!24, !14, !25}
!25 = !DILocation(line: 13, column: 5, scope: !7)
!26 = !DILocation(line: 14, column: 1, scope: !7)
(module
(type (;0;) (func))
(type (;1;) (func (result i32)))
(import "env" "produce" (func (;0;) (type 1)))
(import "env" "__stack_pointer" (global (;0;) (mut i32)))
(import "env" "__memory_base" (global (;1;) i32))
(import "env" "__table_base" (global (;2;) i32))
(import "env" "memory" (memory (;0;) 0))
(import "env" "__indirect_function_table" (table (;0;) 0 funcref))
(func (;1;) (type 0)
call 2)
(func (;2;) (type 0))
(func (;3;) (type 0)
(local i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32)
global.get 0
local.set 0
i32.const 16
local.set 1
local.get 0
local.get 1
i32.sub
local.set 2
local.get 2
global.set 0
i32.const 0
local.set 3
local.get 2
local.get 3
i32.store offset=12
block ;; label = @1
loop ;; label = @2
call 0
local.set 4
local.get 4
i32.eqz
br_if 1 (;@1;)
local.get 2
i32.load offset=12
local.set 5
i32.const 1
local.set 6
local.get 5
local.get 6
i32.add
local.set 7
local.get 2
local.get 7
i32.store offset=12
call 0
local.set 8
block ;; label = @3
local.get 8
i32.eqz
br_if 0 (;@3;)
br 2 (;@1;)
end
local.get 2
i32.load offset=12
local.set 9
i32.const 2
local.set 10
local.get 9
local.get 10
i32.add
local.set 11
local.get 2
local.get 11
i32.store offset=12
br 0 (;@2;)
end
unreachable
end
i32.const 16
local.set 12
local.get 2
local.get 12
i32.add
local.set 13
local.get 13
global.set 0
return)
(global (;3;) i32 (i32.const 0))
(export "__post_instantiate" (func 1))
(export "__wasm_apply_relocs" (func 2))
(export "myEntry" (func 3))
(export "__dso_handle" (global 3)))
/tmp/semicompiled-1Videmob-9632204705707288088/source.o: file format elf64-bpf
Disassembly of section .text:
0000000000000000 <myEntry>:
; myEntry():
; /tmp/semicompiled-1Videmob-9632204705707288088/source.c:3
; {
0: r1 = 0
; /tmp/semicompiled-1Videmob-9632204705707288088/source.c:4
; int x = 0;
1: *(u32 *)(r10 - 4) = r1
; /tmp/semicompiled-1Videmob-9632204705707288088/source.c:5
; while (produce())
2: goto +0 <LBB0_1>
0000000000000018 <LBB0_1>:
3: call -1
4: r0 <<= 32
5: r0 >>= 32
6: if r0 == 0 goto +14 <LBB0_5>
7: goto +0 <LBB0_2>
0000000000000040 <LBB0_2>:
; /tmp/semicompiled-1Videmob-9632204705707288088/source.c:7
; x += 1;
8: r1 = *(u32 *)(r10 - 4)
9: r1 += 1
10: *(u32 *)(r10 - 4) = r1
; /tmp/semicompiled-1Videmob-9632204705707288088/source.c:8
; if (produce())
11: call -1
12: r0 <<= 32
13: r0 >>= 32
14: if r0 == 0 goto +2 <LBB0_4>
15: goto +0 <LBB0_3>
0000000000000080 <LBB0_3>:
; /tmp/semicompiled-1Videmob-9632204705707288088/source.c:10
; break;
16: goto +4 <LBB0_5>
0000000000000088 <LBB0_4>:
; /tmp/semicompiled-1Videmob-9632204705707288088/source.c:12
; x += 2;
17: r1 = *(u32 *)(r10 - 4)
18: r1 += 2
19: *(u32 *)(r10 - 4) = r1
; /tmp/semicompiled-1Videmob-9632204705707288088/source.c:5
; while (produce())
20: goto -18 <LBB0_1>
00000000000000a8 <LBB0_5>:
; /tmp/semicompiled-1Videmob-9632204705707288088/source.c:14
; }
21: exit
Join the thriving social scene at github.com/andrewbaxter/semicompiled.