xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ countMirror(int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int number = 0;
  printf("Type a number:\n");
  scanf("%d", &number);
  countMirror(number, 10);
  printf("\n");
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xeb3(%rip),%rdi
call   1040 <puts@plt>
lea    0xea4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
mov    $0xa,%esi
call   1050 <countMirror@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [15 x i8] c"Type a number:\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 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 @countMirror(i32 %5, i32 10)
%7 = call i32 @putchar(i32 10)
ret i32 0
}
unsigned int mt_hash(char *orig) {
  unsigned int h;
  unsigned char *p;
  h = 0;
  for (p = (unsigned char *)orig; *p != '\0'; ++p) {
    h = 37 * h + *p;
  }
  return (h % 32771);
}


x86 assembly (clang, -O0):
<mt_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x0,%eax
je     1148 <mt_hash+0x48>
imul   $0x25,-0xc(%rbp),%eax
mov    -0x18(%rbp),%rcx
movzbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <mt_hash+0x17>
mov    -0xc(%rbp),%eax
mov    $0x8003,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mt_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     113c <mt_hash+0x3c>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movzbl %cl,%ecx
lea    (%rax,%rax,8),%edx
lea    (%rax,%rdx,4),%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <mt_hash+0x10>
mov    %eax,%ecx
imul   $0x3ffe8009,%rcx,%rcx
shr    $0x2d,%rcx
imul   $0x8003,%ecx,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @mt_hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %3
%5 = load i8*, i8** %2
store i8* %5, i8** %4
br label %6
6: ; preds = %18, %1
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %6
%12 = load i32, i32* %3
%13 = mul i32 37, %12
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = add i32 %13, %16
store i32 %17, i32* %3
br label %18
18: ; preds = %11
%19 = load i8*, i8** %4
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %4
br label %6
21: ; preds = %6
%22 = load i32, i32* %3
%23 = urem i32 %22, 32771
ret i32 %23
}

LLVM IR (-O2):
define i32 @mt_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %11, %4 ], [ %0, %1 ]
%7 = phi i32 [ %10, %4 ], [ 0, %1 ]
%8 = zext i8 %5 to i32
%9 = mul i32 %7, 37
%10 = add i32 %9, %8
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = urem i32 %10, 32771
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
/* Variables and functions */
int fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int getchar(void) { return fgetc(stdin); }


x86 assembly (clang, -O0):
<getchar>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<getchar>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fgetc@plt>

