xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ test_case(int);
int main() {
  while (1) {
    int n;
    scanf("%d", &n);
    if (!n)
      break;
    test_case(n);
  }
  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
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    114e <main+0x2e>
jmp    115b <main+0x3b>
mov    -0x8(%rbp),%edi
call   1030 <test_case@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
test   %edi,%edi
je     1168 <main+0x48>
lea    0xebc(%rip),%r14
lea    0x4(%rsp),%rbx
nopl   0x0(%rax)
call   1030 <test_case@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
test   %edi,%edi
jne    1150 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %10, %6 ], [ %4, %0 ]
%8 = call i32 @test_case(i32 %7)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %6
12: ; preds = %6, %0
ret i32 0
}
/* Type definitions */
typedef int uint64_t;
typedef scalar_t__ time_t;

/* Variables and functions */
uint64_t time2mjdsec(time_t time) {
  return ((uint64_t)40587 * 24 * 60 * 60 + (uint64_t)time);
}


x86 assembly (clang, -O0):
<time2mjdsec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xd1044080,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @time2mjdsec(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = add nsw i32 -788250496, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @time2mjdsec(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = add nsw i32 %2, -788250496
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(void *);
int /*<<< orphan*/ free(void *);
void xfree(void *ptr) {
  assert(ptr);
  free(ptr);
}


x86 assembly (clang, -O0):
<xfree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfree>:
push   %rbx
mov    %rdi,%rbx
call   1040 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @xfree(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @assert(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @xfree(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = tail call i32 @free(i8* %0)
ret void
}
unsigned int VENUS_EXTRADATA_SIZE(int width, int height) {
  (void)height;
  (void)width;
  return 8 * 1024;
}


x86 assembly (clang, -O0):
<VENUS_EXTRADATA_SIZE>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x2000,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<VENUS_EXTRADATA_SIZE>:
mov    $0x2000,%eax
ret

LLVM IR (-O0):
define i32 @VENUS_EXTRADATA_SIZE(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
ret i32 8192
}

LLVM IR (-O2):
define i32 @VENUS_EXTRADATA_SIZE(i32 %0, i32 %1) {
ret i32 8192
}
/* Variables and functions */
int /*<<< orphan*/ testloop();
int main(int argc, char *argv[]) { testloop(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <testloop@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <testloop@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @testloop()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @testloop()
ret i32 0
}
indreg0imm1_set(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{ (*p0) = 33; }


x86 assembly (clang, -O0):
<indreg0imm1_set>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movw   $0x21,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<indreg0imm1_set>:
movw   $0x21,(%r8)
ret

LLVM IR (-O0):
define i32 @indreg0imm1_set(i32 %0, i32 %1, i32 %2, i32 %3, i16* %4, i16* %5) {
%7 = alloca i32
%8 = alloca i16
%9 = alloca i16
%10 = alloca i32
%11 = alloca i32
%12 = alloca i16*
%13 = alloca i16*
%14 = trunc i32 %0 to i16
%15 = trunc i32 %1 to i16
store i16 %14, i16* %8
store i16 %15, i16* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i16* %4, i16** %12
store i16* %5, i16** %13
%16 = load i16*, i16** %12
store i16 33, i16* %16
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
define i32 @indreg0imm1_set(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture writeonly %4, i16* nocapture readnone %5) {
store i16 33, i16* %4
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void func() { printf("This is a function\n"); }


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"This is a function\0A\00"
define void @func() {
%1 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [19 x i8] c"This is a function\00"
define void @func() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret void
}
int cmp(void const *lhs_v, void const *rhs_v) {
  int const *const lhs = lhs_v;
  int const *const rhs = rhs_v;
  return *lhs - *rhs;
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %6
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = load i32*, i32** %6
%14 = load i32, i32* %13
%15 = sub nsw i32 %12, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %5, %6
ret i32 %7
}
/* Variables and functions */
int max_sum(int *, int);
int max_sum_brute(int *, int);
int test_mixed() {
  int input[] = {3, -8, -1, 2, 4, -2, 3};
  return 7 == max_sum_brute(input, 7) && 7 == max_sum(input, 7);
}


x86 assembly (clang, -O0):
<test_mixed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec9(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1040 <max_sum_brute@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x7,%ecx
cmp    %edx,%ecx
mov    %al,-0x21(%rbp)
jne    1191 <test_mixed+0x71>
lea    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1030 <max_sum@plt>
mov    %eax,%ecx
mov    $0x7,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mixed>:
sub    $0x28,%rsp
movups 0xee1(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x7,%esi
call   1040 <max_sum_brute@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x7,%ecx
jne    1168 <test_mixed+0x48>
mov    %rsp,%rdi
mov    $0x7,%esi
call   1030 <max_sum@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x7,%ecx
sete   %al
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.test_mixed.input = [7 x i32] [i32 3, i32 -8, i32 -1, i32 2, i32 4, i32 -2, i32 3]
define i32 @test_mixed() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%4 = call i32 @max_sum_brute(i32* %3, i32 7)
%5 = icmp eq i32 7, %4
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%8 = call i32 @max_sum(i32* %7, i32 7)
%9 = icmp eq i32 7, %8
br label %10
10: ; preds = %6, %0
%11 = phi i1 [ false, %0 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
@__const.test_mixed.input = [7 x i32] [i32 3, i32 -8, i32 -1, i32 2, i32 4, i32 -2, i32 3]
define i32 @test_mixed() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%4 = call i32 @max_sum_brute(i32* %3, i32 7)
%5 = icmp eq i32 %4, 7
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = call i32 @max_sum(i32* %3, i32 7)
%8 = icmp eq i32 %7, 7
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %0
%11 = phi i32 [ 0, %0 ], [ %9, %6 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ File_Exists(char *);
int /*<<< orphan*/ Write_File(char *, char *, int /*<<< orphan*/);
void touch_file(char *path) {
  if (!File_Exists(path))
    Write_File(path, "", 0);
}


x86 assembly (clang, -O0):
<touch_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <File_Exists@plt>
cmp    $0x0,%eax
jne    1150 <touch_file+0x30>
mov    -0x8(%rbp),%rdi
lea    0xeb7(%rip),%rsi
xor    %edx,%edx
call   1040 <Write_File@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<touch_file>:
push   %rbx
mov    %rdi,%rbx
call   1030 <File_Exists@plt>
test   %eax,%eax
je     112f <touch_file+0xf>
pop    %rbx
ret
lea    0xeca(%rip),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
pop    %rbx
jmp    1040 <Write_File@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @touch_file(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @File_Exists(i8* %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @Write_File(i8* %7, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 0)
br label %9
9: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @touch_file(i8* %0) {
%2 = tail call i32 @File_Exists(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @Write_File(i8* %0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 0)
br label %6
6: ; preds = %4, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ fork();
pid_t __vfork() { return fork(); }


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

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

LLVM IR (-O0):
define i32 @__vfork() {
%1 = call i32 (...) @fork()
ret i32 %1
}

LLVM IR (-O2):
define i32 @__vfork() {
%1 = tail call i32 (...) @fork()
ret i32 %1
}
int bitcount(unsigned x) {
  int b = 0;
  while (x) {
    x &= (x - 1);
    b++;
  }
  return b;
}


x86 assembly (clang, -O0):
<bitcount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1132 <bitcount+0x32>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <bitcount+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitcount>:
xor    %eax,%eax
test   %edi,%edi
je     111c <bitcount+0x1c>
cs nopw 0x0(%rax,%rax,1)
lea    -0x1(%rdi),%ecx
add    $0x1,%eax
and    %edi,%ecx
mov    %ecx,%edi
jne    1110 <bitcount+0x10>
ret

LLVM IR (-O0):
define i32 @bitcount(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sub i32 %8, 1
%10 = load i32, i32* %2
%11 = and i32 %10, %9
store i32 %11, i32* %2
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @bitcount(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %7, %3 ], [ %0, %1 ]
%6 = add i32 %5, -1
%7 = and i32 %6, %5
%8 = add nuw nsw i32 %4, 1
%9 = icmp eq i32 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ exit_error(char *);
void *realloc(void *, size_t);
void *xrealloc(void *ptr, size_t size) {
  void *p;
  if ((p = realloc(ptr, size)) == NULL) {
    exit_error("xrealloc: No enough memory");
  }
  return p;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1157 <xrealloc+0x37>
lea    0xeae(%rip),%rdi
call   1030 <exit_error@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rbx
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <xrealloc+0x1a>
lea    0xecb(%rip),%rdi
call   1030 <exit_error@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"xrealloc: No enough memory\00"
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @exit_error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
%13 = load i8*, i8** %5
ret i8* %13
}

LLVM IR (-O2):
@.str = [27 x i8] c"xrealloc: No enough memory\00"
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @exit_error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
int diff(char const *ap, char const *bp, char const *udata, int uleng) {
  (void)udata, (void)uleng;
  while (1) {
    if (*ap != *bp)
      return 1;
    if (*ap == 0)
      return 0;
    ++ap, ++bp;
  }
}


x86 assembly (clang, -O0):
<diff>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1135 <diff+0x35>
movl   $0x1,-0x4(%rbp)
jmp    116e <diff+0x6e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1151 <diff+0x51>
movl   $0x0,-0x4(%rbp)
jmp    116e <diff+0x6e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1113 <diff+0x13>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<diff>:
mov    (%rdi),%cl
mov    $0x1,%eax
cmp    (%rsi),%cl
jne    1124 <diff+0x24>
mov    $0x1,%edx
test   %cl,%cl
je     1125 <diff+0x25>
movzbl (%rdi,%rdx,1),%ecx
lea    0x1(%rdx),%r8
cmp    (%rsi,%rdx,1),%cl
mov    %r8,%rdx
je     1110 <diff+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @diff(i8* nocapture %0, i8* nocapture %1, i8* nocapture readnone %2, i32 %3) {
%5 = load i8, i8* %0
%6 = load i8, i8* %1
%7 = icmp eq i8 %5, %6
br i1 %7, label %8, label %19
8: ; preds = %4, %13
%9 = phi i8 [ %16, %13 ], [ %5, %4 ]
%10 = phi i8* [ %14, %13 ], [ %0, %4 ]
%11 = phi i8* [ %15, %13 ], [ %1, %4 ]
%12 = icmp eq i8 %9, 0
br i1 %12, label %19, label %13
13: ; preds = %8
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = getelementptr inbounds i8, i8* %11, i64 1
%16 = load i8, i8* %14
%17 = load i8, i8* %15
%18 = icmp eq i8 %16, %17
br i1 %18, label %8, label %19
19: ; preds = %13, %8, %4
%20 = phi i32 [ 1, %4 ], [ 0, %8 ], [ 1, %13 ]
ret i32 %20
}
/* Type definitions */
struct timeval {
  int dummy;
};
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int syscall_cp(int, int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
               int /*<<< orphan*/ *, struct timeval *);
int select(int n, fd_set *rfds, fd_set *wfds, fd_set *efds,
           struct timeval *tv) {
  return syscall_cp(23, n, rfds, wfds, efds, tv);
}


x86 assembly (clang, -O0):
<select>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    $0x17,%edi
call   1030 <syscall_cp@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<select>:
mov    %r8,%r9
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0x17,%edi
jmp    1030 <syscall_cp@plt>

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i32 @select(i32 %0, i32* %1, i32* %2, i32* %3, %struct.timeval* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca %struct.timeval*
store i32 %0, i32* %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store %struct.timeval* %4, %struct.timeval** %10
%11 = load i32, i32* %6
%12 = load i32*, i32** %7
%13 = load i32*, i32** %8
%14 = load i32*, i32** %9
%15 = load %struct.timeval*, %struct.timeval** %10
%16 = call i32 @syscall_cp(i32 23, i32 %11, i32* %12, i32* %13, i32* %14, %struct.timeval* %15)
ret i32 %16
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @select(i32 %0, i32* %1, i32* %2, i32* %3, %struct.timeval* %4) {
%6 = tail call i32 @syscall_cp(i32 23, i32 %0, i32* %1, i32* %2, i32* %3, %struct.timeval* %4)
ret i32 %6
}
int SaveSnapshot(void) { return (0); }


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

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

LLVM IR (-O0):
define i32 @SaveSnapshot() {
ret i32 0
}

LLVM IR (-O2):
define i32 @SaveSnapshot() {
ret i32 0
}
char *strrep(char *s, char find, char replace) {
  char *p = s;
  while (*p) {
    if (*p == find)
      *p = replace;
    p++;
  }
  return s;
}


x86 assembly (clang, -O0):
<strrep>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1155 <strrep+0x55>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1144 <strrep+0x44>
mov    -0xa(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    111b <strrep+0x1b>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strrep>:
mov    %rdi,%rax
mov    (%rdi),%cl
test   %cl,%cl
je     1125 <strrep+0x25>
lea    0x1(%rax),%rdi
jmp    111b <strrep+0x1b>
nop
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
je     1125 <strrep+0x25>
cmp    %sil,%cl
jne    1110 <strrep+0x10>
mov    %dl,-0x1(%rdi)
jmp    1110 <strrep+0x10>
ret

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

LLVM IR (-O2):
define i8* @strrep(i8* returned %0, i8 signext %1, i8 signext %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %3, %11
%7 = phi i8 [ %13, %11 ], [ %4, %3 ]
%8 = phi i8* [ %12, %11 ], [ %0, %3 ]
%9 = icmp eq i8 %7, %1
br i1 %9, label %10, label %11
10: ; preds = %6
store i8 %2, i8* %8
br label %11
11: ; preds = %10, %6
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %6
15: ; preds = %11, %3
ret i8* %0
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double time_end(double start) {
  struct timeval time;
  double seconds, microseconds;
  gettimeofday(&time, NULL);
  seconds = (double)time.tv_sec;
  microseconds = (double)time.tv_usec;
  return (seconds + microseconds / 1e6) - start;
}


x86 assembly (clang, -O0):
<time_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdq -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xeae(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
subsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_end>:
sub    $0x18,%rsp
movsd  %xmm0,(%rsp)
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
xorps  %xmm0,%xmm0
cvtsi2sdq 0x8(%rsp),%xmm0
divsd  0xec2(%rip),%xmm0
addsd  %xmm1,%xmm0
subsd  (%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define double @time_end(double %0) {
%2 = alloca double
%3 = alloca %struct.timeval
%4 = alloca double
%5 = alloca double
store double %0, double* %2
%6 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
store double %9, double* %4
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%11 = load i64, i64* %10
%12 = sitofp i64 %11 to double
store double %12, double* %5
%13 = load double, double* %4
%14 = load double, double* %5
%15 = fdiv double %14, 1.000000e+06
%16 = fadd double %13, %15
%17 = load double, double* %2
%18 = fsub double %16, %17
ret double %18
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define double @time_end(double %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
%6 = load i64, i64* %5
%7 = sitofp i64 %6 to double
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%9 = load i64, i64* %8
%10 = sitofp i64 %9 to double
%11 = fdiv double %10, 1.000000e+06
%12 = fadd double %11, %7
%13 = fsub double %12, %0
ret double %13
}
/* Variables and functions */
int /*<<< orphan*/ assertFuzzyEquals(int /*<<< orphan*/, double);
int /*<<< orphan*/ dist(double, double);
void dotest1(double v, double mu, double expected) {
  assertFuzzyEquals(dist(v, mu), expected);
}


x86 assembly (clang, -O0):
<dotest1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1040 <dist@plt>
mov    %eax,%edi
movsd  -0x18(%rbp),%xmm0
call   1030 <assertFuzzyEquals@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dotest1>:
push   %rax
movsd  %xmm2,(%rsp)
call   1040 <dist@plt>
mov    %eax,%edi
movsd  (%rsp),%xmm0
pop    %rax
jmp    1030 <assertFuzzyEquals@plt>

LLVM IR (-O0):
define void @dotest1(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = call i32 @dist(double %7, double %8)
%10 = load double, double* %6
%11 = call i32 @assertFuzzyEquals(i32 %9, double %10)
ret void
}

LLVM IR (-O2):
define void @dotest1(double %0, double %1, double %2) {
%4 = tail call i32 @dist(double %0, double %1)
%5 = tail call i32 @assertFuzzyEquals(i32 %4, double %2)
ret void
}
/* Variables and functions */
char *calc_sums_c(char const *, int /*<<< orphan*/, int /*<<< orphan*/,
                  unsigned int);
int /*<<< orphan*/ strlen(char const *);
char *calc_sum(const char *msg, unsigned hash_id) {
  return calc_sums_c(msg, strlen(msg), strlen(msg), hash_id);
}


x86 assembly (clang, -O0):
<calc_sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    %eax,%edx
mov    -0xc(%rbp),%ecx
call   1040 <calc_sums_c@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_sum>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
mov    %r14d,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <calc_sums_c@plt>

LLVM IR (-O0):
define i8* @calc_sum(i8* %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 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* %8)
%10 = load i32, i32* %4
%11 = call i8* @calc_sums_c(i8* %5, i32 %7, i32 %9, i32 %10)
ret i8* %11
}

LLVM IR (-O2):
define i8* @calc_sum(i8* %0, i32 %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %0)
%5 = tail call i8* @calc_sums_c(i8* %0, i32 %3, i32 %4, i32 %1)
ret i8* %5
}
double inverse(double x) { return 1 / x; }


x86 assembly (clang, -O0):
<inverse>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
divsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<inverse>:
movsd  0xef8(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @inverse(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double 1.000000e+00, %3
ret double %4
}

LLVM IR (-O2):
define double @inverse(double %0) {
%2 = fdiv double 1.000000e+00, %0
ret double %2
}
/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
uint64_t __hsail_bitextract_u64(uint64_t src0, uint32_t src1, uint32_t src2) {
  uint32_t offset = src1 & (sizeof(uint64_t) * 8 - 1);
  uint32_t width = src2 & (sizeof(uint64_t) * 8 - 1);
  if (width == 0)
    return 0;
  else
    return (src0 << (sizeof(uint64_t) * 8 - width - offset)) >>
           (sizeof(uint64_t) * 8 - width);
}


x86 assembly (clang, -O0):
<__hsail_bitextract_u64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movslq -0xc(%rbp),%rax
and    $0x1f,%rax
mov    %eax,-0x14(%rbp)
movslq -0x10(%rbp),%rax
and    $0x1f,%rax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1139 <__hsail_bitextract_u64+0x39>
movl   $0x0,-0x4(%rbp)
jmp    1162 <__hsail_bitextract_u64+0x62>
mov    -0x8(%rbp),%eax
movslq -0x18(%rbp),%rdx
mov    $0x20,%ecx
sub    %rdx,%rcx
movslq -0x14(%rbp),%rdx
sub    %rdx,%rcx
shl    %cl,%eax
movslq -0x18(%rbp),%rdx
mov    $0x20,%ecx
sub    %rdx,%rcx
sar    %cl,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__hsail_bitextract_u64>:
and    $0x1f,%edx
je     111c <__hsail_bitextract_u64+0x1c>
mov    %edi,%eax
and    $0x1f,%esi
mov    $0x20,%ecx
sub    %edx,%ecx
sub    %esi,%ecx
shl    %cl,%eax
neg    %edx
mov    %edx,%ecx
sar    %cl,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @__hsail_bitextract_u64(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %2, 31
%5 = icmp eq i32 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %3
%7 = and i32 %1, 31
%8 = sub nuw nsw i32 32, %4
%9 = sub nsw i32 %8, %7
%10 = shl i32 %0, %9
%11 = ashr i32 %10, %8
br label %12
12: ; preds = %3, %6
%13 = phi i32 [ %11, %6 ], [ 0, %3 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int x = 1, *y;
  y = (int *)-1;
  printf("%d\n", x);
  printf("%d\n", *y);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    0xffffffffffffffff,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = load i32, i32* inttoptr (i64 -1 to i32*)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 1
}
/* Variables and functions */
int check_arg_count(int, int);
int /*<<< orphan*/ printw(char *, char *);
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_return(int /*<<< orphan*/);
void cmd_printw(int nargs, char **args) {
  if (check_arg_count(nargs, 2) == 1)
    return;
  report_count(1);
  report_return(printw(args[0], args[1]));
}


x86 assembly (clang, -O0):
<cmd_printw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1050 <check_arg_count@plt>
cmp    $0x1,%eax
jne    116a <cmd_printw+0x2a>
jmp    118f <cmd_printw+0x4f>
mov    $0x1,%edi
call   1060 <report_count@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1040 <printw@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_printw>:
push   %rbx
mov    %rsi,%rbx
mov    $0x2,%esi
call   1050 <check_arg_count@plt>
cmp    $0x1,%eax
jne    1155 <cmd_printw+0x15>
pop    %rbx
ret
mov    $0x1,%edi
call   1060 <report_count@plt>
mov    (%rbx),%rdi
mov    0x8(%rbx),%rsi
call   1040 <printw@plt>
mov    %eax,%edi
pop    %rbx
jmp    1030 <report_return@plt>

LLVM IR (-O0):
define void @cmd_printw(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = call i32 @check_arg_count(i32 %5, i32 2)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %19
9: ; preds = %2
%10 = call i32 @report_count(i32 1)
%11 = load i8**, i8*** %4
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = load i8**, i8*** %4
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @printw(i8* %13, i8* %16)
%18 = call i32 @report_return(i32 %17)
br label %19
19: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
define void @cmd_printw(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @check_arg_count(i32 %0, i32 2)
%4 = icmp eq i32 %3, 1
br i1 %4, label %12, label %5
5: ; preds = %2
%6 = tail call i32 @report_count(i32 1)
%7 = load i8*, i8** %1
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @printw(i8* %7, i8* %9)
%11 = tail call i32 @report_return(i32 %10)
br label %12
12: ; preds = %2, %5
ret void
}
/* Type definitions */
struct usb_spca50x {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cx11646_fw(struct usb_spca50x *);
int /*<<< orphan*/ cx11646_init1(struct usb_spca50x *);
int cx11646_initsize(struct usb_spca50x *);
int /*<<< orphan*/ cx11646_jpegInit(struct usb_spca50x *);
int /*<<< orphan*/ cx_sensor(struct usb_spca50x *);
int cx11646_init(struct usb_spca50x *spca50x) {
  int err;
  cx11646_init1(spca50x);
  err = cx11646_initsize(spca50x);
  cx11646_fw(spca50x);
  cx_sensor(spca50x);
  cx11646_jpegInit(spca50x);
  return 0;
}


x86 assembly (clang, -O0):
<cx11646_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <cx11646_init1@plt>
mov    -0x8(%rbp),%rdi
call   1070 <cx11646_initsize@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <cx11646_fw@plt>
mov    -0x8(%rbp),%rdi
call   1030 <cx_sensor@plt>
mov    -0x8(%rbp),%rdi
call   1040 <cx11646_jpegInit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cx11646_init>:
push   %rbx
mov    %rdi,%rbx
call   1050 <cx11646_init1@plt>
mov    %rbx,%rdi
call   1070 <cx11646_initsize@plt>
mov    %rbx,%rdi
call   1060 <cx11646_fw@plt>
mov    %rbx,%rdi
call   1030 <cx_sensor@plt>
mov    %rbx,%rdi
call   1040 <cx11646_jpegInit@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.usb_spca50x = type { i32 }
define i32 @cx11646_init(%struct.usb_spca50x* %0) {
%2 = alloca %struct.usb_spca50x*
%3 = alloca i32
store %struct.usb_spca50x* %0, %struct.usb_spca50x** %2
%4 = load %struct.usb_spca50x*, %struct.usb_spca50x** %2
%5 = call i32 @cx11646_init1(%struct.usb_spca50x* %4)
%6 = load %struct.usb_spca50x*, %struct.usb_spca50x** %2
%7 = call i32 @cx11646_initsize(%struct.usb_spca50x* %6)
store i32 %7, i32* %3
%8 = load %struct.usb_spca50x*, %struct.usb_spca50x** %2
%9 = call i32 @cx11646_fw(%struct.usb_spca50x* %8)
%10 = load %struct.usb_spca50x*, %struct.usb_spca50x** %2
%11 = call i32 @cx_sensor(%struct.usb_spca50x* %10)
%12 = load %struct.usb_spca50x*, %struct.usb_spca50x** %2
%13 = call i32 @cx11646_jpegInit(%struct.usb_spca50x* %12)
ret i32 0
}

LLVM IR (-O2):
%struct.usb_spca50x = type { i32 }
define i32 @cx11646_init(%struct.usb_spca50x* %0) {
%2 = tail call i32 @cx11646_init1(%struct.usb_spca50x* %0)
%3 = tail call i32 @cx11646_initsize(%struct.usb_spca50x* %0)
%4 = tail call i32 @cx11646_fw(%struct.usb_spca50x* %0)
%5 = tail call i32 @cx_sensor(%struct.usb_spca50x* %0)
%6 = tail call i32 @cx11646_jpegInit(%struct.usb_spca50x* %0)
ret i32 0
}
void gtk_icon_source_get_pixbuf() {}


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

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

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

LLVM IR (-O2):
define void @gtk_icon_source_get_pixbuf() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void __attribute__((constructor)) initLibrary(void) {
  printf("Library is initialized\n");
}


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

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

LLVM IR (-O0):
@.str = [24 x i8] c"Library is initialized\0A\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @initLibrary, i8* null }]
define void @initLibrary() {
%1 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @initLibrary, i8* null }]
@str = [23 x i8] c"Library is initialized\00"
define void @initLibrary() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
ret void
}
int str_isupper(const char *s) {
  while (*s)
    if (*s < 'A' || *s > 'Z')
      return 0;
    else
      s++;
  return 1;
}


x86 assembly (clang, -O0):
<str_isupper>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1152 <str_isupper+0x52>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     1135 <str_isupper+0x35>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jle    1141 <str_isupper+0x41>
movl   $0x0,-0x4(%rbp)
jmp    1159 <str_isupper+0x59>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1108 <str_isupper+0x8>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_isupper>:
mov    (%rdi),%cl
mov    $0x1,%eax
test   %cl,%cl
je     1123 <str_isupper+0x23>
add    $0x1,%rdi
nop
add    $0xa5,%cl
cmp    $0xe5,%cl
jbe    1124 <str_isupper+0x24>
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <str_isupper+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @str_isupper(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %7
4: ; preds = %7
%5 = load i8, i8* %12
%6 = icmp eq i8 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %12, %4 ], [ %0, %1 ]
%10 = add i8 %8, -91
%11 = icmp ult i8 %10, -26
%12 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %11, label %13, label %4
13: ; preds = %7, %4, %1
%14 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %14
}
/* Type definitions */
typedef scalar_t__ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int compare_uint16_t(const uint16_t *lhs, const uint16_t *rhs) {
  assert(lhs != NULL && rhs != NULL);
  return (((*lhs) > (*rhs)) - ((*lhs) < (*rhs)));
}


x86 assembly (clang, -O0):
<compare_uint16_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     113b <compare_uint16_t+0x2b>
cmpq   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
mov    -0x10(%rbp),%rdx
cmp    (%rdx),%rcx
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_uint16_t>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setne  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
mov    (%rbx),%rcx
xor    %eax,%eax
xor    %edx,%edx
cmp    (%r14),%rcx
setg   %al
setl   %dl
sub    %edx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @compare_uint16_t(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
store i64* %0, i64** %3
store i64* %1, i64** %4
%5 = load i64*, i64** %3
%6 = icmp ne i64* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i64*, i64** %4
%9 = icmp ne i64* %8, null
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ false, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i64*, i64** %3
%15 = load i64, i64* %14
%16 = load i64*, i64** %4
%17 = load i64, i64* %16
%18 = icmp sgt i64 %15, %17
%19 = zext i1 %18 to i32
%20 = load i64*, i64** %3
%21 = load i64, i64* %20
%22 = load i64*, i64** %4
%23 = load i64, i64* %22
%24 = icmp slt i64 %21, %23
%25 = zext i1 %24 to i32
%26 = sub nsw i32 %19, %25
ret i32 %26
}

LLVM IR (-O2):
define i32 @compare_uint16_t(i64* %0, i64* %1) {
%3 = icmp ne i64* %0, null
%4 = icmp ne i64* %1, null
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = load i64, i64* %0
%9 = load i64, i64* %1
%10 = icmp sgt i64 %8, %9
%11 = zext i1 %10 to i32
%12 = icmp slt i64 %8, %9
%13 = sext i1 %12 to i32
%14 = add nsw i32 %13, %11
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int main(void) {
  float x;
  int y = 5, z = 2;
  x = (float)y / z;
  printf("value of x: %f", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0xc(%rbp)
movl   $0x2,-0x10(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [15 x i8] c"value of x: %f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %3
store i32 2, i32* %4
%5 = load i32, i32* %3
%6 = sitofp i32 %5 to float
%7 = load i32, i32* %4
%8 = sitofp i32 %7 to float
%9 = fdiv float %6, %8
store float %9, float* %2
%10 = load float, float* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), float %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"value of x: %f\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), float 2.500000e+00)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
void ram_console_init(void) { print("ram_console disabled\n"); }


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

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

LLVM IR (-O0):
@.str = [22 x i8] c"ram_console disabled\0A\00"
define void @ram_console_init() {
%1 = call i32 @print(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"ram_console disabled\0A\00"
define void @ram_console_init() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret void
}