xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ pmm_modify_memory_region(unsigned int, unsigned int,
                                            int /*<<< orphan*/);
void pmm_add_memory_region(unsigned int start, unsigned int end) {
  pmm_modify_memory_region(start, end, 0);
}


x86 assembly (clang, -O0):
<pmm_add_memory_region>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
xor    %edx,%edx
call   1030 <pmm_modify_memory_region@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmm_add_memory_region>:
xor    %edx,%edx
jmp    1030 <pmm_modify_memory_region@plt>

LLVM IR (-O0):
define void @pmm_add_memory_region(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @pmm_modify_memory_region(i32 %5, i32 %6, i32 0)
ret void
}

LLVM IR (-O2):
define void @pmm_add_memory_region(i32 %0, i32 %1) {
%3 = tail call i32 @pmm_modify_memory_region(i32 %0, i32 %1, i32 0)
ret void
}
/* Type definitions */
struct list {
  int dummy;
};

/* Variables and functions */
int size_list_aux(struct list *, int /*<<< orphan*/);
int size_list(struct list *l) { return size_list_aux(l, 0); }


x86 assembly (clang, -O0):
<size_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <size_list_aux@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<size_list>:
xor    %esi,%esi
jmp    1030 <size_list_aux@plt>

LLVM IR (-O0):
%struct.list = type { i32 }
define i32 @size_list(%struct.list* %0) {
%2 = alloca %struct.list*
store %struct.list* %0, %struct.list** %2
%3 = load %struct.list*, %struct.list** %2
%4 = call i32 @size_list_aux(%struct.list* %3, i32 0)
ret i32 %4
}