LLVM IR (-O0):
@stdin = global i32 0
define i32 @getchar() {
%1 = load i32, i32* @stdin
%2 = call i32 @fgetc(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @getchar() {
%1 = load i32, i32* @stdin
%2 = tail call i32 @fgetc(i32 %1)
ret i32 %2
}
/* Variables and functions */
void printsep(char *str, size_t *len, size_t size) {
  do {
    if (*len + 1 < size)
      str[*len] = ',';
    (*len)++;
  } while (0);
}


x86 assembly (clang, -O0):
<printsep>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
add    $0x1,%rax
cmp    -0x18(%rbp),%rax
jae    1134 <printsep+0x34>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rcx
movb   $0x2c,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<printsep>:
mov    (%rsi),%rcx
lea    0x1(%rcx),%rax
cmp    %rdx,%rax
jae    1117 <printsep+0x17>
movb   $0x2c,(%rdi,%rcx,1)
mov    (%rsi),%rax
add    $0x1,%rax
mov    %rax,(%rsi)
ret

LLVM IR (-O0):
define void @printsep(i8* %0, i64* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64*
%6 = alloca i64
store i8* %0, i8** %4
store i64* %1, i64** %5
store i64 %2, i64* %6
br label %7
7: ; preds = %3
%8 = load i64*, i64** %5
%9 = load i64, i64* %8
%10 = add i64 %9, 1
%11 = load i64, i64* %6
%12 = icmp ult i64 %10, %11
br i1 %12, label %13, label %18
13: ; preds = %7
%14 = load i8*, i8** %4
%15 = load i64*, i64** %5
%16 = load i64, i64* %15
%17 = getelementptr inbounds i8, i8* %14, i64 %16
store i8 44, i8* %17
br label %18
18: ; preds = %13, %7
%19 = load i64*, i64** %5
%20 = load i64, i64* %19
%21 = add i64 %20, 1
store i64 %21, i64* %19
br label %22
22: ; preds = %18
ret void
}

LLVM IR (-O2):
define void @printsep(i8* nocapture writeonly %0, i64* nocapture %1, i64 %2) {
%4 = load i64, i64* %1
%5 = add i64 %4, 1
%6 = icmp ult i64 %5, %2
br i1 %6, label %7, label %11
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %0, i64 %4
store i8 44, i8* %8
%9 = load i64, i64* %1
%10 = add i64 %9, 1
br label %11
11: ; preds = %7, %3
%12 = phi i64 [ %10, %7 ], [ %5, %3 ]
store i64 %12, i64* %1
ret void
}
int getDigit(int X, int D) {
  int d, i;
  for (i = 1; i < D; i++) {
    X = X / 10;
  }
  d = X % 10;
  return d;
}


x86 assembly (clang, -O0):
<getDigit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1139 <getDigit+0x39>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1111 <getDigit+0x11>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getDigit>:
cmp    $0x2,%esi
jl     115c <getDigit+0x5c>
lea    -0x1(%rsi),%ecx
add    $0xfffffffe,%esi
mov    %ecx,%eax
and    $0x3,%eax
cmp    $0x3,%esi
jb     113c <getDigit+0x3c>
and    $0xfffffffc,%ecx
nopl   0x0(%rax,%rax,1)
movslq %edi,%rdx
imul   $0x68db8bad,%rdx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x2c,%rdi
add    %edx,%edi
add    $0xfffffffc,%ecx
jne    1120 <getDigit+0x20>
test   %eax,%eax
je     115c <getDigit+0x5c>
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rdi
add    %ecx,%edi
add    $0xffffffff,%eax
jne    1140 <getDigit+0x40>
movslq %edi,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @getDigit(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %27
4: ; preds = %2
%5 = add i32 %1, -1
%6 = add i32 %1, -2
%7 = and i32 %5, 3
%8 = icmp ult i32 %6, 3
br i1 %8, label %17, label %9
9: ; preds = %4
%10 = and i32 %5, -4
br label %11
11: ; preds = %11, %9
%12 = phi i32 [ %0, %9 ], [ %14, %11 ]
%13 = phi i32 [ 0, %9 ], [ %15, %11 ]
%14 = sdiv i32 %12, 10000
%15 = add i32 %13, 4
%16 = icmp eq i32 %15, %10
br i1 %16, label %17, label %11
17: ; preds = %11, %4
%18 = phi i32 [ undef, %4 ], [ %14, %11 ]
%19 = phi i32 [ %0, %4 ], [ %14, %11 ]
%20 = icmp eq i32 %7, 0
br i1 %20, label %27, label %21
21: ; preds = %17, %21
%22 = phi i32 [ %24, %21 ], [ %19, %17 ]
%23 = phi i32 [ %25, %21 ], [ 0, %17 ]
%24 = sdiv i32 %22, 10
%25 = add i32 %23, 1
%26 = icmp eq i32 %25, %7
br i1 %26, label %27, label %21
27: ; preds = %17, %21, %2
%28 = phi i32 [ %0, %2 ], [ %18, %17 ], [ %24, %21 ]
%29 = srem i32 %28, 10
ret i32 %29
}
void gdk_init() {}


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

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

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

LLVM IR (-O2):
define void @gdk_init() {
ret void
}
double f7(double x) { return (x - 0.0) + 0.0; }


x86 assembly (clang, -O0):
<f7>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
subsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f7>:
xorpd  %xmm1,%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @f7(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fsub double %3, 0.000000e+00
%5 = fadd double %4, 0.000000e+00
ret double %5
}

LLVM IR (-O2):
define double @f7(double %0) {
%2 = fadd double %0, 0.000000e+00
ret double %2
}
/* Variables and functions */
int _dowrite(unsigned int, unsigned char, unsigned char, unsigned char *, int);
int do_smbus_write_byte(unsigned smbus_io_base, unsigned char device,
                        unsigned char address, unsigned char data) {
  return _dowrite(smbus_io_base, device, address, (unsigned char *)&data, 1);
}


x86 assembly (clang, -O0):
<do_smbus_write_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %edi,-0x4(%rbp)
mov    %dl,-0x5(%rbp)
mov    %cl,-0x6(%rbp)
mov    %al,-0x7(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x5(%rbp),%al
lea    -0x7(%rbp),%rcx
mov    $0x1,%r8d
movzbl %al,%esi
movzbl -0x6(%rbp),%edx
call   1030 <_dowrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_smbus_write_byte>:
push   %rax
mov    %cl,0x7(%rsp)
lea    0x7(%rsp),%rcx
mov    $0x1,%r8d
call   1030 <_dowrite@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @do_smbus_write_byte(i32 %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i32 %0, i32* %5
store i8 %1, i8* %6
store i8 %2, i8* %7
store i8 %3, i8* %8
%9 = load i32, i32* %5
%10 = load i8, i8* %6
%11 = load i8, i8* %7
%12 = call i32 @_dowrite(i32 %9, i8 zeroext %10, i8 zeroext %11, i8* %8, i32 1)
ret i32 %12
}

LLVM IR (-O2):
define i32 @do_smbus_write_byte(i32 %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3) {
%5 = alloca i8
store i8 %3, i8* %5
%6 = call i32 @_dowrite(i32 %0, i8 zeroext %1, i8 zeroext %2, i8* %5, i32 1)
ret i32 %6
}
void av_fifo_realloc2() {}


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

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

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

LLVM IR (-O2):
define void @av_fifo_realloc2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Msp430GpioC__9__GeneralIO__clr();
void CC2420ControlP__VREN__clr(void) { Msp430GpioC__9__GeneralIO__clr(); }


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

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

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

LLVM IR (-O2):
define void @CC2420ControlP__VREN__clr() {
%1 = tail call i32 (...) @Msp430GpioC__9__GeneralIO__clr()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_stackint_basic();
int /*<<< orphan*/ test_stackint_large();
int /*<<< orphan*/ tests_show_summary();
int main(void) {
  test_stackint_basic();
  test_stackint_large();
  tests_show_summary();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <test_stackint_basic@plt>
mov    $0x0,%al
call   1050 <test_stackint_large@plt>
mov    $0x0,%al
call   1040 <tests_show_summary@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_stackint_basic()
%3 = call i32 (...) @test_stackint_large()
%4 = call i32 (...) @tests_show_summary()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_stackint_basic()
%2 = tail call i32 (...) @test_stackint_large()
%3 = tail call i32 (...) @tests_show_summary()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_cond_t;

/* Variables and functions */
int /*<<< orphan*/ gptp(char *, int);
void g_pthread_cond_t() { gptp("pthread_cond_t", sizeof(pthread_cond_t)); }


x86 assembly (clang, -O0):
<g_pthread_cond_t>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x4,%esi
call   1030 <gptp@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_pthread_cond_t>:
lea    0xee9(%rip),%rdi
mov    $0x4,%esi
jmp    1030 <gptp@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"pthread_cond_t\00"
define void @g_pthread_cond_t() {
%1 = call i32 @gptp(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"pthread_cond_t\00"
define void @g_pthread_cond_t() {
%1 = tail call i32 @gptp(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}
/* Variables and functions */
unsigned long getValue(char const);
unsigned long calculate(const char *numb, unsigned char base) {
  unsigned long result;
  for (result = 0; '\0' != *numb; numb++)
    result = result * base + getValue(*numb);
  return result;
}


x86 assembly (clang, -O0):
<calculate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
je     1176 <calculate+0x66>
mov    -0x18(%rbp),%rax
movzbl -0x9(%rbp),%ecx
imul   %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <getValue@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    112a <calculate+0x1a>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate>:
push   %r15
push   %r14
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     114d <calculate+0x3d>
mov    %rdi,%r14
movzbl %sil,%r15d
add    $0x1,%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
imul   %r15,%rbx
movsbl %al,%edi
call   1030 <getValue@plt>
add    %rax,%rbx
movzbl (%r14),%eax
add    $0x1,%r14
test   %al,%al
jne    1130 <calculate+0x20>
jmp    114f <calculate+0x3f>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @calculate(i8* nocapture %0, i8 zeroext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2
%6 = zext i8 %1 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i8 [ %3, %5 ], [ %15, %7 ]
%9 = phi i64 [ 0, %5 ], [ %13, %7 ]
%10 = phi i8* [ %0, %5 ], [ %14, %7 ]
%11 = mul i64 %9, %6
%12 = tail call i64 @getValue(i8 signext %8)
%13 = add i64 %12, %11
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %7
17: ; preds = %7, %2
%18 = phi i64 [ 0, %2 ], [ %13, %7 ]
ret i64 %18
}
void RTThreadWait(void) {}


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

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

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

LLVM IR (-O2):
define void @RTThreadWait() {
ret void
}
int pathconN_nm4_work(int *sz_arg, int *sz_res, int *sz_iw, int *sz_w) {
  if (sz_arg)
    *sz_arg = 1;
  if (sz_res)
    *sz_res = 2;
  if (sz_iw)
    *sz_iw = 0;
  if (sz_w)
    *sz_w = 0;
  return 0;
}


x86 assembly (clang, -O0):
<pathconN_nm4_work>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1129 <pathconN_nm4_work+0x29>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
cmpq   $0x0,-0x10(%rbp)
je     113e <pathconN_nm4_work+0x3e>
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     1153 <pathconN_nm4_work+0x53>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
cmpq   $0x0,-0x20(%rbp)
je     1168 <pathconN_nm4_work+0x68>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pathconN_nm4_work>:
test   %rdi,%rdi
je     110b <pathconN_nm4_work+0xb>
movl   $0x1,(%rdi)
test   %rsi,%rsi
je     1116 <pathconN_nm4_work+0x16>
movl   $0x2,(%rsi)
test   %rdx,%rdx
je     1121 <pathconN_nm4_work+0x21>
movl   $0x0,(%rdx)
test   %rcx,%rcx
je     112c <pathconN_nm4_work+0x2c>
movl   $0x0,(%rcx)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @pathconN_nm4_work(i32* writeonly %0, i32* writeonly %1, i32* writeonly %2, i32* writeonly %3) {
%5 = icmp eq i32* %0, null
br i1 %5, label %7, label %6
6: ; preds = %4
store i32 1, i32* %0
br label %7
7: ; preds = %6, %4
%8 = icmp eq i32* %1, null
br i1 %8, label %10, label %9
9: ; preds = %7
store i32 2, i32* %1
br label %10
10: ; preds = %9, %7
%11 = icmp eq i32* %2, null
br i1 %11, label %13, label %12
12: ; preds = %10
store i32 0, i32* %2
br label %13
13: ; preds = %12, %10
%14 = icmp eq i32* %3, null
br i1 %14, label %16, label %15
15: ; preds = %13
store i32 0, i32* %3
br label %16
16: ; preds = %15, %13
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void welcome() {
  printf("BasicMail %s, a simple message exchange suite.\n", "1.0");
  printf("Run with \'help\' action for usage, license and warranty terms.\n");
}


x86 assembly (clang, -O0):
<welcome>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xf0e(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<welcome>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xf01(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef7(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"BasicMail %s, a simple message exchange suite.\0A\00"
@.str.1 = [4 x i8] c"1.0\00"
@.str.2 = [63 x i8] c"Run with 'help' action for usage, license and warranty terms.\0A\00"
define void @welcome() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"BasicMail %s, a simple message exchange suite.\0A\00"
@.str.1 = [4 x i8] c"1.0\00"
@str = [62 x i8] c"Run with 'help' action for usage, license and warranty terms.\00"
define void @welcome() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ FLEXIO3_DriverIRQHandler();
__attribute__((weak)) void FLEXIO3_IRQHandler(void) {
  FLEXIO3_DriverIRQHandler();
}


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

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

LLVM IR (-O0):
define weak void @FLEXIO3_IRQHandler() {
%1 = call i32 (...) @FLEXIO3_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @FLEXIO3_IRQHandler() {
%1 = tail call i32 (...) @FLEXIO3_DriverIRQHandler()
ret void
}
/* Variables and functions */
int close(int);
int errno;
int socket_close(int fd) {
  int err = close(fd);
  if (err == -1)
    return errno;
  return 0;
}


x86 assembly (clang, -O0):
<socket_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <close@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1141 <socket_close+0x31>
mov    0x2ea9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1148 <socket_close+0x38>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_close>:
push   %rax
call   1030 <close@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
jne    1128 <socket_close+0x18>
mov    0x2eba(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @socket_close(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @close(i32 %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* @errno
store i32 %10, i32* %2
br label %12
11: ; preds = %1
store i32 0, i32* %2
br label %12
12: ; preds = %11, %9
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @socket_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
%3 = icmp eq i32 %2, -1
%4 = load i32, i32* @errno
%5 = select i1 %3, i32 %4, i32 0
ret i32 %5
}
int view_menu_key_down(int k) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @view_menu_key_down(i32 %0) {
ret i32 0
}
/* Variables and functions */
scalar_t__ foo(int);
int main() {
  int r = 0;
#pragma acc parallel copy(r) vector_length(32)
  {
#pragma acc loop vector reduction(+ : r)
    for (int i = 00; i < 40; i++)
      r += i;
    if (foo(r))
      r *= 2;
    if (r & 1)
#pragma acc loop vector reduction(+ : r)
      for (int i = 00; i < 40; i++)
        r += i;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x28,-0xc(%rbp)
jge    114e <main+0x3e>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
mov    -0x8(%rbp),%edi
call   1030 <foo@plt>
cmp    $0x0,%rax
je     1169 <main+0x59>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11a5 <main+0x95>
movl   $0x0,-0x10(%rbp)
cmpl   $0x28,-0x10(%rbp)
jge    11a0 <main+0x90>
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117f <main+0x6f>
jmp    11a5 <main+0x95>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x30c,%edi
call   1030 <foo@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @foo(i32 780)
ret i32 0
}
/* Variables and functions */
long random_unlocked();
long random(void) {
  long r;
  ;
  r = random_unlocked();
  ;
  return (r);
}


x86 assembly (clang, -O0):
<random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <random_unlocked@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @random() {
%1 = alloca i64
%2 = call i64 (...) @random_unlocked()
store i64 %2, i64* %1
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @random() {
%1 = tail call i64 (...) @random_unlocked()
ret i64 %1
}
/* Variables and functions */
int /*<<< orphan*/ __VERIFIER_assert(int);
unsigned int __VERIFIER_nondet_uint();
int main(void) {
  unsigned int x = __VERIFIER_nondet_uint();
  unsigned int y = x;
  while (x < 1024) {
    x++;
    y++;
  }
  __VERIFIER_assert(x == y);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_uint@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x400,-0x8(%rbp)
jae    1163 <main+0x43>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113f <main+0x1f>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <__VERIFIER_assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_uint@plt>
mov    $0x1,%edi
call   1030 <__VERIFIER_assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @__VERIFIER_nondet_uint()
store i32 %4, i32* %2
%5 = load i32, i32* %2
store i32 %5, i32* %3
br label %6
6: ; preds = %9, %0
%7 = load i32, i32* %2
%8 = icmp ult i32 %7, 1024
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = load i32, i32* %2
%11 = add i32 %10, 1
store i32 %11, i32* %2
%12 = load i32, i32* %3
%13 = add i32 %12, 1
store i32 %13, i32* %3
br label %6
14: ; preds = %6
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = icmp eq i32 %15, %16
%18 = zext i1 %17 to i32
%19 = call i32 @__VERIFIER_assert(i32 %18)
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_uint()
%2 = tail call i32 @__VERIFIER_assert(i32 1)
ret i32 0
}
int get_base_from_xlen(int xlen) {
  if (xlen == 32)
    return 1;
  else if (xlen == 64)
    return 2;
  else
    return 3;
}


x86 assembly (clang, -O0):
<get_base_from_xlen>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jne    111d <get_base_from_xlen+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    113a <get_base_from_xlen+0x3a>
cmpl   $0x40,-0x8(%rbp)
jne    1133 <get_base_from_xlen+0x33>
movl   $0x2,-0x4(%rbp)
jmp    113a <get_base_from_xlen+0x3a>
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_base_from_xlen>:
xor    %ecx,%ecx
cmp    $0x40,%edi
sete   %cl
xor    $0x3,%ecx
cmp    $0x20,%edi
mov    $0x1,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @get_base_from_xlen(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 32
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %12
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 64
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 2, i32* %2
br label %12
11: ; preds = %7
store i32 3, i32* %2
br label %12
12: ; preds = %11, %10, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @get_base_from_xlen(i32 %0) {
%2 = icmp eq i32 %0, 64
%3 = select i1 %2, i32 2, i32 3
%4 = icmp eq i32 %0, 32
%5 = select i1 %4, i32 1, i32 %3
ret i32 %5
}
void testBinaryLHSProblem(int *p) {
  if (p)
    return;
  int x = *p ?: 1;
  (void)x;
}


x86 assembly (clang, -O0):
<testBinaryLHSProblem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1118 <testBinaryLHSProblem+0x18>
jmp    1148 <testBinaryLHSProblem+0x48>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     1135 <testBinaryLHSProblem+0x35>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1142 <testBinaryLHSProblem+0x42>
mov    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1142 <testBinaryLHSProblem+0x42>
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @testBinaryLHSProblem(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = icmp ne i32* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
br label %16
7: ; preds = %1
%8 = load i32*, i32** %2
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
br label %13
12: ; preds = %7
br label %13
13: ; preds = %12, %11
%14 = phi i32 [ %9, %11 ], [ 1, %12 ]
store i32 %14, i32* %3
%15 = load i32, i32* %3
br label %16
16: ; preds = %13, %6
ret void
}

LLVM IR (-O2):
define void @testBinaryLHSProblem(i32* nocapture %0) {
ret void
}
int arg_array_ptr(int i, int *j[]) {
  (void)j;
  return i;
}


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

x86 assembly (clang, -O2):
<arg_array_ptr>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @arg_array_ptr(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 %6
}

LLVM IR (-O2):
define i32 @arg_array_ptr(i32 returned %0, i32** nocapture readnone %1) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int stub1(char const *, char const *);
void check(char *a, char *b, int (*cmp)(const char *, const char *)) {
  if (!(*cmp)(a, b))
    printf("Ok, this string are equals \n");
  else
    printf("Direrente string \n");
  printf("The test above show the job with pointer to functions \n");
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   *%rax
cmp    $0x0,%eax
jne    114c <check+0x3c>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
jmp    1158 <check+0x48>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rax
call   *%rdx
test   %eax,%eax
lea    0xee4(%rip),%rax
lea    0xf30(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
lea    0xee9(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Ok, this string are equals \0A\00"
@.str.1 = [19 x i8] c"Direrente string \0A\00"
@.str.2 = [56 x i8] c"The test above show the job with pointer to functions \0A\00"
define void @check(i8* %0, i8* %1, i32 (i8*, i8*)* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32 (i8*, i8*)*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 (i8*, i8*)* %2, i32 (i8*, i8*)** %6
%7 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = call i32 %7(i8* %8, i8* %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %3
%13 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %16
14: ; preds = %3
%15 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
%17 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [28 x i8] c"Ok, this string are equals \00"
@str.3 = [55 x i8] c"The test above show the job with pointer to functions \00"
@str.4 = [18 x i8] c"Direrente string \00"
define void @check(i8* %0, i8* %1, i32 (i8*, i8*)* nocapture %2) {
%4 = tail call i32 %2(i8* %0, i8* %1)
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @str.4, i64 0, i64 0)
%7 = tail call i32 @puts(i8* dereferenceable(1) %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.3, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EVP_R_UNSUPPORTED_KEY_SIZE;
int /*<<< orphan*/ EVPerror(int /*<<< orphan*/);
int rc2_magic_to_meth(int i) {
  if (i == 0x3a)
    return 128;
  else if (i == 0x78)
    return 64;
  else if (i == 0xa0)
    return 40;
  else {
    EVPerror(EVP_R_UNSUPPORTED_KEY_SIZE);
    return (0);
  }
}


x86 assembly (clang, -O0):
<rc2_magic_to_meth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x3a,-0x8(%rbp)
jne    1131 <rc2_magic_to_meth+0x21>
movl   $0x80,-0x4(%rbp)
jmp    1175 <rc2_magic_to_meth+0x65>
cmpl   $0x78,-0x8(%rbp)
jne    1147 <rc2_magic_to_meth+0x37>
movl   $0x40,-0x4(%rbp)
jmp    1175 <rc2_magic_to_meth+0x65>
cmpl   $0xa0,-0x8(%rbp)
jne    1160 <rc2_magic_to_meth+0x50>
movl   $0x28,-0x4(%rbp)
jmp    1175 <rc2_magic_to_meth+0x65>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
call   1030 <EVPerror@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rc2_magic_to_meth>:
cmp    $0x3a,%edi
je     1128 <rc2_magic_to_meth+0x18>
cmp    $0xa0,%edi
je     112e <rc2_magic_to_meth+0x1e>
cmp    $0x78,%edi
jne    1134 <rc2_magic_to_meth+0x24>
mov    $0x40,%eax
ret
mov    $0x80,%eax
ret
mov    $0x28,%eax
ret
push   %rax
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1030 <EVPerror@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@EVP_R_UNSUPPORTED_KEY_SIZE = global i32 0
define i32 @rc2_magic_to_meth(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 58
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 128, i32* %2
br label %18
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 120
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 64, i32* %2
br label %18
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 160
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 40, i32* %2
br label %18
15: ; preds = %11
%16 = load i32, i32* @EVP_R_UNSUPPORTED_KEY_SIZE
%17 = call i32 @EVPerror(i32 %16)
store i32 0, i32* %2
br label %18
18: ; preds = %15, %14, %10, %6
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@EVP_R_UNSUPPORTED_KEY_SIZE = global i32 0
define i32 @rc2_magic_to_meth(i32 %0) {
switch i32 %0, label %4 [
i32 58, label %7
i32 120, label %2
i32 160, label %3
]
2: ; preds = %1
br label %7
3: ; preds = %1
br label %7
4: ; preds = %1
%5 = load i32, i32* @EVP_R_UNSUPPORTED_KEY_SIZE
%6 = tail call i32 @EVPerror(i32 %5)
br label %7
7: ; preds = %1, %4, %3, %2
%8 = phi i32 [ 64, %2 ], [ 40, %3 ], [ 0, %4 ], [ 128, %1 ]
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ SIZE_MAX;
int wcsncasecmp(int /*<<< orphan*/ const *, int /*<<< orphan*/ const *,
                int /*<<< orphan*/);
int wcscasecmp(const wchar_t *a, const wchar_t *b) {
  return wcsncasecmp(a, b, SIZE_MAX);
}


x86 assembly (clang, -O0):
<wcscasecmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2ea9(%rip),%rax
mov    (%rax),%edx
call   1030 <wcsncasecmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcscasecmp>:
mov    0x2ec1(%rip),%rax
mov    (%rax),%edx
jmp    1030 <wcsncasecmp@plt>

LLVM IR (-O0):
@SIZE_MAX = global i32 0
define i32 @wcscasecmp(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 = load i32, i32* @SIZE_MAX
%8 = call i32 @wcsncasecmp(i32* %5, i32* %6, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
@SIZE_MAX = global i32 0
define i32 @wcscasecmp(i32* %0, i32* %1) {
%3 = load i32, i32* @SIZE_MAX
%4 = tail call i32 @wcsncasecmp(i32* %0, i32* %1, i32 %3)
ret i32 %4
}
/* Variables and functions */
unsigned char *lock_strip_alpha(unsigned char *, char *);
unsigned char *lock_strip(unsigned char *key, char *type) {
  return (lock_strip_alpha(key, type));
}


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

x86 assembly (clang, -O2):
<lock_strip>:
jmp    1030 <lock_strip_alpha@plt>

LLVM IR (-O0):
define i8* @lock_strip(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i8* @lock_strip_alpha(i8* %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @lock_strip(i8* %0, i8* %1) {
%3 = tail call i8* @lock_strip_alpha(i8* %0, i8* %1)
ret i8* %3
}
int digit(int n, int k) {
  int i;
  for (i = 1; i < k; i++)
    n /= 10;
  return n % 10;
}


x86 assembly (clang, -O0):
<digit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1139 <digit+0x39>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1111 <digit+0x11>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<digit>:
cmp    $0x2,%esi
jl     115c <digit+0x5c>
lea    -0x1(%rsi),%ecx
add    $0xfffffffe,%esi
mov    %ecx,%eax
and    $0x3,%eax
cmp    $0x3,%esi
jb     113c <digit+0x3c>
and    $0xfffffffc,%ecx
nopl   0x0(%rax,%rax,1)
movslq %edi,%rdx
imul   $0x68db8bad,%rdx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x2c,%rdi
add    %edx,%edi
add    $0xfffffffc,%ecx
jne    1120 <digit+0x20>
test   %eax,%eax
je     115c <digit+0x5c>
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rdi
add    %ecx,%edi
add    $0xffffffff,%eax
jne    1140 <digit+0x40>
movslq %edi,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @digit(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %27
4: ; preds = %2
%5 = add i32 %1, -1
%6 = add i32 %1, -2
%7 = and i32 %5, 3
%8 = icmp ult i32 %6, 3
br i1 %8, label %17, label %9
9: ; preds = %4
%10 = and i32 %5, -4
br label %11
11: ; preds = %11, %9
%12 = phi i32 [ %0, %9 ], [ %14, %11 ]
%13 = phi i32 [ 0, %9 ], [ %15, %11 ]
%14 = sdiv i32 %12, 10000
%15 = add i32 %13, 4
%16 = icmp eq i32 %15, %10
br i1 %16, label %17, label %11
17: ; preds = %11, %4
%18 = phi i32 [ undef, %4 ], [ %14, %11 ]
%19 = phi i32 [ %0, %4 ], [ %14, %11 ]
%20 = icmp eq i32 %7, 0
br i1 %20, label %27, label %21
21: ; preds = %17, %21
%22 = phi i32 [ %24, %21 ], [ %19, %17 ]
%23 = phi i32 [ %25, %21 ], [ 0, %17 ]
%24 = sdiv i32 %22, 10
%25 = add i32 %23, 1
%26 = icmp eq i32 %25, %7
br i1 %26, label %27, label %21
27: ; preds = %17, %21, %2
%28 = phi i32 [ %0, %2 ], [ %18, %17 ], [ %24, %21 ]
%29 = srem i32 %28, 10
ret i32 %29
}
/* Variables and functions */
int /*<<< orphan*/ MonteCarloPI();
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main(int argc, const char *argv[]) {
  printf("PI is %lf\n", MonteCarloPI());
  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)
mov    $0x0,%al
call   1040 <MonteCarloPI@plt>
mov    %eax,%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <MonteCarloPI@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"PI is %lf\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 = call i32 (...) @MonteCarloPI()
%7 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"PI is %lf\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @MonteCarloPI()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void copy_subtree_addr(uint32_t out[8], const uint32_t in[8]) {
  out[0] = in[0];
  out[1] = in[1];
  out[2] = in[2];
  out[3] = in[3];
}


x86 assembly (clang, -O0):
<copy_subtree_addr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_subtree_addr>:
mov    (%rsi),%eax
mov    %eax,(%rdi)
mov    0x4(%rsi),%eax
mov    %eax,0x4(%rdi)
mov    0x8(%rsi),%eax
mov    %eax,0x8(%rdi)
mov    0xc(%rsi),%eax
mov    %eax,0xc(%rdi)
ret

LLVM IR (-O0):
define void @copy_subtree_addr(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 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32, i32* %6
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 0
store i32 %7, i32* %9
%10 = load i32*, i32** %4
%11 = getelementptr inbounds i32, i32* %10, i64 1
%12 = load i32, i32* %11
%13 = load i32*, i32** %3
%14 = getelementptr inbounds i32, i32* %13, i64 1
store i32 %12, i32* %14
%15 = load i32*, i32** %4
%16 = getelementptr inbounds i32, i32* %15, i64 2
%17 = load i32, i32* %16
%18 = load i32*, i32** %3
%19 = getelementptr inbounds i32, i32* %18, i64 2
store i32 %17, i32* %19
%20 = load i32*, i32** %4
%21 = getelementptr inbounds i32, i32* %20, i64 3
%22 = load i32, i32* %21
%23 = load i32*, i32** %3
%24 = getelementptr inbounds i32, i32* %23, i64 3
store i32 %22, i32* %24
ret void
}

LLVM IR (-O2):
define void @copy_subtree_addr(i32* nocapture writeonly %0, i32* nocapture %1) {
%3 = load i32, i32* %1
store i32 %3, i32* %0
%4 = getelementptr inbounds i32, i32* %1, i64 1
%5 = load i32, i32* %4
%6 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %5, i32* %6
%7 = getelementptr inbounds i32, i32* %1, i64 2
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %8, i32* %9
%10 = getelementptr inbounds i32, i32* %1, i64 3
%11 = load i32, i32* %10
%12 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %11, i32* %12
ret void
}