xunge/DecIR huggingface dataset:
int main() {
  int a;
  int b;
  a = 2;
  b = 3;
  int c;
  c = a + b;
  return c;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 5
}
/* Variables and functions */
int /*<<< orphan*/ init_bg_process_arr();
int /*<<< orphan*/ main_shell();
int main(int argc, char const *argv[]) {
  init_bg_process_arr();
  main_shell();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <init_bg_process_arr@plt>
xor    %eax,%eax
call   1030 <main_shell@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**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @init_bg_process_arr()
%7 = call i32 (...) @main_shell()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @init_bg_process_arr()
%4 = tail call i32 (...) @main_shell()
ret i32 0
}
void outw(unsigned short v, int p) {
  __asm__ __volatile__("outw %w0, %w1" : : "a"(v), "Nd"(p));
}


x86 assembly (clang, -O0):
<outw>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x2(%rbp),%ax
mov    -0x8(%rbp),%edx
out    %ax,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outw>:
mov    %esi,%edx
mov    %edi,%eax
out    %ax,(%dx)
ret

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

LLVM IR (-O2):
define void @outw(i16 zeroext %0, i32 %1) {
tail call void asm sideeffect "outw ${0:w}, ${1:w}", "{ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ action_a_mesurer();
int main(void) {
  action_a_mesurer();
  return (0);
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @action_a_mesurer()
ret i32 0
}
double pot(int n, int m) {
  double f2(int, int), f4(int, int);
  double potelm;
  potelm = (-2.0 * f2(n, m) + f4(n, m));
  return (potelm);
}


x86 assembly (clang, -O0):
<pot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <f2@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <f4@plt>
movsd  -0x18(%rbp),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pot>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <f2@plt>
movsd  %xmm0,(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1040 <f4@plt>
movsd  (%rsp),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @pot(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call double @f2(i32 %6, i32 %7)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call double @f4(i32 %9, i32 %10)
%12 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %8, double %11)
store double %12, double* %5
%13 = load double, double* %5
ret double %13
}

LLVM IR (-O2):
define double @pot(i32 %0, i32 %1) {
%3 = tail call double @f2(i32 %0, i32 %1)
%4 = tail call double @f4(i32 %0, i32 %1)
%5 = tail call double @llvm.fmuladd.f64(double %3, double -2.000000e+00, double %4)
ret double %5
}
/* Variables and functions */
int getnpar(int /*<<< orphan*/, char *, char *, char **);
int getparstring(char *name, char **ptr) { return getnpar(0, name, "s", ptr); }


x86 assembly (clang, -O0):
<getparstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rcx
xor    %edi,%edi
lea    0xecf(%rip),%rdx
call   1030 <getnpar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getparstring>:
mov    %rsi,%rcx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdx
xor    %edi,%edi
jmp    1030 <getnpar@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"s\00"
define i32 @getparstring(i8* %0, i8** %1) {
%3 = tail call i32 @getnpar(i32 0, i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, long, long, long, char *);
const char *MMPLIB_VER_STR() {
  static char verstr[64];
  sprintf(verstr, "%02lu.%02lu.%04lu build:%s", 0L, 6L, 0106L,
          "20060415-V100ITr1");
  return ((char *)verstr);
}


x86 assembly (clang, -O0):
<MMPLIB_VER_STR>:
push   %rbp
mov    %rsp,%rbp
lea    0x2f25(%rip),%rdi
lea    0xede(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
mov    $0x6,%ecx
mov    $0x46,%r8d
lea    0xee3(%rip),%r9
call   1030 <sprintf@plt>
lea    0x2efc(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MMPLIB_VER_STR>:
push   %rbx
lea    0x2f28(%rip),%rbx
lea    0xee1(%rip),%rsi
lea    0xef5(%rip),%r9
mov    $0x6,%ecx
mov    $0x46,%r8d
mov    %rbx,%rdi
xor    %edx,%edx
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@MMPLIB_VER_STR.verstr = internal global [64 x i8] zeroinitializer
@.str = [27 x i8] c"%02lu.%02lu.%04lu build:%s\00"
@.str.1 = [18 x i8] c"20060415-V100ITr1\00"
define i8* @MMPLIB_VER_STR() {
%1 = call i32 @sprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @MMPLIB_VER_STR.verstr, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 0, i64 6, i64 70, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @MMPLIB_VER_STR.verstr, i64 0, i64 0)
}

LLVM IR (-O2):
@MMPLIB_VER_STR.verstr = internal global [64 x i8] zeroinitializer
@.str = [27 x i8] c"%02lu.%02lu.%04lu build:%s\00"
@.str.1 = [18 x i8] c"20060415-V100ITr1\00"
define i8* @MMPLIB_VER_STR() {
%1 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @MMPLIB_VER_STR.verstr, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i64 0, i64 6, i64 70, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @MMPLIB_VER_STR.verstr, i64 0, i64 0)
}
/* Type definitions */
typedef int ulong;

/* Variables and functions */
int dbwt_blog(ulong x) {
  int l;
  l = -1;
  while (x > 0) {
    x >>= 1;
    l++;
  }
  return l;
}


x86 assembly (clang, -O0):
<dbwt_blog>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    112f <dbwt_blog+0x2f>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <dbwt_blog+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbwt_blog>:
mov    $0xffffffff,%eax
test   %edi,%edi
jle    111c <dbwt_blog+0x1c>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
shr    %ecx
add    $0x1,%eax
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <dbwt_blog+0x10>
ret

LLVM IR (-O0):
define i32 @dbwt_blog(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 -1, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* %2
%9 = ashr i32 %8, 1
store i32 %9, i32* %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 @dbwt_blog(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ -1, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i32 %5, 1
%7 = add nsw i32 %4, 1
%8 = icmp ult i32 %5, 2
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ -1, %1 ], [ %7, %3 ]
ret i32 %10
}
/* Variables and functions */
int w5100_read_byte(unsigned int);
unsigned w5100_readSn_byte(unsigned sock, unsigned addr) {
  return w5100_read_byte(0x0400 + sock * 0x0100 + addr);
}


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

x86 assembly (clang, -O2):
shl    $0x8,%edi
add    %esi,%edi
add    $0x400,%edi
jmp    1030 <w5100_read_byte@plt>

LLVM IR (-O0):
define i32 @w5100_readSn_byte(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 = mul i32 %5, 256
%7 = add i32 1024, %6
%8 = load i32, i32* %4
%9 = add i32 %7, %8
%10 = call i32 @w5100_read_byte(i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @w5100_readSn_byte(i32 %0, i32 %1) {
%3 = shl i32 %0, 8
%4 = add i32 %3, 1024
%5 = add i32 %4, %1
%6 = tail call i32 @w5100_read_byte(i32 %5)
ret i32 %6
}
/* Variables and functions */
int isnan_d(double);
int isnan_f(double);
int isnan_ld(double);
int isinf_d(double x) {
  return (sizeof(x - x) == sizeof(long double) ? isnan_ld(x - x)
          : sizeof(x - x) == sizeof(double)    ? isnan_d(x - x)
                                               : isnan_f(x - x));
}


x86 assembly (clang, -O0):
<isinf_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
call   1030 <isnan_d@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isinf_d>:
subsd  %xmm0,%xmm0
jmp    1030 <isnan_d@plt>

LLVM IR (-O0):
define i32 @isinf_d(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fsub double %3, %4
%6 = call i32 @isnan_d(double %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @isinf_d(double %0) {
%2 = fsub double %0, %0
%3 = tail call i32 @isnan_d(double %2)
ret i32 %3
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int rword(int);
uint16_t rw(uint16_t *addr) {
  uint16_t val = rword(*addr);
  *addr += 2;
  return val;
}


x86 assembly (clang, -O0):
<rw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <rword@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x2,%ecx
mov    %ecx,(%rax)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rw>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1030 <rword@plt>
addl   $0x2,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define i32 @rw(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = load i32, i32* %4
%6 = call i32 @rword(i32 %5)
store i32 %6, i32* %3
%7 = load i32*, i32** %2
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 2
store i32 %9, i32* %7
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @rw(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @rword(i32 %2)
%4 = load i32, i32* %0
%5 = add nsw i32 %4, 2
store i32 %5, i32* %0
ret i32 %3
}
void eth_init_board(void) {}


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

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

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

LLVM IR (-O2):
define void @eth_init_board() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void Writer_io_write(void *out, int ch) {
  char c = ch;
  write(1, &c, 1);
}


x86 assembly (clang, -O0):
<Writer_io_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,-0xd(%rbp)
mov    $0x1,%edx
lea    -0xd(%rbp),%rsi
mov    %edx,%edi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Writer_io_write>:
push   %rax
mov    %sil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <write@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @Writer_io_write(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = trunc i32 %6 to i8
store i8 %7, i8* %5
%8 = call i32 @write(i32 1, i8* %5, i32 1)
ret void
}

LLVM IR (-O2):
define void @Writer_io_write(i8* nocapture readnone %0, i32 %1) {
%3 = alloca i8
%4 = trunc i32 %1 to i8
store i8 %4, i8* %3
%5 = call i32 @write(i32 1, i8* %3, i32 1)
ret void
}
void gtk_frame_get_type() {}


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

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

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

LLVM IR (-O2):
define void @gtk_frame_get_type() {
ret void
}
/* Variables and functions */
char *calloc(int, size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
size_t strlen(char const *);
char *netpgp_strdup(const char *s) {
  size_t len;
  char *cp;
  len = strlen(s);
  if ((cp = calloc(1, len + 1)) != NULL) {
    (void)memcpy(cp, s, len);
    cp[len] = 0x0;
  }
  return cp;
}


x86 assembly (clang, -O0):
<netpgp_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1186 <netpgp_strdup+0x56>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1050 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<netpgp_strdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %rax,%r15
lea    0x1(%rax),%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1169 <netpgp_strdup+0x39>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <memcpy@plt>
movb   $0x0,(%rbx,%r15,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @netpgp_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = add i64 %7, 1
%9 = call i8* @calloc(i32 1, i64 %8)
store i8* %9, i8** %4
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %19
11: ; preds = %1
%12 = load i8*, i8** %4
%13 = load i8*, i8** %2
%14 = load i64, i64* %3
%15 = call i32 @memcpy(i8* %12, i8* %13, i64 %14)
%16 = load i8*, i8** %4
%17 = load i64, i64* %3
%18 = getelementptr inbounds i8, i8* %16, i64 %17
store i8 0, i8* %18
br label %19
19: ; preds = %11, %1
%20 = load i8*, i8** %4
ret i8* %20
}

LLVM IR (-O2):
define i8* @netpgp_strdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i8* @calloc(i32 1, i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = tail call i32 @memcpy(i8* %4, i8* %0, i64 %2)
%8 = getelementptr inbounds i8, i8* %4, i64 %2
store i8 0, i8* %8
br label %9
9: ; preds = %6, %1
ret i8* %4
}
/* Variables and functions */
int atoi(char *);
int getInt_callback(void *data, int argc, char **argv, char **azColName) {
  int *item = data;
  if (argc >= 1) {
    *item = atoi(argv[0]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<getInt_callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpl   $0x1,-0xc(%rbp)
jl     114d <getInt_callback+0x3d>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <atoi@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getInt_callback>:
test   %esi,%esi
jle    1123 <getInt_callback+0x13>
push   %rbx
mov    %rdi,%rbx
mov    (%rdx),%rdi
call   1030 <atoi@plt>
mov    %eax,(%rbx)
pop    %rbx
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @getInt_callback(i8* %0, i32 %1, i8** %2, i8** %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8**
%9 = alloca i32*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store i8** %3, i8*** %8
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to i32*
store i32* %11, i32** %9
%12 = load i32, i32* %6
%13 = icmp sge i32 %12, 1
br i1 %13, label %14, label %20
14: ; preds = %4
%15 = load i8**, i8*** %7
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
%19 = load i32*, i32** %9
store i32 %18, i32* %19
br label %20
20: ; preds = %14, %4
ret i32 0
}

LLVM IR (-O2):
define i32 @getInt_callback(i8* nocapture writeonly %0, i32 %1, i8** nocapture %2, i8** nocapture readnone %3) {
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %10
6: ; preds = %4
%7 = bitcast i8* %0 to i32*
%8 = load i8*, i8** %2
%9 = tail call i32 @atoi(i8* %8)
store i32 %9, i32* %7
br label %10
10: ; preds = %6, %4
ret i32 0
}
/* Variables and functions */
int power(int, int);
int fillUpArray(int *a, int size) {
  int i;
  for (i = 0; i < size; i++) {
    a[i] = power(i, 3);
  }
  return i;
}


x86 assembly (clang, -O0):
<fillUpArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115a <fillUpArray+0x4a>
mov    -0x10(%rbp),%edi
mov    $0x3,%esi
call   1030 <power@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <fillUpArray+0x16>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fillUpArray>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
jle    114b <fillUpArray+0x3b>
mov    %esi,%r14d
mov    %rdi,%r15
mov    %esi,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%edi
mov    $0x3,%esi
call   1030 <power@plt>
mov    %eax,(%r15,%rbp,4)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1130 <fillUpArray+0x20>
jmp    114e <fillUpArray+0x3e>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fillUpArray(i32* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = trunc i64 %7 to i32
%9 = tail call i32 @power(i32 %8, i32 3)
%10 = getelementptr inbounds i32, i32* %0, i64 %7
store i32 %9, i32* %10
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = phi i32 [ 0, %2 ], [ %1, %6 ]
ret i32 %14
}
/* Variables and functions */
char *strstr(char const *, char const *);
int g_pos(const char *str, const char *to_find) {
  const char *pp;
  pp = strstr(str, to_find);
  if (pp == 0) {
    return -1;
  }
  return (pp - str);
}


x86 assembly (clang, -O0):
<g_pos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1148 <g_pos+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    1156 <g_pos+0x46>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_pos>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strstr@plt>
mov    %eax,%ecx
sub    %ebx,%ecx
cmp    $0x1,%rax
sbb    %eax,%eax
or     %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @g_pos(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = call i8* @strstr(i8* %7, i8* %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 -1, i32* %3
br label %20
13: ; preds = %2
%14 = load i8*, i8** %6
%15 = load i8*, i8** %4
%16 = ptrtoint i8* %14 to i64
%17 = ptrtoint i8* %15 to i64
%18 = sub i64 %16, %17
%19 = trunc i64 %18 to i32
store i32 %19, i32* %3
br label %20
20: ; preds = %13, %12
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @g_pos(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i8* %3, null
%5 = ptrtoint i8* %3 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = trunc i64 %7 to i32
%9 = select i1 %4, i32 -1, i32 %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isascii(int);
void t_isascii_0x62() {
  Assert_real((isascii(98)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isascii.c",
              495, ("isascii should be 1 for b"));
}


x86 assembly (clang, -O0):
<t_isascii_0x62>:
push   %rbp
mov    %rsp,%rbp
mov    $0x62,%edi
call   1030 <isascii@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x1ef,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isascii_0x62>:
lea    0xee9(%rip),%rsi
lea    0xf8a(%rip),%rcx
mov    $0x1,%edi
mov    $0x1ef,%edx
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [26 x i8] c"isascii should be 1 for b\00"
define void @t_isascii_0x62() {
%1 = call i32 @isascii(i32 98)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 495, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [26 x i8] c"isascii should be 1 for b\00"
define void @t_isascii_0x62() {
%1 = tail call i32 @Assert_real(i32 1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 495, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef scalar_t__ __u64;

/* Variables and functions */
int EINVAL;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
int do_fallocate_syscall(const char *path, __u64 bytecount) {
  int err;
  bytecount = 0;
  fprintf(stderr, "Error: this copy of hdparm was built without %s support\n",
          path);
  err = EINVAL;
  return err;
}


x86 assembly (clang, -O0):
<do_fallocate_syscall>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x10(%rbp)
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec4(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_fallocate_syscall>:
push   %rax
mov    %rdi,%rdx
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea8(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [57 x i8] c"Error: this copy of hdparm was built without %s support\0A\00"
@EINVAL = global i32 0
define i32 @do_fallocate_syscall(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
store i64 0, i64* %4
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %3
%8 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i32, i32* @EINVAL
store i32 %9, i32* %5
%10 = load i32, i32* %5
ret i32 %10
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [57 x i8] c"Error: this copy of hdparm was built without %s support\0A\00"
@EINVAL = global i32 0
define i32 @do_fallocate_syscall(i8* %0, i64 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = load i32, i32* @EINVAL
ret i32 %5
}
int kernel_has_rtsig(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @kernel_has_rtsig() {
ret i32 1
}

LLVM IR (-O2):
define i32 @kernel_has_rtsig() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ UnitTest_report();
int /*<<< orphan*/ testFunctionConstant();
int /*<<< orphan*/ testFunctionZero();
int main(int argc, char **argv) {
  testFunctionConstant();
  testFunctionZero();
  UnitTest_report();
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @testFunctionConstant()
%4 = tail call i32 (...) @testFunctionZero()
%5 = tail call i32 (...) @UnitTest_report()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ deallocate_heap();
int /*<<< orphan*/ deallocate_nn_arrays();
void mst2_package_done() {
  deallocate_heap();
  deallocate_nn_arrays();
}


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

x86 assembly (clang, -O2):
<mst2_package_done>:
push   %rax
xor    %eax,%eax
call   1040 <deallocate_heap@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <deallocate_nn_arrays@plt>

LLVM IR (-O0):
define void @mst2_package_done() {
%1 = call i32 (...) @deallocate_heap()
%2 = call i32 (...) @deallocate_nn_arrays()
ret void
}

LLVM IR (-O2):
define void @mst2_package_done() {
%1 = tail call i32 (...) @deallocate_heap()
%2 = tail call i32 (...) @deallocate_nn_arrays()
ret void
}
float bar(__attribute((vector_size(16))) float a, int b,
          __attribute((vector_size(16))) float c) {
  __attribute((vector_size(16))) float e = c * a;
  a = (__attribute((vector_size(16))) float){0, 0, 0, 0};
  c = (__attribute((vector_size(16))) float){0, 0, 0, 0};
  float d = ((float *)&a)[0];
  float f = ((float *)&c)[0];
  return d * f;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
movaps %xmm0,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
movaps %xmm1,-0x30(%rbp)
movaps -0x30(%rbp),%xmm0
movaps -0x10(%rbp),%xmm1
mulps  %xmm1,%xmm0
movaps %xmm0,-0x40(%rbp)
xorps  %xmm0,%xmm0
movaps %xmm0,-0x50(%rbp)
movaps -0x50(%rbp),%xmm1
movaps %xmm1,-0x10(%rbp)
movaps %xmm0,-0x60(%rbp)
movaps -0x60(%rbp),%xmm0
movaps %xmm0,-0x30(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x64(%rbp)
movss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x68(%rbp)
movss  -0x64(%rbp),%xmm0
mulss  -0x68(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @bar(<4 x float> %0, i32 %1, <4 x float> %2) {
%4 = alloca <4 x float>
%5 = alloca i32
%6 = alloca <4 x float>
%7 = alloca <4 x float>
%8 = alloca <4 x float>
%9 = alloca <4 x float>
%10 = alloca float
%11 = alloca float
store <4 x float> %0, <4 x float>* %4
store i32 %1, i32* %5
store <4 x float> %2, <4 x float>* %6
%12 = load <4 x float>, <4 x float>* %6
%13 = load <4 x float>, <4 x float>* %4
%14 = fmul <4 x float> %12, %13
store <4 x float> %14, <4 x float>* %7
store <4 x float> zeroinitializer, <4 x float>* %8
%15 = load <4 x float>, <4 x float>* %8
store <4 x float> %15, <4 x float>* %4
store <4 x float> zeroinitializer, <4 x float>* %9
%16 = load <4 x float>, <4 x float>* %9
store <4 x float> %16, <4 x float>* %6
%17 = bitcast <4 x float>* %4 to float*
%18 = getelementptr inbounds float, float* %17, i64 0
%19 = load float, float* %18
store float %19, float* %10
%20 = bitcast <4 x float>* %6 to float*
%21 = getelementptr inbounds float, float* %20, i64 0
%22 = load float, float* %21
store float %22, float* %11
%23 = load float, float* %10
%24 = load float, float* %11
%25 = fmul float %23, %24
ret float %25
}

LLVM IR (-O2):
define float @bar(<4 x float> %0, i32 %1, <4 x float> %2) {
ret float 0.000000e+00
}
void stub_os_deinit(void) {}


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

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

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

LLVM IR (-O2):
define void @stub_os_deinit() {
ret void
}
/* Variables and functions */
int knapsack(int, int *, int *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int val[] = {60, 100, 120};
  int wt[] = {1, 2, 3};
  int W = 5;
  int n = 3;
  int result = knapsack(W, wt, val, n);
  printf("\nValue = %d", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xec2(%rip),%rax
mov    %rax,-0x1c(%rbp)
mov    0xec0(%rip),%eax
mov    %eax,-0x14(%rbp)
movl   $0x5,-0x20(%rbp)
movl   $0x3,-0x24(%rbp)
mov    -0x20(%rbp),%edi
lea    -0x1c(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1040 <knapsack@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%esi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xede(%rip),%eax
mov    %eax,0x20(%rsp)
mov    0xecb(%rip),%rax
mov    %rax,0x18(%rsp)
mov    0xed4(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xec1(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rsi
lea    0x18(%rsp),%rdx
mov    $0x5,%edi
mov    $0x3,%ecx
call   1040 <knapsack@plt>
lea    0xea8(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.val = [3 x i32] [i32 60, i32 100, i32 120]
@__const.main.wt = [3 x i32] [i32 1, i32 2, i32 3]
@.str = [12 x i8] c"\0AValue = %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca [3 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = bitcast [3 x i32]* %2 to i8*
%8 = bitcast [3 x i32]* %3 to i8*
store i32 5, i32* %4
store i32 3, i32* %5
%9 = load i32, i32* %4
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%12 = load i32, i32* %5
%13 = call i32 @knapsack(i32 %9, i32* %10, i32* %11, i32 %12)
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}

LLVM IR (-O2):
@__const.main.val = [3 x i32] [i32 60, i32 100, i32 120]
@__const.main.wt = [3 x i32] [i32 1, i32 2, i32 3]
@.str = [12 x i8] c"\0AValue = %d\00"
define i32 @main() {
%1 = alloca [3 x i32]
%2 = alloca [3 x i32]
%3 = bitcast [3 x i32]* %1 to i8*
%4 = bitcast [3 x i32]* %2 to i8*
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%7 = call i32 @knapsack(i32 5, i32* %5, i32* %6, i32 3)
%8 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ remove(char *);
void cleanup() {
  remove("testSource.bin");
  remove("testDest.bin");
  remove("testDest.bin.bigsync");
}


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

x86 assembly (clang, -O2):
<cleanup>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <remove@plt>
lea    0xeeb(%rip),%rdi
call   1030 <remove@plt>
lea    0xeec(%rip),%rdi
pop    %rax
jmp    1030 <remove@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"testSource.bin\00"
@.str.1 = [13 x i8] c"testDest.bin\00"
@.str.2 = [21 x i8] c"testDest.bin.bigsync\00"
define void @cleanup() {
%1 = call i32 @remove(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @remove(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @remove(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"testSource.bin\00"
@.str.1 = [13 x i8] c"testDest.bin\00"
@.str.2 = [21 x i8] c"testDest.bin.bigsync\00"
define void @cleanup() {
%1 = tail call i32 @remove(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @remove(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @remove(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ENOENT;
int /*<<< orphan*/ errno;
int _unlink(char *name) {
  (void)(name);
  errno = ENOENT;
  return -1;
}


x86 assembly (clang, -O0):
<_unlink>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec8(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_unlink>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOENT = global i32 0
@errno = global i32 0
define i32 @_unlink(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @ENOENT
store i32 %4, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOENT = global i32 0
@errno = global i32 0
define i32 @_unlink(i8* nocapture readnone %0) {
%2 = load i32, i32* @ENOENT
store i32 %2, i32* @errno
ret i32 -1
}
/* Variables and functions */
int popNumber();
int /*<<< orphan*/ pushNumber(int /*<<< orphan*/);
int /*<<< orphan*/ screenrect(int, int, int, int, int);
void basScreenRect() {
  int x, y, w, h, flag;
  flag = popNumber();
  h = popNumber();
  w = popNumber();
  y = popNumber();
  x = popNumber();
  pushNumber(screenrect(x, y, w, h, flag));
}


x86 assembly (clang, -O0):
<basScreenRect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1050 <popNumber@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1050 <popNumber@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <popNumber@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1050 <popNumber@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <popNumber@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1040 <screenrect@plt>
mov    %eax,%edi
call   1030 <pushNumber@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basScreenRect>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <popNumber@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1050 <popNumber@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1050 <popNumber@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <popNumber@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <popNumber@plt>
mov    %eax,%edi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1040 <screenrect@plt>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <pushNumber@plt>

LLVM IR (-O0):
define void @basScreenRect() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = call i32 (...) @popNumber()
store i32 %6, i32* %5
%7 = call i32 (...) @popNumber()
store i32 %7, i32* %4
%8 = call i32 (...) @popNumber()
store i32 %8, i32* %3
%9 = call i32 (...) @popNumber()
store i32 %9, i32* %2
%10 = call i32 (...) @popNumber()
store i32 %10, i32* %1
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = call i32 @screenrect(i32 %11, i32 %12, i32 %13, i32 %14, i32 %15)
%17 = call i32 @pushNumber(i32 %16)
ret void
}

LLVM IR (-O2):
define void @basScreenRect() {
%1 = tail call i32 (...) @popNumber()
%2 = tail call i32 (...) @popNumber()
%3 = tail call i32 (...) @popNumber()
%4 = tail call i32 (...) @popNumber()
%5 = tail call i32 (...) @popNumber()
%6 = tail call i32 @screenrect(i32 %5, i32 %4, i32 %3, i32 %2, i32 %1)
%7 = tail call i32 @pushNumber(i32 %6)
ret void
}
/* Type definitions */
typedef int int64_t;
typedef scalar_t__ int32_t;

/* Variables and functions */
int32_t aeron_logbuffer_term_offset(int64_t raw_tail, int32_t term_length) {
  int32_t offset = (int32_t)(raw_tail & 0xFFFFFFFFL);
  return offset < term_length ? offset : term_length;
}


x86 assembly (clang, -O0):
<aeron_logbuffer_term_offset>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movslq -0x4(%rbp),%rax
movabs $0xffffffff,%rcx
and    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    113b <aeron_logbuffer_term_offset+0x3b>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1143 <aeron_logbuffer_term_offset+0x43>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<aeron_logbuffer_term_offset>:
mov    %edi,%eax
cmp    %rsi,%rax
cmovge %rsi,%rax
ret

LLVM IR (-O0):
define i64 @aeron_logbuffer_term_offset(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 = sext i32 %6 to i64
%8 = and i64 %7, 4294967295
store i64 %8, i64* %5
%9 = load i64, i64* %5
%10 = load i64, i64* %4
%11 = icmp slt i64 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load i64, i64* %5
br label %16
14: ; preds = %2
%15 = load i64, i64* %4
br label %16
16: ; preds = %14, %12
%17 = phi i64 [ %13, %12 ], [ %15, %14 ]
ret i64 %17
}

LLVM IR (-O2):
define i64 @aeron_logbuffer_term_offset(i32 %0, i64 %1) {
%3 = zext i32 %0 to i64
%4 = icmp slt i64 %3, %1
%5 = select i1 %4, i64 %3, i64 %1
ret i64 %5
}
void outbyte(unsigned short _port, unsigned char _data) {
  __asm__ __volatile__("outb %1, %0" : : "dN"(_port), "a"(_data));
}


x86 assembly (clang, -O0):
<outbyte>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    -0x2(%rbp),%dx
mov    -0x3(%rbp),%al
out    %al,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outbyte>:
mov    %esi,%eax
mov    %edi,%edx
out    %al,(%dx)
ret

LLVM IR (-O0):
define void @outbyte(i16 zeroext %0, i8 zeroext %1) {
%3 = alloca i16
%4 = alloca i8
store i16 %0, i16* %3
store i8 %1, i8* %4
%5 = load i16, i16* %3
%6 = load i8, i8* %4
ret void
}

LLVM IR (-O2):
define void @outbyte(i16 zeroext %0, i8 zeroext %1) {
tail call void asm sideeffect "outb $1, $0", "{dx}N,{ax},~{dirflag},~{fpsr},~{flags}"(i16 %0, i8 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char const *);
void die(const char *msg) {
  perror(msg);
  exit(1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @die(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
unsigned long time_queue_hash(unsigned char *str) {
  unsigned long hash = 5381;
  int c;
  while (c = *str++)
    hash = ((hash << 5) + hash) + c;
  return hash;
}


x86 assembly (clang, -O0):
<time_queue_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1505,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     114a <time_queue_hash+0x4a>
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
add    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <time_queue_hash+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_queue_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112c <time_queue_hash+0x2c>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %rax,%rdx
shl    $0x5,%rdx
add    %rax,%rdx
movzbl %cl,%eax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <time_queue_hash+0x10>
ret
mov    $0x1505,%eax
ret

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

LLVM IR (-O2):
define i64 @time_queue_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = phi i64 [ %11, %4 ], [ 5381, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = mul i64 %7, 33
%10 = zext i8 %5 to i64
%11 = add i64 %9, %10
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 5381, %1 ], [ %11, %4 ]
ret i64 %15
}
int is_hex_digit(char x) {
  return (('0' <= x && x <= '9') || ('A' <= x && x <= 'F') ||
          ('a' <= x && x <= 'f'));
}


x86 assembly (clang, -O0):
<is_hex_digit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jg     112d <is_hex_digit+0x2d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x39,%ecx
mov    %al,-0x2(%rbp)
jle    1179 <is_hex_digit+0x79>
movsbl -0x1(%rbp),%ecx
mov    $0x41,%eax
cmp    %ecx,%eax
jg     1150 <is_hex_digit+0x50>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x46,%ecx
mov    %al,-0x2(%rbp)
jle    1179 <is_hex_digit+0x79>
movsbl -0x1(%rbp),%edx
xor    %eax,%eax
mov    $0x61,%ecx
cmp    %edx,%ecx
mov    %al,-0x3(%rbp)
jg     1173 <is_hex_digit+0x73>
movsbl -0x1(%rbp),%eax
cmp    $0x66,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_hex_digit>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
setb   %al
and    $0xdf,%dil
add    $0xbf,%dil
cmp    $0x6,%dil
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @is_hex_digit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sle i32 48, %4
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br i1 %9, label %28, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sle i32 65, %12
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 70
br i1 %17, label %28, label %18
18: ; preds = %14, %10
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp sle i32 97, %20
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp sle i32 %24, 102
br label %26
26: ; preds = %22, %18
%27 = phi i1 [ false, %18 ], [ %25, %22 ]
br label %28
28: ; preds = %26, %14, %6
%29 = phi i1 [ true, %14 ], [ true, %6 ], [ %27, %26 ]
%30 = zext i1 %29 to i32
ret i32 %30
}

LLVM IR (-O2):
define i32 @is_hex_digit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = and i8 %0, -33
%5 = add i8 %4, -65
%6 = icmp ult i8 %5, 6
%7 = or i1 %3, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ BUG();
void play_dead(void) { BUG(); }


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

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

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

LLVM IR (-O2):
define void @play_dead() {
%1 = tail call i32 (...) @BUG()
ret void
}