xunge/DecIR huggingface dataset:
int Count(long int n) {
  int count = 0;
  while (n != 0) {
    n /= 10;
    count++;
  }
  return count;
}


x86 assembly (clang, -O0):
<Count>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113a <Count+0x3a>
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <Count+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Count>:
xor    %ecx,%ecx
test   %rdi,%rdi
je     1144 <Count+0x44>
movabs $0x6666666666666667,%rsi
66 66 66
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rdi,%rax
imul   %rsi
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
add    $0x1,%ecx
add    $0x9,%rdi
cmp    $0x12,%rdi
mov    %rdx,%rdi
ja     1120 <Count+0x20>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @Count(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i64 [ %6, %3 ], [ %0, %1 ]
%6 = sdiv i64 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = add i64 %5, 9
%9 = icmp ult i64 %8, 19
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
extern int Min(int i1, int i2) { return i1 <= i2 ? i1 : i2; }


x86 assembly (clang, -O0):
<Min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1121 <Min+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <Min+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Min>:
mov    %edi,%eax
cmp    %esi,%edi
cmovg  %esi,%eax
ret

LLVM IR (-O0):
define i32 @Min(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 = icmp sle i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @Min(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
int test_imm_38uint8_mem(unsigned char *val) {
  return ((*val) & (0x38 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_38uint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%edx
and    $0x38,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_38uint8_mem>:
testb  $0x38,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_38uint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, 56
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_38uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 56
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int getsize(FILE *fp) {
  int size;
  fseek(fp, SEEK_SET, 0);
  fscanf(fp, "%d", &size);
  return size;
}


x86 assembly (clang, -O0):
<getsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <fseek@plt>
mov    -0x8(%rbp),%rdi
lea    0xeb5(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1030 <fscanf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getsize>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <fseek@plt>
lea    0xec1(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
call   1030 <fscanf@plt>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
@.str = [3 x i8] c"%d\00"
define i32 @getsize(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = load i32, i32* @SEEK_SET
%6 = call i32 @fseek(i32* %4, i32 %5, i32 0)
%7 = load i32*, i32** %2
%8 = call i32 @fscanf(i32* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
@.str = [3 x i8] c"%d\00"
define i32 @getsize(i32* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @SEEK_SET
%5 = tail call i32 @fseek(i32* %0, i32 %4, i32 0)
%6 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
ret i32 %7
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ puts(char *);
int main(void) {
  puts("Mingw installed succesfully!");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eae(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [29 x i8] c"Mingw installed succesfully!\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @puts(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}

LLVM IR (-O2):
@.str = [29 x i8] c"Mingw installed succesfully!\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ mpfr_t;
typedef int /*<<< orphan*/ mpfr_prec_t;

/* Variables and functions */
int /*<<< orphan*/ arr_alloc_2d(size_t const, size_t const,
                                int /*<<< orphan*/ ****);
int /*<<< orphan*/ arr_fill_2d(size_t const, size_t const,
                               int /*<<< orphan*/ **, int /*<<< orphan*/);
void createMatrix(const size_t m, const size_t n, mpfr_t (**a)[m][n],
                  mpfr_prec_t precision) {
  arr_alloc_2d(m, n, a);
  arr_fill_2d(m, n, **a, precision);
}


x86 assembly (clang, -O0):
<createMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <arr_alloc_2d@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
mov    -0x1c(%rbp),%ecx
call   1040 <arr_fill_2d@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createMatrix>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%rbp
call   1030 <arr_alloc_2d@plt>
mov    (%rbx),%rdx
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <arr_fill_2d@plt>

LLVM IR (-O0):
define void @createMatrix(i64 %0, i64 %1, i32** %2, i32 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32**
%8 = alloca i32
store i64 %0, i64* %5
store i64 %1, i64* %6
store i32** %2, i32*** %7
store i32 %3, i32* %8
%9 = load i64, i64* %5
%10 = load i64, i64* %6
%11 = load i64, i64* %5
%12 = load i64, i64* %6
%13 = load i32**, i32*** %7
%14 = bitcast i32** %13 to i32****
%15 = call i32 @arr_alloc_2d(i64 %11, i64 %12, i32**** %14)
%16 = load i64, i64* %5
%17 = load i64, i64* %6
%18 = load i32**, i32*** %7
%19 = load i32*, i32** %18
%20 = bitcast i32* %19 to i32**
%21 = load i32, i32* %8
%22 = call i32 @arr_fill_2d(i64 %16, i64 %17, i32** %20, i32 %21)
ret void
}

LLVM IR (-O2):
define void @createMatrix(i64 %0, i64 %1, i32** %2, i32 %3) {
%5 = bitcast i32** %2 to i32****
%6 = tail call i32 @arr_alloc_2d(i64 %0, i64 %1, i32**** %5)
%7 = bitcast i32** %2 to i32***
%8 = load i32**, i32*** %7
%9 = tail call i32 @arr_fill_2d(i64 %0, i64 %1, i32** %8, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Msp430GpioC__1__GeneralIO__toggle();
void LedsP__Led1__toggle(void) { Msp430GpioC__1__GeneralIO__toggle(); }


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

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

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

LLVM IR (-O2):
define void @LedsP__Led1__toggle() {
%1 = tail call i32 (...) @Msp430GpioC__1__GeneralIO__toggle()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void pthread_ex_ctx_destroy(void *data) {
  if (data != (void *)0)
    free(data);
  return;
}


x86 assembly (clang, -O0):
<pthread_ex_ctx_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <pthread_ex_ctx_destroy+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_ex_ctx_destroy>:
test   %rdi,%rdi
je     111a <pthread_ex_ctx_destroy+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @pthread_ex_ctx_destroy(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @pthread_ex_ctx_destroy(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void log_console_callback(int level, const char *msg) { printf("%s\n", msg); }


x86 assembly (clang, -O0):
<log_console_callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @log_console_callback(i32 %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ puts(char *);
void usage() {
  puts("usage: transcode -q <num>");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"usage: transcode -q <num>\00"
define void @usage() {
%1 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [26 x i8] c"usage: transcode -q <num>\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
double dsquare(double);
int isquare(int);
long lsquare(int);
int main(int argc, char *argv[]) {
  int i = isquare(5);
  double d = dsquare(5.5);
  long l = lsquare(5555555555);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x5,%edi
call   1050 <isquare@plt>
mov    %eax,-0x14(%rbp)
movsd  0xea5(%rip),%xmm0
call   1040 <dsquare@plt>
movsd  %xmm0,-0x20(%rbp)
mov    $0x4b230ce3,%edi
call   1030 <lsquare@plt>
mov    %rax,-0x28(%rbp)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
call   1050 <isquare@plt>
movsd  0xebd(%rip),%xmm0
call   1040 <dsquare@plt>
mov    $0x4b230ce3,%edi
call   1030 <lsquare@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca double
%8 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32 @isquare(i32 5)
store i32 %9, i32* %6
%10 = call double @dsquare(double 5.500000e+00)
store double %10, double* %7
%11 = call i64 @lsquare(i32 1260588259)
store i64 %11, i64* %8
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @isquare(i32 5)
%4 = tail call double @dsquare(double 5.500000e+00)
%5 = tail call i64 @lsquare(i32 1260588259)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num;
  scanf("%d", &num);
  int i;
  for (i = 2; i <= num; i += 2) {
    printf("%d^2 = %d\n", i, i * i);
  }
  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>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1176 <main+0x56>
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
imul   -0xc(%rbp),%edx
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    1146 <main+0x26>
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>
cmpl   $0x2,0x4(%rsp)
jl     1168 <main+0x48>
mov    $0x2,%ebx
lea    0xebb(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edx
imul   %ebx,%edx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x2,%ebx
cmp    0x4(%rsp),%ebx
jle    1150 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [11 x i8] c"%d^2 = %d\0A\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 slt i32 %4, 2
br i1 %5, label %13, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %10, %6 ], [ 2, %0 ]
%8 = mul nsw i32 %7, %7
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %8)
%10 = add nuw nsw i32 %7, 2
%11 = load i32, i32* %1
%12 = icmp sgt i32 %10, %11
br i1 %12, label %13, label %6
13: ; preds = %6, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int sum, n;
  scanf("%d, %d", &sum, &n);
  float v = sum / n;
  printf("v=%f\n", v);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cltd
idivl  (%rsp)
cvtsi2ss %eax,%xmm0
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d, %d\00"
@.str.1 = [6 x i8] c"v=%f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = sdiv i32 %6, %7
%9 = sitofp i32 %8 to float
%10 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cwrapper_q_sort_float(float *, int /*<<< orphan*/, int);
void quicksort_float_(float numbers[], int *array_size) {
  cwrapper_q_sort_float(numbers, 0, (*array_size) - 1);
}


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

x86 assembly (clang, -O2):
<quicksort_float_>:
mov    (%rsi),%edx
add    $0xffffffff,%edx
xor    %esi,%esi
jmp    1030 <cwrapper_q_sort_float@plt>

LLVM IR (-O0):
define void @quicksort_float_(float* %0, i32* %1) {
%3 = alloca float*
%4 = alloca i32*
store float* %0, float** %3
store i32* %1, i32** %4
%5 = load float*, float** %3
%6 = load i32*, i32** %4
%7 = load i32, i32* %6
%8 = sub nsw i32 %7, 1
%9 = call i32 @cwrapper_q_sort_float(float* %5, i32 0, i32 %8)
ret void
}

LLVM IR (-O2):
define void @quicksort_float_(float* %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = add nsw i32 %3, -1
%5 = tail call i32 @cwrapper_q_sort_float(float* %0, i32 0, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void vm_var_free(void *ptr) { free((char *)ptr); }


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

x86 assembly (clang, -O2):
<vm_var_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @vm_var_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
main() { ; }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
unsigned long b4_to_u32(unsigned char *b) {
  unsigned long l;
  l = b[0];
  l += (unsigned)b[1] << 8;
  l += (unsigned)b[2] << 16;
  l += (unsigned)b[3] << 24;
  return l;
}


x86 assembly (clang, -O0):
<b4_to_u32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
shl    $0x8,%eax
mov    %eax,%eax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%eax
shl    $0x10,%eax
mov    %eax,%eax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x3(%rax),%eax
shl    $0x18,%eax
mov    %eax,%eax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @b4_to_u32(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
store i64 %7, i64* %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = zext i32 %12 to i64
%14 = load i64, i64* %3
%15 = add i64 %14, %13
store i64 %15, i64* %3
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i64 2
%18 = load i8, i8* %17
%19 = zext i8 %18 to i32
%20 = shl i32 %19, 16
%21 = zext i32 %20 to i64
%22 = load i64, i64* %3
%23 = add i64 %22, %21
store i64 %23, i64* %3
%24 = load i8*, i8** %2
%25 = getelementptr inbounds i8, i8* %24, i64 3
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = shl i32 %27, 24
%29 = zext i32 %28 to i64
%30 = load i64, i64* %3
%31 = add i64 %30, %29
store i64 %31, i64* %3
%32 = load i64, i64* %3
ret i64 %32
}

LLVM IR (-O2):
define i64 @b4_to_u32(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i64
%7 = shl nuw nsw i64 %6, 8
%8 = or i64 %7, %3
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = zext i8 %10 to i64
%12 = shl nuw nsw i64 %11, 16
%13 = or i64 %8, %12
%14 = getelementptr inbounds i8, i8* %0, i64 3
%15 = load i8, i8* %14
%16 = zext i8 %15 to i64
%17 = shl nuw nsw i64 %16, 24
%18 = or i64 %13, %17
ret i64 %18
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void cp_string_drop_content(char *str) {
  if (str)
    free(str);
}


x86 assembly (clang, -O0):
<cp_string_drop_content>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <cp_string_drop_content+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cp_string_drop_content>:
test   %rdi,%rdi
je     111a <cp_string_drop_content+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @cp_string_drop_content(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @cp_string_drop_content(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int transform(uint64_t b, uint64_t magic, int bits) {
  return (unsigned)((int)b * (int)magic ^
                    (int)(b >> 32) * (int)(magic >> 32)) >>
         (32 - bits);
}


x86 assembly (clang, -O0):
<transform>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%edx
mov    $0x20,%ecx
sar    %cl,%edx
mov    -0x10(%rbp),%ecx
imul   %edx,%ecx
xor    %ecx,%eax
mov    $0x20,%ecx
sub    -0xc(%rbp),%ecx
shr    %cl,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @transform(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = mul nsw i32 %7, %8
%10 = load i32, i32* %4
%11 = ashr i32 %10, 32
%12 = load i32, i32* %5
%13 = ashr i32 %12, 32
%14 = mul nsw i32 %11, %13
%15 = xor i32 %9, %14
%16 = load i32, i32* %6
%17 = sub nsw i32 32, %16
%18 = lshr i32 %15, %17
ret i32 %18
}

LLVM IR (-O2):
define i32 @transform(i32 %0, i32 %1, i32 %2) {
ret i32 poison
}
void debugfs_hw_add(struct ieee80211_local *local) { return; }


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

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

LLVM IR (-O0):
%struct.ieee80211_local = type opaque
define void @debugfs_hw_add(%struct.ieee80211_local* %0) {
%2 = alloca %struct.ieee80211_local*
store %struct.ieee80211_local* %0, %struct.ieee80211_local** %2
ret void
}

LLVM IR (-O2):
%struct.ieee80211_local = type opaque
define void @debugfs_hw_add(%struct.ieee80211_local* nocapture %0) {
ret void
}
int foo() { return 2; }


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

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

LLVM IR (-O0):
define i32 @foo() {
ret i32 2
}

LLVM IR (-O2):
define i32 @foo() {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ divisao(int);
int /*<<< orphan*/ printf(char *, int);
void main() {
  int resto;
  divisao(resto);
  printf("O resto é %d", resto);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x4(%rbp),%edi
call   1030 <divisao@plt>
mov    -0x4(%rbp),%esi
lea    0xec6(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <divisao@plt>
lea    0xed3(%rip),%rdi
pop    %rax
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str = [14 x i8] c"O resto \C3\A9 %d\00"
define void @main() {
%1 = tail call i32 @divisao(i32 undef)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 undef)
ret void
}
/* Type definitions */
struct cdrom_msf {
  int dummy;
};
typedef int /*<<< orphan*/ msf;

/* Variables and functions */
int main(void) {
  struct cdrom_msf msf;
  (void)msf;
  return sizeof(msf);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.cdrom_msf = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.cdrom_msf
store i32 0, i32* %1
ret i32 4
}

LLVM IR (-O2):
define i32 @main() {
ret i32 4
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ _IO(char, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/);
void hapara_timer_reset() {
  int fd;
  fd = open("/dev/hapara_trace", O_RDWR);
  if (fd == -1)
    return;
  ioctl(fd, _IO('t', 7));
  close(fd);
}


x86 assembly (clang, -O0):
<hapara_timer_reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
lea    0xea8(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    116f <hapara_timer_reset+0x2f>
jmp    1196 <hapara_timer_reset+0x56>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x74,%edi
mov    $0x7,%esi
call   1030 <_IO@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%esi
call   1040 <ioctl@plt>
mov    -0x4(%rbp),%edi
call   1050 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hapara_timer_reset>:
push   %rbx
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
lea    0xeaf(%rip),%rdi
call   1060 <open@plt>
cmp    $0xffffffff,%eax
je     117d <hapara_timer_reset+0x3d>
mov    %eax,%ebx
mov    $0x74,%edi
mov    $0x7,%esi
call   1030 <_IO@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <ioctl@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1050 <close@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"/dev/hapara_trace\00"
@O_RDWR = global i32 0
define void @hapara_timer_reset() {
%1 = alloca i32
%2 = load i32, i32* @O_RDWR
%3 = call i32 @open(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2)
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %7
6: ; preds = %0
br label %13
7: ; preds = %0
%8 = load i32, i32* %1
%9 = call i32 @_IO(i8 signext 116, i32 7)
%10 = call i32 @ioctl(i32 %8, i32 %9)
%11 = load i32, i32* %1
%12 = call i32 @close(i32 %11)
br label %13
13: ; preds = %7, %6
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"/dev/hapara_trace\00"
@O_RDWR = global i32 0
define void @hapara_timer_reset() {
%1 = load i32, i32* @O_RDWR
%2 = tail call i32 @open(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp eq i32 %2, -1
br i1 %3, label %8, label %4
4: ; preds = %0
%5 = tail call i32 @_IO(i8 signext 116, i32 7)
%6 = tail call i32 @ioctl(i32 %2, i32 %5)
%7 = tail call i32 @close(i32 %2)
br label %8
8: ; preds = %0, %4
ret void
}
void rop3_89_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = ~S;
  stk2 = T | stk3;
  stk1 = *D ^ stk2;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_89_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0x9(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xd(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xd(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_89_1_0>:
mov    %esi,%eax
not    %al
or     %al,%dl
mov    (%rdi),%cl
xor    %cl,%dl
and    %sil,%cl
and    %al,%dl
or     %cl,%dl
mov    %dl,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_89_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = xor i32 %11, -1
%13 = trunc i32 %12 to i8
store i8 %13, i8* %9
%14 = load i8, i8* %6
%15 = zext i8 %14 to i32
%16 = load i8, i8* %9
%17 = zext i8 %16 to i32
%18 = or i32 %15, %17
%19 = trunc i32 %18 to i8
store i8 %19, i8* %8
%20 = load i8*, i8** %4
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = load i8, i8* %8
%24 = zext i8 %23 to i32
%25 = xor i32 %22, %24
%26 = trunc i32 %25 to i8
store i8 %26, i8* %7
%27 = load i8, i8* %7
%28 = zext i8 %27 to i32
%29 = load i8, i8* %5
%30 = zext i8 %29 to i32
%31 = xor i32 %30, -1
%32 = and i32 %28, %31
%33 = load i8*, i8** %4
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = load i8, i8* %5
%37 = zext i8 %36 to i32
%38 = and i32 %35, %37
%39 = or i32 %32, %38
%40 = trunc i32 %39 to i8
%41 = load i8*, i8** %4
store i8 %40, i8* %41
ret void
}

LLVM IR (-O2):
define void @rop3_89_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = xor i8 %1, -1
%5 = or i8 %4, %2
%6 = load i8, i8* %0
%7 = xor i8 %6, %5
%8 = and i8 %6, %1
%9 = and i8 %7, %4
%10 = or i8 %9, %8
store i8 %10, i8* %0
ret void
}
/* Variables and functions */
int bar(int);
int /*<<< orphan*/ puts(char *);
int foo(int x) {
  puts("in foo");
  return bar(x / 2) + 2;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <bar@plt>
add    $0x2,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
shr    $0x1f,%edi
add    %ebx,%edi
sar    %edi
call   1040 <bar@plt>
add    $0x2,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"in foo\00"
define i32 @foo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 2
%6 = call i32 @bar(i32 %5)
%7 = add nsw i32 %6, 2
ret i32 %7
}

LLVM IR (-O2):
@.str = [7 x i8] c"in foo\00"
define i32 @foo(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = sdiv i32 %0, 2
%4 = tail call i32 @bar(i32 %3)
%5 = add nsw i32 %4, 2
ret i32 %5
}
int __test_and_clear_bit(int nr, volatile unsigned long *addr) {
  unsigned long mask = (1UL << ((nr) % (sizeof(long) * 8)));
  unsigned long *p = ((unsigned long *)addr) + ((nr) / (sizeof(long) * 8));
  unsigned long old = *p;
  *p = old & ~mask;
  return (old & mask) != 0;
}


x86 assembly (clang, -O0):
<__test_and_clear_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movslq -0x4(%rbp),%rcx
and    $0x3f,%rcx
mov    $0x1,%eax
shl    %cl,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
shr    $0x6,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
xor    $0xffffffffffffffff,%rax
and    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
and    -0x18(%rbp),%rax
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__test_and_clear_bit>:
movslq %edi,%rcx
mov    %rcx,%rax
shr    $0x6,%rax
mov    (%rsi,%rax,8),%rdx
mov    %rdx,%rdi
btr    %rcx,%rdi
mov    %rdi,(%rsi,%rax,8)
xor    %eax,%eax
bt     %rcx,%rdx
setb   %al
ret

LLVM IR (-O0):
define i32 @__test_and_clear_bit(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i64*
%7 = alloca i64
store i32 %0, i32* %3
store i64* %1, i64** %4
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = urem i64 %9, 64
%11 = shl i64 1, %10
store i64 %11, i64* %5
%12 = load i64*, i64** %4
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = udiv i64 %14, 64
%16 = getelementptr inbounds i64, i64* %12, i64 %15
store i64* %16, i64** %6
%17 = load i64*, i64** %6
%18 = load i64, i64* %17
store i64 %18, i64* %7
%19 = load i64, i64* %7
%20 = load i64, i64* %5
%21 = xor i64 %20, -1
%22 = and i64 %19, %21
%23 = load i64*, i64** %6
store i64 %22, i64* %23
%24 = load i64, i64* %7
%25 = load i64, i64* %5
%26 = and i64 %24, %25
%27 = icmp ne i64 %26, 0
%28 = zext i1 %27 to i32
ret i32 %28
}

LLVM IR (-O2):
define i32 @__test_and_clear_bit(i32 %0, i64* nocapture %1) {
%3 = sext i32 %0 to i64
%4 = and i64 %3, 63
%5 = shl nuw i64 1, %4
%6 = lshr i64 %3, 6
%7 = getelementptr inbounds i64, i64* %1, i64 %6
%8 = load i64, i64* %7
%9 = xor i64 %5, -1
%10 = and i64 %8, %9
store i64 %10, i64* %7
%11 = and i64 %8, %5
%12 = icmp ne i64 %11, 0
%13 = zext i1 %12 to i32
ret i32 %13
}
void alarmHandler(int sig) { return; }


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

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

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

LLVM IR (-O2):
define void @alarmHandler(i32 %0) {
ret void
}
/* Type definitions */
struct xylo_tgraph {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ free(struct xylo_tgraph *);
int /*<<< orphan*/ xylo_term_tgraph(struct xylo_tgraph *);
void xylo_free_tgraph(struct xylo_tgraph *graph) {
  assert(graph != NULL);
  xylo_term_tgraph(graph);
  free(graph);
}


x86 assembly (clang, -O0):
<xylo_free_tgraph>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1040 <xylo_term_tgraph@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xylo_free_tgraph>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1040 <xylo_term_tgraph@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.xylo_tgraph = type { i32 }
define void @xylo_free_tgraph(%struct.xylo_tgraph* %0) {
%2 = alloca %struct.xylo_tgraph*
store %struct.xylo_tgraph* %0, %struct.xylo_tgraph** %2
%3 = load %struct.xylo_tgraph*, %struct.xylo_tgraph** %2
%4 = icmp ne %struct.xylo_tgraph* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load %struct.xylo_tgraph*, %struct.xylo_tgraph** %2
%8 = call i32 @xylo_term_tgraph(%struct.xylo_tgraph* %7)
%9 = load %struct.xylo_tgraph*, %struct.xylo_tgraph** %2
%10 = call i32 @free(%struct.xylo_tgraph* %9)
ret void
}

LLVM IR (-O2):
%struct.xylo_tgraph = type { i32 }
define void @xylo_free_tgraph(%struct.xylo_tgraph* %0) {
%2 = icmp ne %struct.xylo_tgraph* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @xylo_term_tgraph(%struct.xylo_tgraph* %0)
%6 = tail call i32 @free(%struct.xylo_tgraph* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello Geek!\n");
  return (0);
}


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"Hello Geek!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/);
int /*<<< orphan*/ *fgetln(int /*<<< orphan*/, size_t *);
int /*<<< orphan*/ stdin;
int main(void) {
  size_t sz;
  fclose(stdin);
  return (NULL != fgetln(stdin, &sz));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
call   1030 <fclose@plt>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1040 <fgetln@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0x2ebc(%rip),%rbx
mov    (%rbx),%edi
call   1030 <fclose@plt>
mov    (%rbx),%edi
lea    0x8(%rsp),%rsi
call   1040 <fgetln@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
%3 = load i32, i32* @stdin
%4 = call i32 @fclose(i32 %3)
%5 = load i32, i32* @stdin
%6 = call i32* @fgetln(i32 %5, i64* %2)
%7 = icmp ne i32* null, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = load i32, i32* @stdin
%4 = tail call i32 @fclose(i32 %3)
%5 = load i32, i32* @stdin
%6 = call i32* @fgetln(i32 %5, i64* %1)
%7 = icmp ne i32* %6, null
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
struct file {
  int dummy;
};

/* Variables and functions */
scalar_t__ argfd(int /*<<< orphan*/, int /*<<< orphan*/, struct file **);
int fdalloc(struct file *);
int /*<<< orphan*/ filedup(struct file *);
int sys_dup(void) {
  struct file *f;
  int fd;
  if (argfd(0, 0, &f) < 0)
    return -1;
  if ((fd = fdalloc(f)) < 0)
    return -1;
  filedup(f);
  return fd;
}


x86 assembly (clang, -O0):
<sys_dup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %esi,%esi
lea    -0x10(%rbp),%rdx
mov    %esi,%edi
call   1050 <argfd@plt>
cmp    $0x0,%rax
jge    115b <sys_dup+0x2b>
movl   $0xffffffff,-0x4(%rbp)
jmp    118b <sys_dup+0x5b>
mov    -0x10(%rbp),%rdi
call   1040 <fdalloc@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    117c <sys_dup+0x4c>
movl   $0xffffffff,-0x4(%rbp)
jmp    118b <sys_dup+0x5b>
mov    -0x10(%rbp),%rdi
call   1030 <filedup@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_dup>:
push   %rbp
push   %rbx
push   %rax
mov    %rsp,%rdx
xor    %edi,%edi
xor    %esi,%esi
call   1050 <argfd@plt>
mov    $0xffffffff,%ebx
test   %rax,%rax
js     1163 <sys_dup+0x33>
mov    (%rsp),%rdi
call   1040 <fdalloc@plt>
test   %eax,%eax
js     1163 <sys_dup+0x33>
mov    %eax,%ebp
mov    (%rsp),%rdi
call   1030 <filedup@plt>
mov    %ebp,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.file = type { i32 }
define i32 @sys_dup() {
%1 = alloca i32
%2 = alloca %struct.file*
%3 = alloca i32
%4 = call i64 @argfd(i32 0, i32 0, %struct.file** %2)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 -1, i32* %1
br label %16
7: ; preds = %0
%8 = load %struct.file*, %struct.file** %2
%9 = call i32 @fdalloc(%struct.file* %8)
store i32 %9, i32* %3
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 -1, i32* %1
br label %16
12: ; preds = %7
%13 = load %struct.file*, %struct.file** %2
%14 = call i32 @filedup(%struct.file* %13)
%15 = load i32, i32* %3
store i32 %15, i32* %1
br label %16
16: ; preds = %12, %11, %6
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
%struct.file = type { i32 }
define i32 @sys_dup() {
%1 = alloca %struct.file*
%2 = bitcast %struct.file** %1 to i8*
%3 = call i64 @argfd(i32 0, i32 0, %struct.file** %1)
%4 = icmp slt i64 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %0
%6 = load %struct.file*, %struct.file** %1
%7 = call i32 @fdalloc(%struct.file* %6)
%8 = icmp slt i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %5
%10 = load %struct.file*, %struct.file** %1
%11 = call i32 @filedup(%struct.file* %10)
br label %12
12: ; preds = %5, %0, %9
%13 = phi i32 [ %7, %9 ], [ -1, %0 ], [ -1, %5 ]
ret i32 %13
}
/* Variables and functions */
scalar_t__ check_AA(int);
scalar_t__ check_NA(int);
int check_BIO(int number) {
  if ((check_AA(number)) || (check_NA(number)))
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<check_BIO>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <check_AA@plt>
cmp    $0x0,%rax
jne    114f <check_BIO+0x2f>
mov    -0x8(%rbp),%edi
call   1030 <check_NA@plt>
cmp    $0x0,%rax
je     115b <check_BIO+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1162 <check_BIO+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_BIO>:
push   %rbx
mov    %edi,%ebx
call   1040 <check_AA@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1137 <check_BIO+0x17>
pop    %rbx
ret
mov    %ebx,%edi
call   1030 <check_NA@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @check_BIO(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i64 @check_AA(i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = call i64 @check_NA(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7, %1
store i32 1, i32* %2
br label %13
12: ; preds = %7
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @check_BIO(i32 %0) {
%2 = tail call i64 @check_AA(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @check_NA(i32 %0)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Type definitions */
struct fpga_model {
  int dummy;
};

/* Variables and functions */
int pos_in_row(int, struct fpga_model *);
int regular_row_pos(int y, struct fpga_model *model) {
  int row_pos = pos_in_row(y, model);
  if (row_pos == -1 || row_pos == 8)
    return -1;
  if (row_pos > 8)
    row_pos--;
  return row_pos;
}


x86 assembly (clang, -O0):
<regular_row_pos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <pos_in_row@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
je     1142 <regular_row_pos+0x32>
cmpl   $0x8,-0x14(%rbp)
jne    114e <regular_row_pos+0x3e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1167 <regular_row_pos+0x57>
cmpl   $0x8,-0x14(%rbp)
jle    1161 <regular_row_pos+0x51>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<regular_row_pos>:
push   %rax
call   1030 <pos_in_row@plt>
mov    $0xffffffff,%ecx
cmp    $0xffffffff,%eax
je     112f <regular_row_pos+0x1f>
cmp    $0x8,%eax
je     112f <regular_row_pos+0x1f>
setg   %cl
movzbl %cl,%ecx
sub    %ecx,%eax
mov    %eax,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.fpga_model = type { i32 }
define i32 @regular_row_pos(i32 %0, %struct.fpga_model* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.fpga_model*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.fpga_model* %1, %struct.fpga_model** %5
%7 = load i32, i32* %4
%8 = load %struct.fpga_model*, %struct.fpga_model** %5
%9 = call i32 @pos_in_row(i32 %7, %struct.fpga_model* %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp eq i32 %10, -1
br i1 %11, label %15, label %12
12: ; preds = %2
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 8
br i1 %14, label %15, label %16
15: ; preds = %12, %2
store i32 -1, i32* %3
br label %24
16: ; preds = %12
%17 = load i32, i32* %6
%18 = icmp sgt i32 %17, 8
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %6
%21 = add nsw i32 %20, -1
store i32 %21, i32* %6
br label %22
22: ; preds = %19, %16
%23 = load i32, i32* %6
store i32 %23, i32* %3
br label %24
24: ; preds = %22, %15
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
%struct.fpga_model = type { i32 }
define i32 @regular_row_pos(i32 %0, %struct.fpga_model* %1) {
%3 = tail call i32 @pos_in_row(i32 %0, %struct.fpga_model* %1)
switch i32 %3, label %4 [
i32 -1, label %8
i32 8, label %8
]
4: ; preds = %2
%5 = icmp sgt i32 %3, 8
%6 = sext i1 %5 to i32
%7 = add nsw i32 %3, %6
br label %8
8: ; preds = %2, %2, %4
%9 = phi i32 [ %7, %4 ], [ -1, %2 ], [ -1, %2 ]
ret i32 %9
}