xunge/DecIR huggingface dataset:
double glmMin3d(double a, double b, double c) {
  if (a < b) {
    if (a < c)
      return a;
    else
      return c;
  } else {
    if (b < c)
      return b;
    else
      return c;
  }
}


x86 assembly (clang, -O0):
<glmMin3d>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1159 <glmMin3d+0x59>
movsd  -0x10(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    114a <glmMin3d+0x4a>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1186 <glmMin3d+0x86>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1186 <glmMin3d+0x86>
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    117c <glmMin3d+0x7c>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1186 <glmMin3d+0x86>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmMin3d>:
minsd  %xmm1,%xmm0
minsd  %xmm2,%xmm0
ret

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

LLVM IR (-O2):
define double @glmMin3d(double %0, double %1, double %2) {
%4 = fcmp olt double %0, %1
%5 = fcmp olt double %0, %2
%6 = select i1 %5, double %0, double %2
%7 = fcmp olt double %1, %2
%8 = select i1 %7, double %1, double %2
%9 = select i1 %4, double %6, double %8
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void set_black_colour(void) { printf("\033[1;30m"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"\1B[1;30m\00"
define void @set_black_colour() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"\1B[1;30m\00"
define void @set_black_colour() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
int get_i(int index) { return index / 100; }


x86 assembly (clang, -O0):
<get_i>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_i>:
movslq %edi,%rax
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @get_i(i32 %0) {
%2 = sdiv i32 %0, 100
ret i32 %2
}
void do_break_point(void *x) {
  do {
    kprintf("Unsupport Now...[%s]\n", __FUNCTION__);
    while (1)
      ;
  } while (0);
  ;
}


x86 assembly (clang, -O0):
<do_break_point>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
lea    0xeec(%rip),%rsi
mov    $0x0,%al
call   1030 <kprintf@plt>
jmp    1131 <do_break_point+0x21>

x86 assembly (clang, -O2):
<do_break_point>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xef7(%rip),%rsi
xor    %eax,%eax
call   1030 <kprintf@plt>
cs nopw 0x0(%rax,%rax,1)
jmp    1130 <do_break_point+0x20>

LLVM IR (-O0):
@.str = [22 x i8] c"Unsupport Now...[%s]\0A\00"
@__FUNCTION__.do_break_point = [15 x i8] c"do_break_point\00"
define void @do_break_point(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1
%4 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.do_break_point, i64 0, i64 0))
br label %5
5: ; preds = %3, %5
br label %5
6: ; No predecessors!
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"Unsupport Now...[%s]\0A\00"
@__FUNCTION__.do_break_point = [15 x i8] c"do_break_point\00"
define void @do_break_point(i8* nocapture readnone %0) {
%2 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__FUNCTION__.do_break_point, i64 0, i64 0))
br label %3
3: ; preds = %1, %3
br label %3
}
/* Variables and functions */
char *next_word(char *);
scalar_t__ strlen(char *);
int get_register(char *line) {
  char *reg = next_word(line);
  if (strlen(reg) != 0)
    return reg[0] - 'A';
  return -1;
}


x86 assembly (clang, -O0):
<get_register>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <next_word@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%rax
je     115e <get_register+0x3e>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
sub    $0x41,%eax
mov    %eax,-0x4(%rbp)
jmp    1165 <get_register+0x45>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_register>:
push   %rax
call   1030 <next_word@plt>
movsbl (%rax),%eax
lea    -0x41(%rax),%ecx
cmp    $0x1,%eax
sbb    %eax,%eax
or     %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @get_register(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @next_word(i8* %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = call i64 @strlen(i8* %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %1
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = sub nsw i32 %14, 65
store i32 %15, i32* %2
br label %17
16: ; preds = %1
store i32 -1, i32* %2
br label %17
17: ; preds = %16, %10
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @get_register(i8* %0) {
%2 = tail call i8* @next_word(i8* %0)
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 0
%5 = sext i8 %3 to i32
%6 = add nsw i32 %5, -65
%7 = select i1 %4, i32 -1, i32 %6
ret i32 %7
}
int test_imm_59int8_reg(signed char val) {
  return ((val) & (0x59 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_59int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0x59,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_59int8_reg>:
test   $0x59,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_59int8_reg(i8 signext %0) {
%2 = and i8 %0, 89
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  char s1[50], s2[50];
  strcpy(s1, "Tweedledee ");
  strcpy(s2, "Tweedledum");
  strcat(s1, s2);
  puts(s1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeb3(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x80(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x40(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1050 <strcat@plt>
lea    -0x40(%rbp),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x78,%rsp
lea    0xec2(%rip),%rsi
lea    0x40(%rsp),%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
lea    0xeba(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcat@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Tweedledee \00"
@.str.1 = [11 x i8] c"Tweedledum\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
%3 = alloca [50 x i8]
store i32 0, i32* %1
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%10 = call i32 @strcat(i8* %8, i8* %9)
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%12 = call i32 @puts(i8* %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Tweedledee \00"
@.str.1 = [11 x i8] c"Tweedledum\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%5 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @strcat(i8* %3, i8* %4)
%8 = call i32 @puts(i8* %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ glReadBuffer(unsigned int);
void ReadBuffer(unsigned int m) { glReadBuffer(m); }


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

x86 assembly (clang, -O2):
<ReadBuffer>:
jmp    1030 <glReadBuffer@plt>

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

LLVM IR (-O2):
define void @ReadBuffer(i32 %0) {
%2 = tail call i32 @glReadBuffer(i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ crc32_append(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                int /*<<< orphan*/);
uint32_t crc32(uint8_t *buffer, uint32_t length) {
  return crc32_append(buffer, length, 0);
}


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

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

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

LLVM IR (-O2):
define i32 @crc32(i32* %0, i32 %1) {
%3 = tail call i32 @crc32_append(i32* %0, i32 %1, i32 0)
ret i32 %3
}
int os_signal(int sig, int *rc) { return -1; }


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

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

LLVM IR (-O0):
define i32 @os_signal(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
ret i32 -1
}

LLVM IR (-O2):
define i32 @os_signal(i32 %0, i32* nocapture readnone %1) {
ret i32 -1
}
/* Variables and functions */
size_t strnlenpt(char const *, int);
size_t strlenpt(const char *buf) { return strnlenpt(buf, -1); }


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

x86 assembly (clang, -O2):
<strlenpt>:
mov    $0xffffffff,%esi
jmp    1030 <strnlenpt@plt>

LLVM IR (-O0):
define i64 @strlenpt(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strnlenpt(i8* %3, i32 -1)
ret i64 %4
}

LLVM IR (-O2):
define i64 @strlenpt(i8* %0) {
%2 = tail call i64 @strnlenpt(i8* %0, i32 -1)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ dbr_abort(int);
int /*<<< orphan*/ dbr_mesg(char *, size_t);
void *realloc(void *, size_t);
void *xrealloc(void *ptr, size_t size) {
  void *value = realloc(ptr, size);
  if (value == NULL) {
    dbr_mesg("Error: virtual memory exhausted  (%i bytes requested).\n", size);
    dbr_abort(2);
  }
  return value;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1176 <xrealloc+0x46>
mov    -0x10(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1030 <dbr_mesg@plt>
mov    $0x2,%edi
call   1040 <dbr_abort@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1050 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    115d <xrealloc+0x2d>
lea    0xeb5(%rip),%rdi
mov    %r14,%rsi
call   1030 <dbr_mesg@plt>
mov    $0x2,%edi
call   1040 <dbr_abort@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [56 x i8] c"Error: virtual memory exhausted (%i bytes requested).\0A\00"
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i64, i64* %4
%13 = call i32 @dbr_mesg(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i64 %12)
%14 = call i32 @dbr_abort(i32 2)
br label %15
15: ; preds = %11, %2
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
@.str = [56 x i8] c"Error: virtual memory exhausted (%i bytes requested).\0A\00"
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @dbr_mesg(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i64 %1)
%7 = tail call i32 @dbr_abort(i32 2)
br label %8
8: ; preds = %5, %2
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/ *);
void cond_fputs(const char *buffer, FILE *stream) {
  if (!stream) {
    return;
  }
  fputs(buffer, stream);
}


x86 assembly (clang, -O0):
<cond_fputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1130 <cond_fputs+0x20>
jmp    113d <cond_fputs+0x2d>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <fputs@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

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

/* Variables and functions */
int /*<<< orphan*/ spi_write_byte(int);
void write_sram(uint32_t address, uint16_t data) {
  spi_write_byte(0x02);
  spi_write_byte(address >> 16);
  spi_write_byte(address >> 8);
  spi_write_byte(address);
  spi_write_byte(data >> 8);
  spi_write_byte(data);
}


x86 assembly (clang, -O0):
<write_sram>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x2,%edi
call   1030 <spi_write_byte@plt>
mov    -0x4(%rbp),%edi
sar    $0x10,%edi
call   1030 <spi_write_byte@plt>
mov    -0x4(%rbp),%edi
sar    $0x8,%edi
call   1030 <spi_write_byte@plt>
mov    -0x4(%rbp),%edi
call   1030 <spi_write_byte@plt>
mov    -0x8(%rbp),%edi
sar    $0x8,%edi
call   1030 <spi_write_byte@plt>
mov    -0x8(%rbp),%edi
call   1030 <spi_write_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_sram>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x2,%edi
call   1030 <spi_write_byte@plt>
mov    %ebp,%edi
sar    $0x10,%edi
call   1030 <spi_write_byte@plt>
mov    %ebp,%edi
sar    $0x8,%edi
call   1030 <spi_write_byte@plt>
mov    %ebp,%edi
call   1030 <spi_write_byte@plt>
mov    %ebx,%edi
sar    $0x8,%edi
call   1030 <spi_write_byte@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <spi_write_byte@plt>

LLVM IR (-O0):
define void @write_sram(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @spi_write_byte(i32 2)
%6 = load i32, i32* %3
%7 = ashr i32 %6, 16
%8 = call i32 @spi_write_byte(i32 %7)
%9 = load i32, i32* %3
%10 = ashr i32 %9, 8
%11 = call i32 @spi_write_byte(i32 %10)
%12 = load i32, i32* %3
%13 = call i32 @spi_write_byte(i32 %12)
%14 = load i32, i32* %4
%15 = ashr i32 %14, 8
%16 = call i32 @spi_write_byte(i32 %15)
%17 = load i32, i32* %4
%18 = call i32 @spi_write_byte(i32 %17)
ret void
}

LLVM IR (-O2):
define void @write_sram(i32 %0, i32 %1) {
%3 = tail call i32 @spi_write_byte(i32 2)
%4 = ashr i32 %0, 16
%5 = tail call i32 @spi_write_byte(i32 %4)
%6 = ashr i32 %0, 8
%7 = tail call i32 @spi_write_byte(i32 %6)
%8 = tail call i32 @spi_write_byte(i32 %0)
%9 = ashr i32 %1, 8
%10 = tail call i32 @spi_write_byte(i32 %9)
%11 = tail call i32 @spi_write_byte(i32 %1)
ret void
}
long syscall1(int num, long a1) {
  long ret;
  __asm__ __volatile__("syscall" : "=a"(ret) : "a"(num), "D"(a1) :);
  return ret;
}


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

x86 assembly (clang, -O2):
<syscall1>:
mov    %edi,%eax
mov    %rsi,%rdi
syscall
ret

LLVM IR (-O0):
define i64 @syscall1(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%6 = load i32, i32* %3
%7 = load i64, i64* %4
%8 = call i64 asm sideeffect "syscall", "={ax},{ax},{di},~{dirflag},~{fpsr},~{flags}"(i32 %6, i64 %7)
store i64 %8, i64* %5
%9 = load i64, i64* %5
ret i64 %9
}

LLVM IR (-O2):
define i64 @syscall1(i32 %0, i64 %1) {
%3 = tail call i64 asm sideeffect "syscall", "={ax},{ax},{di},~{dirflag},~{fpsr},~{flags}"(i32 %0, i64 %1)
ret i64 %3
}
/* Variables and functions */
double rand32(int /*<<< orphan*/);
double ranno(void) { return rand32(0) / 4294967295.0; }


x86 assembly (clang, -O0):
<ranno>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <rand32@plt>
movsd  0xedd(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ranno>:
push   %rax
xor    %edi,%edi
call   1030 <rand32@plt>
divsd  0xee0(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @ranno() {
%1 = call double @rand32(i32 0)
%2 = fdiv double %1, 0x41EFFFFFFFE00000
ret double %2
}

LLVM IR (-O2):
define double @ranno() {
%1 = tail call double @rand32(i32 0)
%2 = fdiv double %1, 0x41EFFFFFFFE00000
ret double %2
}
int TCP_Disconnect(int sock) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @TCP_Disconnect(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ navigate_main_calc_route();
void roadmap_start_navigate(void) { navigate_main_calc_route(); }


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

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

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

LLVM IR (-O2):
define void @roadmap_start_navigate() {
%1 = tail call i32 (...) @navigate_main_calc_route()
ret void
}
/* Variables and functions */
int hashmapHash(void *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(void *);
int hash_str(void *key) { return hashmapHash(key, strlen(key)); }


x86 assembly (clang, -O0):
<hash_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1040 <hashmapHash@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_str>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <hashmapHash@plt>

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

LLVM IR (-O2):
define i32 @hash_str(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @hashmapHash(i8* %0, i32 %2)
ret i32 %3
}
int test_imm_D7uint16_reg(unsigned short val) {
  return ((val) & (-0xD7 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_D7uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffff29,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_D7uint16_reg>:
test   $0xff29,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_D7uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -215
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
scalar_t__ binIndex(char *);
char *subString(int, scalar_t__, char *);
char *partone(char *g) { return subString(1, binIndex(g) - 1, g); }


x86 assembly (clang, -O0):
<partone>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <binIndex@plt>
mov    %rax,%rsi
sub    $0x1,%rsi
mov    -0x8(%rbp),%rdx
mov    $0x1,%edi
call   1040 <subString@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<partone>:
push   %rbx
mov    %rdi,%rbx
call   1030 <binIndex@plt>
lea    -0x1(%rax),%rsi
mov    $0x1,%edi
mov    %rbx,%rdx
pop    %rbx
jmp    1040 <subString@plt>

LLVM IR (-O0):
define i8* @partone(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @binIndex(i8* %3)
%5 = sub nsw i64 %4, 1
%6 = load i8*, i8** %2
%7 = call i8* @subString(i32 1, i64 %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @partone(i8* %0) {
%2 = tail call i64 @binIndex(i8* %0)
%3 = add nsw i64 %2, -1
%4 = tail call i8* @subString(i32 1, i64 %3, i8* %0)
ret i8* %4
}
int md_suspchar() { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @md_suspchar() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
double stdlib_strided_dmeanpn(int /*<<< orphan*/ const, double const *,
                              int /*<<< orphan*/ const);
double stdlib_strided_dmean(const int64_t N, const double *X,
                            const int64_t stride) {
  return stdlib_strided_dmeanpn(N, X, stride);
}


x86 assembly (clang, -O0):
<stdlib_strided_dmean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <stdlib_strided_dmeanpn@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdlib_strided_dmean>:
jmp    1030 <stdlib_strided_dmeanpn@plt>

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

LLVM IR (-O2):
define double @stdlib_strided_dmean(i32 %0, double* %1, i32 %2) {
%4 = tail call double @stdlib_strided_dmeanpn(i32 %0, double* %1, i32 %2)
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ die(char *);
int do_cmd_process(int, char **);
int /*<<< orphan*/ job_constructor();
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ veg_class_constructor();
int /*<<< orphan*/ veg_info_constructor();
int main(int arglen, char **argv) {
  if (sizeof(unsigned char) != 1)
    die("assertion failed: sizeof uchar != 1");
  system("mkdir /tmp/.chw > /dev/null 2>&1");
  veg_class_constructor();
  veg_info_constructor();
  job_constructor();
  return do_cmd_process(arglen, argv);
}


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)
lea    0xe93(%rip),%rdi
call   1070 <system@plt>
mov    $0x0,%al
call   1030 <veg_class_constructor@plt>
mov    $0x0,%al
call   1040 <veg_info_constructor@plt>
mov    $0x0,%al
call   1050 <job_constructor@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <do_cmd_process@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xea1(%rip),%rdi
call   1070 <system@plt>
xor    %eax,%eax
call   1030 <veg_class_constructor@plt>
xor    %eax,%eax
call   1040 <veg_info_constructor@plt>
xor    %eax,%eax
call   1050 <job_constructor@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <do_cmd_process@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"mkdir /tmp/.chw > /dev/null 2>&1\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 @system(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @veg_class_constructor()
%8 = call i32 (...) @veg_info_constructor()
%9 = call i32 (...) @job_constructor()
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @do_cmd_process(i32 %10, i8** %11)
ret i32 %12
}

LLVM IR (-O2):
@.str = [33 x i8] c"mkdir /tmp/.chw > /dev/null 2>&1\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @system(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (...) @veg_class_constructor()
%5 = tail call i32 (...) @veg_info_constructor()
%6 = tail call i32 (...) @job_constructor()
%7 = tail call i32 @do_cmd_process(i32 %0, i8** %1)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ full_report(int, int, int);
void report(int action, int process_target) {
  full_report(action, process_target, -1);
}


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

x86 assembly (clang, -O2):
<report>:
mov    $0xffffffff,%edx
jmp    1030 <full_report@plt>

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

LLVM IR (-O2):
define void @report(i32 %0, i32 %1) {
%3 = tail call i32 @full_report(i32 %0, i32 %1, i32 -1)
ret void
}
int test_and_set_bit(int nr, unsigned long *addr) {
  unsigned long mask = (1UL << ((nr) % (sizeof(unsigned long) * 8)));
  unsigned long *p = addr + ((nr) / (sizeof(unsigned long) * 8));
  unsigned long old = *p;
  *p = old | mask;
  return (old & mask) != 0;
}


x86 assembly (clang, -O0):
<test_and_set_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
or     -0x18(%rbp),%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_set_bit>:
movslq %edi,%rcx
mov    %rcx,%rax
shr    $0x6,%rax
mov    (%rsi,%rax,8),%rdx
mov    %rdx,%rdi
bts    %rcx,%rdi
mov    %rdi,(%rsi,%rax,8)
xor    %eax,%eax
bt     %rcx,%rdx
setb   %al
ret

LLVM IR (-O0):
define i32 @test_and_set_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 = or i64 %19, %20
%22 = load i64*, i64** %6
store i64 %21, i64* %22
%23 = load i64, i64* %7
%24 = load i64, i64* %5
%25 = and i64 %23, %24
%26 = icmp ne i64 %25, 0
%27 = zext i1 %26 to i32
ret i32 %27
}

LLVM IR (-O2):
define i32 @test_and_set_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 = or i64 %8, %5
store i64 %9, i64* %7
%10 = and i64 %8, %5
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct timeval {
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
time_t StatsTime(time_t *t) {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  if (t) {
    *t = tv.tv_sec;
  }
  return tv.tv_sec;
}


x86 assembly (clang, -O0):
<StatsTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmpq   $0x0,-0x8(%rbp)
je     113d <StatsTime+0x2d>
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StatsTime>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    0x8(%rsp),%eax
test   %rbx,%rbx
je     112f <StatsTime+0x1f>
mov    %eax,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i32 @StatsTime(i32* %0) {
%2 = alloca i32*
%3 = alloca %struct.timeval
store i32* %0, i32** %2
%4 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%5 = load i32*, i32** %2
%6 = icmp ne i32* %5, null
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%9 = load i32, i32* %8
%10 = load i32*, i32** %2
store i32 %9, i32* %10
br label %11
11: ; preds = %7, %1
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%13 = load i32, i32* %12
ret i32 %13
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @StatsTime(i32* writeonly %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%5 = icmp eq i32* %0, null
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%7 = load i32, i32* %6
br i1 %5, label %9, label %8
8: ; preds = %1
store i32 %7, i32* %0
br label %9
9: ; preds = %1, %8
ret i32 %7
}
double l2_squared_dist(double a[2], double b[2]) {
  double d[2];
  d[0] = a[0] - b[0];
  d[1] = a[1] - b[1];
  return d[0] * d[0] + d[1] * d[1];
}


x86 assembly (clang, -O0):
<l2_squared_dist>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<l2_squared_dist>:
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
subsd  (%rsi),%xmm0
subsd  0x8(%rsi),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @l2_squared_dist(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca [2 x double]
store double* %0, double** %3
store double* %1, double** %4
%6 = load double*, double** %3
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = load double*, double** %4
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
%12 = fsub double %8, %11
%13 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
store double %12, double* %13
%14 = load double*, double** %3
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
%17 = load double*, double** %4
%18 = getelementptr inbounds double, double* %17, i64 1
%19 = load double, double* %18
%20 = fsub double %16, %19
%21 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 1
store double %20, double* %21
%22 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%23 = load double, double* %22
%24 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%25 = load double, double* %24
%26 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 1
%27 = load double, double* %26
%28 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 1
%29 = load double, double* %28
%30 = fmul double %27, %29
%31 = call double @llvm.fmuladd.f64(double %23, double %25, double %30)
ret double %31
}

LLVM IR (-O2):
define double @l2_squared_dist(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = fsub double %3, %4
%6 = getelementptr inbounds double, double* %0, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %1, i64 1
%9 = load double, double* %8
%10 = fsub double %7, %9
%11 = fmul double %10, %10
%12 = tail call double @llvm.fmuladd.f64(double %5, double %5, double %11)
ret double %12
}
int subtracao(int num1, int num2) { return num1 - num2; }


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

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

LLVM IR (-O0):
define i32 @subtracao(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 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @subtracao(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
/* Variables and functions */
void *i(size_t);
void *j3(size_t n) { return i(n); }


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

x86 assembly (clang, -O2):
<j3>:
jmp    1030 <i@plt>

LLVM IR (-O0):
define i8* @j3(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i8* @i(i64 %3)
ret i8* %4
}

LLVM IR (-O2):
define i8* @j3(i64 %0) {
%2 = tail call i8* @i(i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int strlen(char *);
int main() {
  int string_length;
  char my_string[] = "fnord";
  string_length = strlen(my_string);
  printf("%d\n", string_length);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0xe(%rbp)
mov    0xec5(%rip),%ax
mov    %ax,-0xa(%rbp)
lea    -0xe(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movw   $0x64,0x4(%rsp)
movl   $0x726f6e66,(%rsp)
mov    %rsp,%rdi
call   1030 <strlen@plt>
lea    0xec8(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@__const.main.my_string = [6 x i8] c"fnord\00"
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%3 = call i32 @strlen(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
char function(int c) { return c + 1; }


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

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

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

LLVM IR (-O2):
define signext i8 @function(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = add i8 %2, 1
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, int *, int *);
int main(int argc, char const *argv[]) {
  int a, b;
  while ((scanf("%d%d", &a, &b) > 0)) {
    printf("%d\n", a + b);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <scanf@plt>
cmp    $0x0,%rax
jle    116b <main+0x4b>
mov    -0x14(%rbp),%esi
add    -0x18(%rbp),%esi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%8 = icmp sgt i64 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %2, %9
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = add nsw i32 %11, %10
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%15 = icmp sgt i64 %14, 0
br i1 %15, label %9, label %16
16: ; preds = %9, %2
ret i32 0
}
/* Variables and functions */
unsigned int inl(int);
int /*<<< orphan*/ io_wait();
unsigned int inl_p(int port) {
  unsigned int value = inl(port);
  io_wait();
  return value;
}


x86 assembly (clang, -O0):
<inl_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <inl@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <io_wait@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inl_p>:
push   %rbx
call   1040 <inl@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <io_wait@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @inl_p(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @inl(i32 %4)
store i32 %5, i32* %3
%6 = call i32 (...) @io_wait()
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @inl_p(i32 %0) {
%2 = tail call i32 @inl(i32 %0)
%3 = tail call i32 (...) @io_wait()
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
size_t fwrite(char *, int, size_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
void emit(char *sol, char *eol, FILE *output_stream) {
  size_t ntowrite = eol - sol;
  size_t nwritten = fwrite(sol, 1, ntowrite, output_stream);
  if (nwritten != ntowrite) {
    perror("fwrite");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<emit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1050 <fwrite@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
je     1191 <emit+0x61>
lea    0xe7e(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit>:
push   %rbx
mov    %rdx,%rcx
mov    %rsi,%rbx
sub    %rdi,%rbx
mov    $0x1,%esi
mov    %rbx,%rdx
call   1050 <fwrite@plt>
cmp    %rbx,%rax
jne    114e <emit+0x1e>
pop    %rbx
ret
lea    0xeab(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"fwrite\00"
define void @emit(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%9 = load i8*, i8** %5
%10 = load i8*, i8** %4
%11 = ptrtoint i8* %9 to i64
%12 = ptrtoint i8* %10 to i64
%13 = sub i64 %11, %12
store i64 %13, i64* %7
%14 = load i8*, i8** %4
%15 = load i64, i64* %7
%16 = load i32*, i32** %6
%17 = call i64 @fwrite(i8* %14, i32 1, i64 %15, i32* %16)
store i64 %17, i64* %8
%18 = load i64, i64* %8
%19 = load i64, i64* %7
%20 = icmp ne i64 %18, %19
br i1 %20, label %21, label %24
21: ; preds = %3
%22 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"fwrite\00"
define void @emit(i8* %0, i8* %1, i32* nocapture %2) {
%4 = ptrtoint i8* %1 to i64
%5 = ptrtoint i8* %0 to i64
%6 = sub i64 %4, %5
%7 = tail call i64 @fwrite(i8* %0, i32 1, i64 %6, i32* %2)
%8 = icmp eq i64 %7, %6
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %3
ret void
}