LLVM IR (-O2):
%struct.list = type { i32 }
define i32 @size_list(%struct.list* %0) {
%2 = tail call i32 @size_list_aux(%struct.list* %0, i32 0)
ret i32 %2
}
/* Variables and functions */
int fun(int);
int /*<<< orphan*/ printf(char *, int);
void main() { printf("%d", fun(5)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
call   1030 <fun@plt>
mov    %eax,%esi
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
call   1030 <fun@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @main() {
%1 = call i32 @fun(i32 5)
%2 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @main() {
%1 = tail call i32 @fun(i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Type definitions */
struct Buffer {
  int dummy;
};

/* Variables and functions */
int buffer_open_at(struct Buffer *, char *, int /*<<< orphan*/,
                   int /*<<< orphan*/);
int buffer_open(struct Buffer *buf, char *file) {
  return buffer_open_at(buf, file, 0, 0);
}


x86 assembly (clang, -O0):
<buffer_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <buffer_open_at@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buffer_open>:
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <buffer_open_at@plt>

LLVM IR (-O0):
%struct.Buffer = type { i32 }
define i32 @buffer_open(%struct.Buffer* %0, i8* %1) {
%3 = alloca %struct.Buffer*
%4 = alloca i8*
store %struct.Buffer* %0, %struct.Buffer** %3
store i8* %1, i8** %4
%5 = load %struct.Buffer*, %struct.Buffer** %3
%6 = load i8*, i8** %4
%7 = call i32 @buffer_open_at(%struct.Buffer* %5, i8* %6, i32 0, i32 0)
ret i32 %7
}

LLVM IR (-O2):
%struct.Buffer = type { i32 }
define i32 @buffer_open(%struct.Buffer* %0, i8* %1) {
%3 = tail call i32 @buffer_open_at(%struct.Buffer* %0, i8* %1, i32 0, i32 0)
ret i32 %3
}
mod1(signed char x) { return x % -1; }


x86 assembly (clang, -O0):
<mod1>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
mov    $0xffffffff,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod1>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @mod1(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = srem i32 %4, -1
ret i32 %5
}

LLVM IR (-O2):
define i32 @mod1(i8 signext %0) {
ret i32 0
}
int begins(char string1[], char string2[]) {
  int index = 0;
  while (string1[index] != '\0') {
    if (string2[index] != string1[index]) {
      return 0;
    }
    ++index;
  }
  return 1;
}


x86 assembly (clang, -O0):
<begins>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1162 <begins+0x62>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1154 <begins+0x54>
movl   $0x0,-0x4(%rbp)
jmp    1169 <begins+0x69>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1113 <begins+0x13>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<begins>:
mov    (%rdi),%cl
mov    $0x1,%eax
test   %cl,%cl
je     1122 <begins+0x22>
xor    %edx,%edx
nopl   (%rax)
cmp    %cl,(%rsi,%rdx,1)
jne    1123 <begins+0x23>
movzbl 0x1(%rdi,%rdx,1),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1110 <begins+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @begins(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %6
br label %7
7: ; preds = %30, %2
%8 = load i8*, i8** %4
%9 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %33
15: ; preds = %7
%16 = load i8*, i8** %5
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = load i8*, i8** %4
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %21, %27
br i1 %28, label %29, label %30
29: ; preds = %15
store i32 0, i32* %3
br label %34
30: ; preds = %15
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %7
33: ; preds = %7
store i32 1, i32* %3
br label %34
34: ; preds = %33, %29
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
define i32 @begins(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %9
5: ; preds = %9
%6 = getelementptr inbounds i8, i8* %0, i64 %15
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %2, %5
%10 = phi i64 [ %15, %5 ], [ 0, %2 ]
%11 = phi i8 [ %7, %5 ], [ %3, %2 ]
%12 = getelementptr inbounds i8, i8* %1, i64 %10
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, %11
%15 = add nuw i64 %10, 1
br i1 %14, label %5, label %16
16: ; preds = %9, %5, %2
%17 = phi i32 [ 1, %2 ], [ 1, %5 ], [ 0, %9 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int scanf(char *, int *, int *);
int main() {
  int a, b;
  while (scanf("%d %d", &a, &b) == 2) {
    printf("%d\n", a ^ b);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    1163 <main+0x43>
mov    -0x8(%rbp),%esi
xor    -0xc(%rbp),%esi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xed1(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
jne    1182 <main+0x62>
lea    0xebe(%rip),%r14
lea    0xeb1(%rip),%r15
lea    0x4(%rsp),%r12
mov    %rsp,%rbx
nopw   0x0(%rax,%rax,1)
mov    (%rsp),%esi
xor    0x4(%rsp),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <scanf@plt>
cmp    $0x2,%eax
je     1160 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %7, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = xor i32 %8, %9
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %4
12: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = icmp eq i32 %5, 2
br i1 %6, label %7, label %14
7: ; preds = %0, %7
%8 = load i32, i32* %1
%9 = load i32, i32* %2
%10 = xor i32 %9, %8
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%13 = icmp eq i32 %12, 2
br i1 %13, label %7, label %14
14: ; preds = %7, %0
ret i32 0
}
void GC_add_ext_descriptor(void) {}


x86 assembly (clang, -O0):
<GC_add_ext_descriptor>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GC_add_ext_descriptor>:
ret

LLVM IR (-O0):
define void @GC_add_ext_descriptor() {
ret void
}

LLVM IR (-O2):
define void @GC_add_ext_descriptor() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Test1();
void Test() { Test1(); }


x86 assembly (clang, -O0):
<Test>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <Test1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Test>:
xor    %eax,%eax
jmp    1030 <Test1@plt>

LLVM IR (-O0):
define void @Test() {
%1 = call i32 (...) @Test1()
ret void
}

LLVM IR (-O2):
define void @Test() {
%1 = tail call i32 (...) @Test1()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stdout;
char *strerror(int /*<<< orphan*/);
void ewarn(char *msg) {
  fprintf(stdout, "WARNING: %s: %s\n", msg, strerror(errno));
}


x86 assembly (clang, -O0):
<ewarn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    %rax,%rcx
lea    0xea1(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ewarn>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eab(%rip),%rax
mov    (%rax),%ebp
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
lea    0xebc(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [17 x i8] c"WARNING: %s: %s\0A\00"
@errno = global i32 0
define void @ewarn(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stdout
%4 = load i8*, i8** %2
%5 = load i32, i32* @errno
%6 = call i8* @strerror(i32 %5)
%7 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %6)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [17 x i8] c"WARNING: %s: %s\0A\00"
@errno = global i32 0
define void @ewarn(i8* %0) {
%2 = load i32, i32* @stdout
%3 = load i32, i32* @errno
%4 = tail call i8* @strerror(i32 %3)
%5 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ help();
int /*<<< orphan*/ stderr;
conflict() {
  fprintf(stderr, "Conficting keys\n");
  help();
}


x86 assembly (clang, -O0):
<conflict>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
lea    0xec8(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x0,%al
call   1040 <help@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<conflict>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <help@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"Conficting keys\0A\00"
define i32 @conflict() {
%1 = alloca i32
%2 = load i32, i32* @stderr
%3 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @help()
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"Conficting keys\0A\00"
define i32 @conflict() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @help()
ret i32 undef
}
float score(float ave, int late) {
  if (late == 1 && ave > 4.92)
    return 4.92 + 0.01;
  ave -= ((float)late / 3.5);
  if (ave < 0.0)
    ave = 0.0;
  return ave;
}


x86 assembly (clang, -O0):
<score>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1143 <score+0x43>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed9(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1143 <score+0x43>
movss  0xed7(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1196 <score+0x96>
cvtsi2ssl -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeb4(%rip),%xmm0
divsd  %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    118c <score+0x8c>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<score>:
cvtss2sd %xmm0,%xmm0
cmp    $0x1,%edi
jne    111c <score+0x1c>
ucomisd 0xef7(%rip),%xmm0
jbe    111c <score+0x1c>
movss  0xee5(%rip),%xmm0
ret
cvtsi2ss %edi,%xmm1
cvtss2sd %xmm1,%xmm1
divsd  0xee4(%rip),%xmm1
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
xorps  %xmm0,%xmm0
maxss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @score(float %0, i32 %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store float %0, float* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load float, float* %4
%10 = fpext float %9 to double
%11 = fcmp ogt double %10, 4.920000e+00
br i1 %11, label %12, label %13
12: ; preds = %8
store float 0x4013B851E0000000, float* %3
br label %28
13: ; preds = %8, %2
%14 = load i32, i32* %5
%15 = sitofp i32 %14 to float
%16 = fpext float %15 to double
%17 = fdiv double %16, 3.500000e+00
%18 = load float, float* %4
%19 = fpext float %18 to double
%20 = fsub double %19, %17
%21 = fptrunc double %20 to float
store float %21, float* %4
%22 = load float, float* %4
%23 = fpext float %22 to double
%24 = fcmp olt double %23, 0.000000e+00
br i1 %24, label %25, label %26
25: ; preds = %13
store float 0.000000e+00, float* %4
br label %26
26: ; preds = %25, %13
%27 = load float, float* %4
store float %27, float* %3
br label %28
28: ; preds = %26, %12
%29 = load float, float* %3
ret float %29
}

LLVM IR (-O2):
define float @score(float %0, i32 %1) {
%3 = icmp eq i32 %1, 1
%4 = fpext float %0 to double
%5 = fcmp ogt double %4, 4.920000e+00
%6 = and i1 %3, %5
br i1 %6, label %15, label %7
7: ; preds = %2
%8 = sitofp i32 %1 to float
%9 = fpext float %8 to double
%10 = fdiv double %9, 3.500000e+00
%11 = fsub double %4, %10
%12 = fptrunc double %11 to float
%13 = fcmp olt float %12, 0.000000e+00
%14 = select i1 %13, float 0.000000e+00, float %12
br label %15
15: ; preds = %2, %7
%16 = phi float [ %14, %7 ], [ 0x4013B851E0000000, %2 ]
ret float %16
}
char *str_chrA(char *str, char chr) {
  register char tempch;
  if ((tempch = *str)) {
    do {
      if (tempch == chr)
        return (str);
    } while ((tempch = *(++str)));
  }
  return (0);
}


x86 assembly (clang, -O0):
<str_chrA>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x12(%rbp)
cmp    $0x0,%al
je     1168 <str_chrA+0x68>
jmp    1124 <str_chrA+0x24>
movsbl -0x12(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    1141 <str_chrA+0x41>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1170 <str_chrA+0x70>
jmp    1146 <str_chrA+0x46>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x1(%rax),%al
mov    %al,-0x12(%rbp)
cmp    $0x0,%al
jne    1124 <str_chrA+0x24>
jmp    1168 <str_chrA+0x68>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_chrA>:
mov    (%rdi),%cl
test   %cl,%cl
je     1121 <str_chrA+0x21>
mov    %rdi,%rax
nopl   0x0(%rax)
cmp    %sil,%cl
je     1123 <str_chrA+0x23>
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <str_chrA+0x10>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @str_chrA(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
store i8 %8, i8* %6
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %26
10: ; preds = %2
br label %11
11: ; preds = %20, %10
%12 = load i8, i8* %6
%13 = sext i8 %12 to i32
%14 = load i8, i8* %5
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %13, %15
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = load i8*, i8** %4
store i8* %18, i8** %3
br label %27
19: ; preds = %11
br label %20
20: ; preds = %19
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %4
%23 = load i8, i8* %22
store i8 %23, i8* %6
%24 = icmp ne i8 %23, 0
br i1 %24, label %11, label %25
25: ; preds = %20
br label %26
26: ; preds = %25, %2
store i8* null, i8** %3
br label %27
27: ; preds = %26, %17
%28 = load i8*, i8** %3
ret i8* %28
}

LLVM IR (-O2):
define i8* @str_chrA(i8* %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %9
%6 = phi i8* [ %10, %9 ], [ %0, %2 ]
%7 = phi i8 [ %11, %9 ], [ %3, %2 ]
%8 = icmp eq i8 %7, %1
br i1 %8, label %13, label %9
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %9, %5, %2
%14 = phi i8* [ null, %2 ], [ null, %9 ], [ %6, %5 ]
ret i8* %14
}
/* Variables and functions */
scalar_t__ level_act();
float f_act() { return (float)level_act(); }


x86 assembly (clang, -O0):
<f_act>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <level_act@plt>
cvtsi2ss %rax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_act>:
push   %rax
xor    %eax,%eax
call   1030 <level_act@plt>
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @f_act() {
%1 = call i64 (...) @level_act()
%2 = sitofp i64 %1 to float
ret float %2
}

LLVM IR (-O2):
define float @f_act() {
%1 = tail call i64 (...) @level_act()
%2 = sitofp i64 %1 to float
ret float %2
}
/* Variables and functions */
char *strdup(char *);
char *path_get_nwjs_cache() { return strdup("/usr/lib/nwjs/bin/"); }


x86 assembly (clang, -O0):
<path_get_nwjs_cache>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <strdup@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<path_get_nwjs_cache>:
lea    0xee9(%rip),%rdi
jmp    1030 <strdup@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"/usr/lib/nwjs/bin/\00"
define i8* @path_get_nwjs_cache() {
%1 = call i8* @strdup(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [19 x i8] c"/usr/lib/nwjs/bin/\00"
define noalias i8* @path_get_nwjs_cache() {
%1 = tail call dereferenceable_or_null(19) i8* @strdup(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
int glwin_handle_events(void *voidhandle) {
  { return (0); }
}


x86 assembly (clang, -O0):
<glwin_handle_events>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<glwin_handle_events>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @glwin_handle_events(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i32 0
}

LLVM IR (-O2):
define i32 @glwin_handle_events(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exeknow_know(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc < 2) {
    fprintf(stderr, "Bad number of parameters.\n");
    exit(1);
  }
  exeknow_know(argv[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    116f <main+0x3f>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <exeknow_know@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jle    1143 <main+0x13>
mov    0x8(%rsi),%rdi
call   1040 <exeknow_know@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
lea    0xead(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"Bad number of parameters.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @exeknow_know(i8* %15)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"Bad number of parameters.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @exeknow_know(i8* %10)
ret i32 0
}
/* Type definitions */
struct Heap {
  int dummy;
};
struct HNode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ heapFixup(struct Heap *, struct HNode *);
struct HNode *insertHNodeBinary(struct Heap *, char *, int *);
void insertHNode(struct Heap *heap, char *key, int *data) {
  struct HNode *n = insertHNodeBinary(heap, key, data);
  if (!n)
    return;
  heapFixup(heap, n);
}


x86 assembly (clang, -O0):
<insertHNode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <insertHNodeBinary@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1159 <insertHNode+0x39>
jmp    1166 <insertHNode+0x46>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <heapFixup@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insertHNode>:
push   %rbx
mov    %rdi,%rbx
call   1030 <insertHNodeBinary@plt>
test   %rax,%rax
je     113a <insertHNode+0x1a>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1040 <heapFixup@plt>
pop    %rbx
ret

LLVM IR (-O0):
%struct.Heap = type { i32 }
%struct.HNode = type { i32 }
define void @insertHNode(%struct.Heap* %0, i8* %1, i32* %2) {
%4 = alloca %struct.Heap*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca %struct.HNode*
store %struct.Heap* %0, %struct.Heap** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%8 = load %struct.Heap*, %struct.Heap** %4
%9 = load i8*, i8** %5
%10 = load i32*, i32** %6
%11 = call %struct.HNode* @insertHNodeBinary(%struct.Heap* %8, i8* %9, i32* %10)
store %struct.HNode* %11, %struct.HNode** %7
%12 = load %struct.HNode*, %struct.HNode** %7
%13 = icmp ne %struct.HNode* %12, null
br i1 %13, label %15, label %14
14: ; preds = %3
br label %19
15: ; preds = %3
%16 = load %struct.Heap*, %struct.Heap** %4
%17 = load %struct.HNode*, %struct.HNode** %7
%18 = call i32 @heapFixup(%struct.Heap* %16, %struct.HNode* %17)
br label %19
19: ; preds = %15, %14
ret void
}

LLVM IR (-O2):
%struct.Heap = type { i32 }
%struct.HNode = type { i32 }
define void @insertHNode(%struct.Heap* %0, i8* %1, i32* %2) {
%4 = tail call %struct.HNode* @insertHNodeBinary(%struct.Heap* %0, i8* %1, i32* %2)
%5 = icmp eq %struct.HNode* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @heapFixup(%struct.Heap* %0, %struct.HNode* %4)
br label %8
8: ; preds = %3, %6
ret void
}
int hash(char key, int nbuckets) { return key % nbuckets; }


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    %edi,%eax
cltd
idiv   %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @hash(i8 signext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = load i32, i32* %4
%8 = srem i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @hash(i8 signext %0, i32 %1) {
%3 = sext i8 %0 to i32
%4 = srem i32 %3, %1
ret i32 %4
}
/* Type definitions */
struct flashrom_flashctx {
  int dummy;
};
typedef int /*<<< orphan*/ cmd;

/* Variables and functions */
int spi_send_command(struct flashrom_flashctx *, int, int /*<<< orphan*/,
                     unsigned char const *, int /*<<< orphan*/ *);
int spi_write_disable(struct flashrom_flashctx *flash) {
  static const unsigned char cmd[0x01] = {0x04};
  return spi_send_command(flash, sizeof(cmd), 0, cmd, NULL);
}


x86 assembly (clang, -O0):
<spi_write_disable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
xor    %edx,%edx
lea    0xed2(%rip),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <spi_send_command@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_write_disable>:
lea    0xee9(%rip),%rcx
mov    $0x1,%esi
xor    %edx,%edx
xor    %r8d,%r8d
jmp    1030 <spi_send_command@plt>

LLVM IR (-O0):
%struct.flashrom_flashctx = type { i32 }
@spi_write_disable.cmd = internal constant [1 x i8] c"\04"
define i32 @spi_write_disable(%struct.flashrom_flashctx* %0) {
%2 = alloca %struct.flashrom_flashctx*
store %struct.flashrom_flashctx* %0, %struct.flashrom_flashctx** %2
%3 = load %struct.flashrom_flashctx*, %struct.flashrom_flashctx** %2
%4 = call i32 @spi_send_command(%struct.flashrom_flashctx* %3, i32 1, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @spi_write_disable.cmd, i64 0, i64 0), i32* null)
ret i32 %4
}

LLVM IR (-O2):
%struct.flashrom_flashctx = type { i32 }
@spi_write_disable.cmd = internal constant [1 x i8] c"\04"
define i32 @spi_write_disable(%struct.flashrom_flashctx* %0) {
%2 = tail call i32 @spi_send_command(%struct.flashrom_flashctx* %0, i32 1, i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @spi_write_disable.cmd, i64 0, i64 0), i32* null)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ S(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num;
  printf("Informe o numero inteiro positivo: ");
  scanf("%d", &num);
  printf("S = %.10lf\n", S(num));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1040 <S@plt>
mov    %eax,%esi
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <S@plt>
lea    0xec7(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Informe o numero inteiro positivo: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"S = %.10lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = call i32 @S(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"Informe o numero inteiro positivo: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [12 x i8] c"S = %.10lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @S(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t write_i2c(uint8_t addr_i2c, uint8_t *data, uint8_t nb_byte) {}


x86 assembly (clang, -O0):
<write_i2c>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_i2c>:
ret

LLVM IR (-O0):
define i32 @write_i2c(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32 %2, i32* %7
%8 = load i32, i32* %4
ret i32 %8
}

LLVM IR (-O2):
define i32 @write_i2c(i32 %0, i32* nocapture readnone %1, i32 %2) {
ret i32 undef
}
int ffs(int i) {
  int n;
  for (n = 0; n < 31; n++) {
    if (i & (1 << n)) {
      return n + 1;
    };
  };
  return 0;
}


x86 assembly (clang, -O0):
<ffs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x1f,-0xc(%rbp)
jge    1153 <ffs+0x53>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1140 <ffs+0x40>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115a <ffs+0x5a>
jmp    1145 <ffs+0x45>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <ffs+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffs>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x1(%rax),%ecx
bt     %eax,%edi
jb     1136 <ffs+0x36>
lea    0x2(%rax),%edx
bt     %ecx,%edi
jb     1139 <ffs+0x39>
lea    0x3(%rax),%ecx
bt     %edx,%edi
jb     1136 <ffs+0x36>
cmp    $0x1c,%eax
je     113c <ffs+0x3c>
add    $0x4,%eax
bt     %ecx,%edi
jae    1110 <ffs+0x10>
ret
mov    %ecx,%eax
ret
mov    %edx,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @ffs(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %18, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 31
br i1 %7, label %8, label %21
8: ; preds = %5
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = shl i32 1, %10
%12 = and i32 %9, %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %8
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %22
17: ; preds = %8
br label %18
18: ; preds = %17
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %5
21: ; preds = %5
store i32 0, i32* %2
br label %22
22: ; preds = %21, %14
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @ffs(i32 %0) {
br label %2
2: ; preds = %20, %1
%3 = phi i32 [ 0, %1 ], [ %24, %20 ]
%4 = shl nuw nsw i32 1, %3
%5 = and i32 %4, %0
%6 = icmp eq i32 %5, 0
%7 = or i32 %3, 1
br i1 %6, label %8, label %25
8: ; preds = %2
%9 = shl nuw nsw i32 1, %7
%10 = and i32 %9, %0
%11 = icmp eq i32 %10, 0
%12 = or i32 %3, 2
br i1 %11, label %13, label %25
13: ; preds = %8
%14 = shl nuw nsw i32 1, %12
%15 = and i32 %14, %0
%16 = icmp eq i32 %15, 0
%17 = or i32 %3, 3
br i1 %16, label %18, label %25
18: ; preds = %13
%19 = icmp eq i32 %17, 31
br i1 %19, label %25, label %20
20: ; preds = %18
%21 = shl nuw nsw i32 1, %17
%22 = and i32 %21, %0
%23 = icmp eq i32 %22, 0
%24 = add nuw nsw i32 %3, 4
br i1 %23, label %2, label %25
25: ; preds = %20, %18, %13, %8, %2
%26 = phi i32 [ %7, %2 ], [ %12, %8 ], [ %17, %13 ], [ 0, %18 ], [ %24, %20 ]
ret i32 %26
}
/* Variables and functions */
int /*<<< orphan*/ MicoSleepHelper(unsigned int, int);
void MicoSleepMilliSecs(unsigned int timeInMilliSecs) {
  MicoSleepHelper(timeInMilliSecs, ((25000000) / 11000));
  return;
}


x86 assembly (clang, -O0):
<MicoSleepMilliSecs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x8e0,%esi
call   1030 <MicoSleepHelper@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MicoSleepMilliSecs>:
mov    $0x8e0,%esi
jmp    1030 <MicoSleepHelper@plt>

LLVM IR (-O0):
define void @MicoSleepMilliSecs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @MicoSleepHelper(i32 %3, i32 2272)
ret void
}

LLVM IR (-O2):
define void @MicoSleepMilliSecs(i32 %0) {
%2 = tail call i32 @MicoSleepHelper(i32 %0, i32 2272)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lisys_error_get(char const **);
int /*<<< orphan*/ printf(char *, char const *);
void lisys_error_report() {
  const char *ret;
  lisys_error_get(&ret);
  printf("ERROR: %s\n", ret);
}


x86 assembly (clang, -O0):
<lisys_error_report>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1040 <lisys_error_get@plt>
mov    -0x8(%rbp),%rsi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lisys_error_report>:
push   %rax
mov    %rsp,%rdi
call   1040 <lisys_error_get@plt>
mov    (%rsp),%rsi
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [11 x i8] c"ERROR: %s\0A\00"
define void @lisys_error_report() {
%1 = alloca i8*
%2 = call i32 @lisys_error_get(i8** %1)
%3 = load i8*, i8** %1
%4 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"ERROR: %s\0A\00"
define void @lisys_error_report() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
%3 = call i32 @lisys_error_get(i8** %1)
%4 = load i8*, i8** %1
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}
void gtk_accessible_get_type() {}


x86 assembly (clang, -O0):
<gtk_accessible_get_type>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gtk_accessible_get_type>:
ret

LLVM IR (-O0):
define void @gtk_accessible_get_type() {
ret void
}

LLVM IR (-O2):
define void @gtk_accessible_get_type() {
ret void
}
long f12(long x, int y) { return x & ((1L << y) - 1); }


x86 assembly (clang, -O0):
<f12>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%rdx
mov    %rdx,%rcx
sub    $0x1,%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f12>:
mov    %esi,%ecx
mov    $0xffffffffffffffff,%rax
shl    %cl,%rax
not    %rax
and    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @f12(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i32, i32* %4
%7 = zext i32 %6 to i64
%8 = shl i64 1, %7
%9 = sub nsw i64 %8, 1
%10 = and i64 %5, %9
ret i64 %10
}

LLVM IR (-O2):
define i64 @f12(i64 %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = shl nsw i64 -1, %3
%5 = xor i64 %4, -1
%6 = and i64 %5, %0
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void unknown_instruction() { abort(); }


x86 assembly (clang, -O0):
<unknown_instruction>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<unknown_instruction>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @unknown_instruction() {
%1 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @unknown_instruction() {
%1 = tail call i32 (...) @abort()
unreachable
}
int cint(double d) {
  int i;
  i = (int)(d + 0.5);
  return (i);
}


x86 assembly (clang, -O0):
<cint>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cint>:
addsd  0xef8(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @cint(double %0) {
%2 = alloca double
%3 = alloca i32
store double %0, double* %2
%4 = load double, double* %2
%5 = fadd double %4, 5.000000e-01
%6 = fptosi double %5 to i32
store i32 %6, i32* %3
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @cint(double %0) {
%2 = fadd double %0, 5.000000e-01
%3 = fptosi double %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("Hello, CS240 students!\n"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Hello, CS240 students!\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [23 x i8] c"Hello, CS240 students!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void DL_Shutdown(void) {}


x86 assembly (clang, -O0):
<DL_Shutdown>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DL_Shutdown>:
ret

LLVM IR (-O0):
define void @DL_Shutdown() {
ret void
}

LLVM IR (-O2):
define void @DL_Shutdown() {
ret void
}
int add_two(int x) { return x + 2; }


x86 assembly (clang, -O0):
<add_two>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_two>:
lea    0x2(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @add_two(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 2
ret i32 %4
}

LLVM IR (-O2):
define i32 @add_two(i32 %0) {
%2 = add nsw i32 %0, 2
ret i32 %2
}
void foo(long x, long y, long z) {}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
ret

LLVM IR (-O0):
define void @foo(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
ret void
}

LLVM IR (-O2):
define void @foo(i64 %0, i64 %1, i64 %2) {
ret void
}
void BANCO_Finalizacao() {}


x86 assembly (clang, -O0):
<BANCO_Finalizacao>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BANCO_Finalizacao>:
ret

LLVM IR (-O0):
define void @BANCO_Finalizacao() {
ret void
}

LLVM IR (-O2):
define void @BANCO_Finalizacao() {
ret void
}
int even(int x) { return !(x & 1); }


x86 assembly (clang, -O0):
<even>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<even>:
mov    %edi,%eax
not    %eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @even(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 1
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @even(i32 %0) {
%2 = and i32 %0, 1
%3 = xor i32 %2, 1
ret i32 %3
}
/* Variables and functions */
int gcd(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int a, b;
  scanf("%d %d", &a, &b);
  printf("%d\n", gcd(a, b));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <gcd@plt>
mov    %eax,%esi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1050 <gcd@plt>
lea    0xeae(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = call i32 @gcd(i32 %4, i32 %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = call i32 @gcd(i32 %6, i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}
/* Type definitions */
struct list_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __list_splice_tail(struct list_head *, struct list_head *);
int /*<<< orphan*/ list_empty(struct list_head *);
void list_splice_tail(struct list_head *list, struct list_head *head) {
  if (!list_empty(list))
    __list_splice_tail(list, head);
}


x86 assembly (clang, -O0):
<list_splice_tail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <list_empty@plt>
cmp    $0x0,%eax
jne    114f <list_splice_tail+0x2f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <__list_splice_tail@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_splice_tail>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <list_empty@plt>
test   %eax,%eax
je     113b <list_splice_tail+0x1b>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <__list_splice_tail@plt>

LLVM IR (-O0):
%struct.list_head = type { i32 }
define void @list_splice_tail(%struct.list_head* %0, %struct.list_head* %1) {
%3 = alloca %struct.list_head*
%4 = alloca %struct.list_head*
store %struct.list_head* %0, %struct.list_head** %3
store %struct.list_head* %1, %struct.list_head** %4
%5 = load %struct.list_head*, %struct.list_head** %3
%6 = call i32 @list_empty(%struct.list_head* %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load %struct.list_head*, %struct.list_head** %3
%10 = load %struct.list_head*, %struct.list_head** %4
%11 = call i32 @__list_splice_tail(%struct.list_head* %9, %struct.list_head* %10)
br label %12
12: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
%struct.list_head = type { i32 }
define void @list_splice_tail(%struct.list_head* %0, %struct.list_head* %1) {
%3 = tail call i32 @list_empty(%struct.list_head* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @__list_splice_tail(%struct.list_head* %0, %struct.list_head* %1)
br label %7
7: ; preds = %5, %2
ret void
}
/* Variables and functions */
void stream_init(void) {
  static bool g_stream_init = false;
  if (g_stream_init == false) {
    g_stream_init = true;
  }
}


x86 assembly (clang, -O0):
<stream_init>:
push   %rbp
mov    %rsp,%rbp
cmpl   $0x0,0x2f19(%rip)
jne    111b <stream_init+0x1b>
movl   $0x1,0x2f09(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<stream_init>:
cmpb   $0x0,0x2f1d(%rip)
jne    1110 <stream_init+0x10>
movb   $0x1,0x2f14(%rip)
ret

LLVM IR (-O0):
@stream_init.g_stream_init = internal global i32 0
define void @stream_init() {
%1 = load i32, i32* @stream_init.g_stream_init
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %4
3: ; preds = %0
store i32 1, i32* @stream_init.g_stream_init
br label %4
4: ; preds = %3, %0
ret void
}

LLVM IR (-O2):
@stream_init.g_stream_init = internal unnamed_addr global i1 false
define void @stream_init() {
%1 = load i1, i1* @stream_init.g_stream_init
br i1 %1, label %3, label %2
2: ; preds = %0
store i1 true, i1* @stream_init.g_stream_init
br label %3
3: ; preds = %2, %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ swscanf(int /*<<< orphan*/ *, char *, long *, long *);
void getHeaderInfo_HashTableFile(wchar_t *buffer, long int *hash_table_length,
                                 long int *hash_table_filled) {
  swscanf(buffer, L":%ld,%ld\n", hash_table_length, hash_table_filled);
}


x86 assembly (clang, -O0):
<getHeaderInfo_HashTableFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xec9(%rip),%rsi
call   1030 <swscanf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getHeaderInfo_HashTableFile>:
mov    %rdx,%rcx
mov    %rsi,%rdx
lea    0xee3(%rip),%rsi
jmp    1030 <swscanf@plt>

LLVM IR (-O0):
@.str = [10 x i32] [i32 58, i32 37, i32 108, i32 100, i32 44, i32 37, i32 108, i32 100, i32 10, i32 0]
define void @getHeaderInfo_HashTableFile(i32* %0, i64* %1, i64* %2) {
%4 = alloca i32*
%5 = alloca i64*
%6 = alloca i64*
store i32* %0, i32** %4
store i64* %1, i64** %5
store i64* %2, i64** %6
%7 = load i32*, i32** %4
%8 = load i64*, i64** %5
%9 = load i64*, i64** %6
%10 = call i32 @swscanf(i32* %7, i8* bitcast ([10 x i32]* @.str to i8*), i64* %8, i64* %9)
ret void
}

LLVM IR (-O2):
@.str = [10 x i32] [i32 58, i32 37, i32 108, i32 100, i32 44, i32 37, i32 108, i32 100, i32 10, i32 0]
define void @getHeaderInfo_HashTableFile(i32* %0, i64* %1, i64* %2) {
%4 = tail call i32 @swscanf(i32* %0, i8* bitcast ([10 x i32]* @.str to i8*), i64* %1, i64* %2)
ret void
}