xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char fgetc(int /*<<< orphan*/ *);
scalar_t__ isspace(char);
int /*<<< orphan*/ ungetc(char, int /*<<< orphan*/ *);
int parse_read_space(FILE *f) {
  char c = 0;
  c = fgetc(f);
  if (isspace(c)) {
    parse_read_space(f);
    return 0;
  }
  ungetc(c, f);
  return 1;
}


x86 assembly (clang, -O0):
<parse_read_space>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movb   $0x0,-0x11(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     1184 <parse_read_space+0x44>
mov    -0x10(%rbp),%rdi
call   1060 <parse_read_space@plt>
movl   $0x0,-0x4(%rbp)
jmp    119a <parse_read_space+0x5a>
mov    -0x11(%rbp),%al
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1050 <ungetc@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_read_space>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <fgetc@plt>
mov    %eax,%ebx
movsbl %al,%edi
call   1040 <isspace@plt>
mov    %rax,%r15
test   %rax,%rax
je     1177 <parse_read_space+0x47>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebx
movsbl %al,%edi
call   1040 <isspace@plt>
test   %rax,%rax
jne    1160 <parse_read_space+0x30>
xor    %ebp,%ebp
test   %r15,%r15
sete   %bpl
movsbl %bl,%edi
mov    %r14,%rsi
call   1050 <ungetc@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @parse_read_space(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i8
store i32* %0, i32** %3
store i8 0, i8* %4
%5 = load i32*, i32** %3
%6 = call signext i8 @fgetc(i32* %5)
store i8 %6, i8* %4
%7 = load i8, i8* %4
%8 = call i64 @isspace(i8 signext %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load i32*, i32** %3
%12 = call i32 @parse_read_space(i32* %11)
store i32 0, i32* %2
br label %17
13: ; preds = %1
%14 = load i8, i8* %4
%15 = load i32*, i32** %3
%16 = call i32 @ungetc(i8 signext %14, i32* %15)
store i32 1, i32* %2
br label %17
17: ; preds = %13, %10
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @parse_read_space(i32* nocapture %0) {
%2 = tail call signext i8 @fgetc(i32* %0)
%3 = tail call i64 @isspace(i8 signext %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %1, %5
%6 = tail call signext i8 @fgetc(i32* %0)
%7 = tail call i64 @isspace(i8 signext %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %5
9: ; preds = %5, %1
%10 = phi i8 [ %2, %1 ], [ %6, %5 ]
%11 = tail call i32 @ungetc(i8 signext %10, i32* %0)
%12 = zext i1 %4 to i32
ret i32 %12
}
/* Variables and functions */
long long slifatorial(int);
unsigned long long ulifatorial(int);
int main() {
  unsigned long long int ulin;
  signed long long int slin;
  ulin = ulifatorial(25);
  ulin = 0;
  slin = slifatorial(25);
  slin = 0;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x19,%edi
call   1040 <ulifatorial@plt>
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x19,%edi
call   1030 <slifatorial@plt>
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x18(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
%4 = call i64 @ulifatorial(i32 25)
store i64 %4, i64* %2
store i64 0, i64* %2
%5 = call i64 @slifatorial(i32 25)
store i64 %5, i64* %3
store i64 0, i64* %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @ulifatorial(i32 25)
%2 = tail call i64 @slifatorial(i32 25)
ret i32 0
}
/* Variables and functions */
int isnvt(unsigned c) { return !(c & (~(size_t)0u << 7)); }


x86 assembly (clang, -O0):
<isnvt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffffffffffffff80,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isnvt>:
xor    %eax,%eax
cmp    $0x80,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @isnvt(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = zext i32 %3 to i64
%5 = and i64 %4, -128
%6 = icmp ne i64 %5, 0
%7 = xor i1 %6, true
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @isnvt(i32 %0) {
%2 = icmp ult i32 %0, 128
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
struct jffs2_raw_dirent {
  int dummy;
};
typedef int /*<<< orphan*/ __u8;
typedef int /*<<< orphan*/ __u32;

/* Variables and functions */
struct jffs2_raw_dirent *resolvedirent(char *, size_t, int /*<<< orphan*/,
                                       int /*<<< orphan*/, char *,
                                       int /*<<< orphan*/);
struct jffs2_raw_dirent *resolvename(char *o, size_t size, __u32 pino,
                                     char *name, __u8 nsize) {
  return resolvedirent(o, size, 0, pino, name, nsize);
}


x86 assembly (clang, -O0):
<resolvename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x24(%rbp),%r9d
xor    %edx,%edx
call   1030 <resolvedirent@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<resolvename>:
mov    %r8d,%r9d
mov    %rcx,%r8
mov    %edx,%ecx
xor    %edx,%edx
jmp    1030 <resolvedirent@plt>

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

LLVM IR (-O2):
%struct.jffs2_raw_dirent = type { i32 }
define %struct.jffs2_raw_dirent* @resolvename(i8* %0, i64 %1, i32 %2, i8* %3, i32 %4) {
%6 = tail call %struct.jffs2_raw_dirent* @resolvedirent(i8* %0, i64 %1, i32 0, i32 %2, i8* %3, i32 %4)
ret %struct.jffs2_raw_dirent* %6
}
void rop3_94_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  unsigned char stk4;
  stk4 = ~*D;
  stk3 = S & stk4;
  stk2 = T | stk3;
  stk1 = *D ^ stk2;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


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

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

LLVM IR (-O0):
define void @rop3_94_1_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = xor i32 %13, -1
%15 = trunc i32 %14 to i8
store i8 %15, i8* %10
%16 = load i8, i8* %5
%17 = zext i8 %16 to i32
%18 = load i8, i8* %10
%19 = zext i8 %18 to i32
%20 = and i32 %17, %19
%21 = trunc i32 %20 to i8
store i8 %21, i8* %9
%22 = load i8, i8* %6
%23 = zext i8 %22 to i32
%24 = load i8, i8* %9
%25 = zext i8 %24 to i32
%26 = or i32 %23, %25
%27 = trunc i32 %26 to i8
store i8 %27, i8* %8
%28 = load i8*, i8** %4
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = load i8, i8* %8
%32 = zext i8 %31 to i32
%33 = xor i32 %30, %32
%34 = trunc i32 %33 to i8
store i8 %34, i8* %7
%35 = load i8, i8* %7
%36 = zext i8 %35 to i32
%37 = load i8, i8* %5
%38 = zext i8 %37 to i32
%39 = xor i32 %38, -1
%40 = and i32 %36, %39
%41 = load i8, i8* %6
%42 = zext i8 %41 to i32
%43 = xor i32 %42, -1
%44 = and i32 %40, %43
%45 = load i8*, i8** %4
%46 = load i8, i8* %45
%47 = zext i8 %46 to i32
%48 = load i8, i8* %5
%49 = zext i8 %48 to i32
%50 = and i32 %47, %49
%51 = or i32 %44, %50
%52 = load i8*, i8** %4
%53 = load i8, i8* %52
%54 = zext i8 %53 to i32
%55 = load i8, i8* %6
%56 = zext i8 %55 to i32
%57 = and i32 %54, %56
%58 = or i32 %51, %57
%59 = trunc i32 %58 to i8
%60 = load i8*, i8** %4
store i8 %59, i8* %60
ret void
}

LLVM IR (-O2):
define void @rop3_94_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
ret void
}
int fun1343() { return 1343; }


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

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

LLVM IR (-O0):
define i32 @fun1343() {
ret i32 1343
}

LLVM IR (-O2):
define i32 @fun1343() {
ret i32 1343
}
int GB_SoundGetClocksToNextEvent(void) {
  int clocks_to_next_event = 0x7FFFFFFF;
  return clocks_to_next_event;
}


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

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

LLVM IR (-O0):
define i32 @GB_SoundGetClocksToNextEvent() {
%1 = alloca i32
store i32 2147483647, i32* %1
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @GB_SoundGetClocksToNextEvent() {
ret i32 2147483647
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int __fetch_number(char *name) {
  fprintf(stderr,
          "ChillLib: fetch_number: no runtime system library linked.\n");
  fflush(stderr);
  abort();
}


x86 assembly (clang, -O0):
<__fetch_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<__fetch_number>:
push   %rbx
mov    0x2ea8(%rip),%rbx
mov    (%rbx),%edi
lea    0xebf(%rip),%rsi
call   1040 <fprintf@plt>
mov    (%rbx),%edi
call   1050 <fflush@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [59 x i8] c"ChillLib: fetch_number: no runtime system library linked.\0A\00"
define i32 @__fetch_number(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = call i32 @fflush(i32 %5)
%7 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [59 x i8] c"ChillLib: fetch_number: no runtime system library linked.\0A\00"
define i32 @__fetch_number(i8* nocapture readnone %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stderr
%5 = tail call i32 @fflush(i32 %4)
%6 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ Free_File(char *);
int /*<<< orphan*/ HeaderReader(char *);
char *Open_FileAlloc(char *);
void ReadAndParseHeaders(char *filename) {
  char *file = Open_FileAlloc(filename);
  if (!file)
    return;
  HeaderReader(file);
  Free_File(file);
}


x86 assembly (clang, -O0):
<ReadAndParseHeaders>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <Open_FileAlloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1159 <ReadAndParseHeaders+0x29>
jmp    116b <ReadAndParseHeaders+0x3b>
mov    -0x10(%rbp),%rdi
call   1030 <HeaderReader@plt>
mov    -0x10(%rbp),%rdi
call   1050 <Free_File@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadAndParseHeaders>:
push   %rbx
call   1040 <Open_FileAlloc@plt>
test   %rax,%rax
je     114f <ReadAndParseHeaders+0x1f>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <HeaderReader@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <Free_File@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @ReadAndParseHeaders(i8* %0) {
%2 = tail call i8* @Open_FileAlloc(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @HeaderReader(i8* %2)
%6 = tail call i32 @Free_File(i8* %2)
br label %7
7: ; preds = %1, %4
ret void
}
/* Variables and functions */
bool isPowerOfThree0(int n) {
  long a = 1;
  while (a <= n) {
    if (a == n)
      return true;
    a *= 3;
  }
  return false;
}


x86 assembly (clang, -O0):
<isPowerOfThree0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movq   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
cmp    %rcx,%rax
jg     114b <isPowerOfThree0+0x4b>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
cmp    %rcx,%rax
jne    113d <isPowerOfThree0+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    1152 <isPowerOfThree0+0x52>
imul   $0x3,-0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    110f <isPowerOfThree0+0xf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPowerOfThree0>:
xor    %eax,%eax
test   %edi,%edi
jle    111e <isPowerOfThree0+0x1e>
movslq %edi,%rcx
mov    $0x1,%edx
xchg   %ax,%ax
cmp    %rcx,%rdx
je     111f <isPowerOfThree0+0x1f>
lea    (%rdx,%rdx,2),%rdx
cmp    %rcx,%rdx
jle    1110 <isPowerOfThree0+0x10>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @isPowerOfThree0(i32 %0) {
%2 = sext i32 %0 to i64
%3 = icmp slt i32 %0, 1
br i1 %3, label %10, label %4
4: ; preds = %1, %7
%5 = phi i64 [ %8, %7 ], [ 1, %1 ]
%6 = icmp eq i64 %5, %2
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = mul nsw i64 %5, 3
%9 = icmp sgt i64 %8, %2
br i1 %9, label %10, label %4
10: ; preds = %4, %7, %1
%11 = phi i32 [ 0, %1 ], [ 0, %7 ], [ 1, %4 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ hello();
int /*<<< orphan*/ send(char *);
int main(void) {
  send("Hello, world\n");
  hello();
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [14 x i8] c"Hello, world\0A\00"
define i32 @main() {
%1 = tail call i32 @send(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @hello()
ret i32 0
}
/* Variables and functions */
double log(double);
double sqrt(double);
double efunc(double x) { return log(x) / sqrt(x); }


x86 assembly (clang, -O0):
<efunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<efunc>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <log@plt>
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
movsd  (%rsp),%xmm2
ucomisd %xmm0,%xmm2
movapd %xmm2,%xmm0
jb     1148 <efunc+0x28>
sqrtsd %xmm0,%xmm0
jmp    1157 <efunc+0x37>
movsd  %xmm1,(%rsp)
call   1040 <sqrt@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @efunc(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @log(double %3)
%5 = load double, double* %2
%6 = call double @sqrt(double %5)
%7 = fdiv double %4, %6
ret double %7
}

LLVM IR (-O2):
define double @efunc(double %0) {
%2 = tail call double @log(double %0)
%3 = tail call double @sqrt(double %0)
%4 = fdiv double %2, %3
ret double %4
}
/* Variables and functions */
int rdtscp(int /*<<< orphan*/ *);
int f1() { return (rdtscp(NULL) & 1); }


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1030 <rdtscp@plt>
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
push   %rax
xor    %edi,%edi
call   1030 <rdtscp@plt>
and    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @f1() {
%1 = call i32 @rdtscp(i32* null)
%2 = and i32 %1, 1
ret i32 %2
}

LLVM IR (-O2):
define i32 @f1() {
%1 = tail call i32 @rdtscp(i32* null)
%2 = and i32 %1, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("this is cmd3!\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"this is cmd3!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
unsigned int getword(unsigned char *base) { return base[0] + (base[1] * 256); }


x86 assembly (clang, -O0):
<getword>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getword>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @getword(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = mul nsw i32 %10, 256
%12 = add nsw i32 %6, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @getword(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl nuw nsw i32 %6, 8
%8 = or i32 %7, %3
ret i32 %8
}
void f(void) { __attribute__((used)) int local_var; }


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

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

LLVM IR (-O0):
define void @f() {
%1 = alloca i32
ret void
}

LLVM IR (-O2):
define void @f() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glPopClientAttrib();
void PopClientAttrib(void) { glPopClientAttrib(); }


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

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

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

LLVM IR (-O2):
define void @PopClientAttrib() {
%1 = tail call i32 (...) @glPopClientAttrib()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
float sqrtf(int /*<<< orphan*/);
int /*<<< orphan*/ stdlib_strided_svariancepn(int /*<<< orphan*/ const,
                                              float const, float const *,
                                              int /*<<< orphan*/ const);
float stdlib_strided_sstdevpn(const int64_t N, const float correction,
                              const float *X, const int64_t stride) {
  return sqrtf(stdlib_strided_svariancepn(N, correction, X, stride));
}


x86 assembly (clang, -O0):
<stdlib_strided_sstdevpn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
movss  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <stdlib_strided_svariancepn@plt>
mov    %eax,%edi
call   1040 <sqrtf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdlib_strided_sstdevpn>:
push   %rax
call   1030 <stdlib_strided_svariancepn@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <sqrtf@plt>

LLVM IR (-O0):
define float @stdlib_strided_sstdevpn(i32 %0, float %1, float* %2, i32 %3) {
%5 = alloca i32
%6 = alloca float
%7 = alloca float*
%8 = alloca i32
store i32 %0, i32* %5
store float %1, float* %6
store float* %2, float** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load float, float* %6
%11 = load float*, float** %7
%12 = load i32, i32* %8
%13 = call i32 @stdlib_strided_svariancepn(i32 %9, float %10, float* %11, i32 %12)
%14 = call float @sqrtf(i32 %13)
ret float %14
}

LLVM IR (-O2):
define float @stdlib_strided_sstdevpn(i32 %0, float %1, float* %2, i32 %3) {
%5 = tail call i32 @stdlib_strided_svariancepn(i32 %0, float %1, float* %2, i32 %3)
%6 = tail call float @sqrtf(i32 %5)
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *xmalloc(size_t, char const *);
void *xcmalloc(size_t size, const char *name) {
  void *buf;
  buf = xmalloc(size, name);
  memset(buf, 0, size);
  return buf;
}


x86 assembly (clang, -O0):
<xcmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <xmalloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcmalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @xcmalloc(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i8*
store i64 %0, i64* %3
store i8* %1, i8** %4
%6 = load i64, i64* %3
%7 = load i8*, i8** %4
%8 = call i8* @xmalloc(i64 %6, i8* %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = load i64, i64* %3
%11 = call i32 @memset(i8* %9, i32 0, i64 %10)
%12 = load i8*, i8** %5
ret i8* %12
}

LLVM IR (-O2):
define i8* @xcmalloc(i64 %0, i8* %1) {
%3 = tail call i8* @xmalloc(i64 %0, i8* %1)
%4 = tail call i32 @memset(i8* %3, i32 0, i64 %0)
ret i8* %3
}
int sys_dlclose(void *handle) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @sys_dlclose(i8* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int stat(const char *path, struct stat *buf) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<stat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ed5(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebc(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stat>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @stat(i8* %0, %struct.stat* %1) {
%3 = alloca i8*
%4 = alloca %struct.stat*
store i8* %0, i8** %3
store %struct.stat* %1, %struct.stat** %4
%5 = load i32, i32* @ENOSYS
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @stat(i8* nocapture readnone %0, %struct.stat* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i32 -1
}
int flood_between(float a, int npar, void *par) {
  double thres0, thres1;
  thres0 = ((double *)par)[0];
  thres1 = ((double *)par)[1];
  return (a > thres0) && (a < thres1);
}


x86 assembly (clang, -O0):
<flood_between>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xor    %eax,%eax
ucomisd -0x18(%rbp),%xmm0
mov    %al,-0x21(%rbp)
jbe    115c <flood_between+0x5c>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flood_between>:
movsd  0x8(%rsi),%xmm1
cvtss2sd %xmm0,%xmm0
ucomisd (%rsi),%xmm0
seta   %al
ucomisd %xmm0,%xmm1
seta   %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @flood_between(float %0, i32 %1, i8* %2) {
%4 = alloca float
%5 = alloca i32
%6 = alloca i8*
%7 = alloca double
%8 = alloca double
store float %0, float* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = load i8*, i8** %6
%10 = bitcast i8* %9 to double*
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
store double %12, double* %7
%13 = load i8*, i8** %6
%14 = bitcast i8* %13 to double*
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
store double %16, double* %8
%17 = load float, float* %4
%18 = fpext float %17 to double
%19 = load double, double* %7
%20 = fcmp ogt double %18, %19
br i1 %20, label %21, label %26
21: ; preds = %3
%22 = load float, float* %4
%23 = fpext float %22 to double
%24 = load double, double* %8
%25 = fcmp olt double %23, %24
br label %26
26: ; preds = %21, %3
%27 = phi i1 [ false, %3 ], [ %25, %21 ]
%28 = zext i1 %27 to i32
ret i32 %28
}

LLVM IR (-O2):
define i32 @flood_between(float %0, i32 %1, i8* nocapture %2) {
%4 = bitcast i8* %2 to double*
%5 = load double, double* %4
%6 = getelementptr inbounds i8, i8* %2, i64 8
%7 = bitcast i8* %6 to double*
%8 = load double, double* %7
%9 = fpext float %0 to double
%10 = fcmp olt double %5, %9
%11 = fcmp ogt double %8, %9
%12 = select i1 %10, i1 %11, i1 false
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
main() {
  int i, k;
  i = 10;
  k = ++i + i;
  printf("\n%d", k);
}


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"\0A%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 10, i32* %1
%3 = load i32, i32* %1
%4 = add nsw i32 %3, 1
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = add nsw i32 %4, %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):
@.str = [4 x i8] c"\0A%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 22)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello from prog2.c\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [19 x i8] c"Hello from prog2.c\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int console_read(char *buf) {
  int retval;
  __asm__("int $0x80      \n\t"
          "mov %%eax, %0"
          : "=m"(retval)
          : "a"(5), "b"(buf)
          : "memory");
  return retval;
}


x86 assembly (clang, -O0):
<console_read>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rbx
mov    $0x5,%eax
int    $0x80
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<console_read>:
push   %rbx
mov    %rdi,%rbx
mov    $0x5,%eax
int    $0x80
mov    %eax,-0x4(%rsp)
mov    -0x4(%rsp),%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @console_read(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* %2
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
void write_whole_file(const char *filename, char *file_contents, int filesize) {
  FILE *new_file = fopen(filename, "wb");
  fwrite(file_contents, sizeof(char), filesize, new_file);
  fclose(new_file);
}


x86 assembly (clang, -O0):
<write_whole_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1050 <fwrite@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_whole_file>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
lea    0xebf(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14d,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
mov    %rbp,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"wb\00"
define void @write_whole_file(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %9, i32** %7
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = load i32*, i32** %7
%13 = call i32 @fwrite(i8* %10, i32 1, i32 %11, i32* %12)
%14 = load i32*, i32** %7
%15 = call i32 @fclose(i32* %14)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"wb\00"
define void @write_whole_file(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @fwrite(i8* %1, i32 1, i32 %2, i32* %4)
%6 = tail call i32 @fclose(i32* %4)
ret void
}
/* Variables and functions */
scalar_t__ strtoll(char const *, char **, int);
unsigned long int strtoul(const char *nptr, char **endptr, int base) {
  return (unsigned long int)strtoll(nptr, endptr, base);
}


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

x86 assembly (clang, -O2):
<strtoul>:
jmp    1030 <strtoll@plt>

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

LLVM IR (-O2):
define i64 @strtoul(i8* %0, i8** nocapture %1, i32 %2) {
%4 = tail call i64 @strtoll(i8* %0, i8** %1, i32 %2)
ret i64 %4
}
void atexit_flush_files(void) {}


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

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

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

LLVM IR (-O2):
define void @atexit_flush_files() {
ret void
}
/* Variables and functions */
unsigned int S(unsigned int const *, int);
unsigned int Sum0(const unsigned int *x) {
  return S(x, 2) ^ S(x, 13) ^ S(x, 22);
}


x86 assembly (clang, -O0):
<Sum0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1030 <S@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xd,%esi
call   1030 <S@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
xor    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x16,%esi
call   1030 <S@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
xor    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sum0>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    $0x2,%esi
call   1030 <S@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
mov    $0xd,%esi
call   1030 <S@plt>
mov    %eax,%ebp
xor    %r14d,%ebp
mov    %rbx,%rdi
mov    $0x16,%esi
call   1030 <S@plt>
xor    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @Sum0(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @S(i32* %3, i32 2)
%5 = load i32*, i32** %2
%6 = call i32 @S(i32* %5, i32 13)
%7 = xor i32 %4, %6
%8 = load i32*, i32** %2
%9 = call i32 @S(i32* %8, i32 22)
%10 = xor i32 %7, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @Sum0(i32* %0) {
%2 = tail call i32 @S(i32* %0, i32 2)
%3 = tail call i32 @S(i32* %0, i32 13)
%4 = xor i32 %3, %2
%5 = tail call i32 @S(i32* %0, i32 22)
%6 = xor i32 %4, %5
ret i32 %6
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ fatal(char *);
void *ec_calloc(size_t nmemb, size_t size) {
  void *ptr;
  ptr = calloc(nmemb, size);
  if (ptr == NULL) {
    fatal("in ec_calloc() on memory allocation.\n");
  }
  return ptr;
}


x86 assembly (clang, -O0):
<ec_calloc>:
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   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1158 <ec_calloc+0x38>
lea    0xead(%rip),%rdi
call   1040 <fatal@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [38 x i8] c"in ec_calloc() on memory allocation.\0A\00"
define i8* @ec_calloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i8* @calloc(i64 %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 %13
11: ; preds = %2
%12 = call i32 @fatal(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
%14 = load i8*, i8** %5
ret i8* %14
}

LLVM IR (-O2):
@.str = [38 x i8] c"in ec_calloc() on memory allocation.\0A\00"
define noalias i8* @ec_calloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @fatal(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void *qc_nonull_impl(void *ptr) {
  if (!ptr)
    abort();
  return ptr;
}


x86 assembly (clang, -O0):
<qc_nonull_impl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112e <qc_nonull_impl+0x1e>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qc_nonull_impl>:
test   %rdi,%rdi
je     1119 <qc_nonull_impl+0x9>
mov    %rdi,%rax
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define i8* @qc_nonull_impl(i8* readnone returned %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
ret i8* %0
}
void rop3_144_0_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = *D ^ S;
  stk2 = ~stk2;
  stk1 = T & stk2;
  *D = (stk1 & S) | (stk1 & (~T)) | (T & (~S) & *D);
}


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

x86 assembly (clang, -O2):
<rop3_144_0_1>:
mov    (%rdi),%r8b
mov    %r8d,%ecx
xor    %sil,%cl
not    %cl
mov    %edx,%eax
and    %sil,%al
and    %cl,%al
not    %sil
and    %dl,%sil
and    %r8b,%sil
or     %al,%sil
mov    %sil,(%rdi)
ret

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

LLVM IR (-O2):
define void @rop3_144_0_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = xor i8 %4, %1
%6 = xor i8 %5, -1
%7 = and i8 %2, %1
%8 = and i8 %7, %6
%9 = xor i8 %1, -1
%10 = and i8 %9, %2
%11 = and i8 %10, %4
%12 = or i8 %8, %11
store i8 %12, i8* %0
ret void
}
imm0regx1(r0, r1, x0, x1, p0, p1) int r0, r1;
int *p0, *p1;
{
  if (22 <= (p1[x1]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<imm0regx1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x28(%rbp),%rcx
movslq -0x14(%rbp),%rdx
mov    $0x16,%eax
cmp    (%rcx,%rdx,4),%eax
jg     113a <imm0regx1+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    1141 <imm0regx1+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<imm0regx1>:
movslq %ecx,%rcx
xor    %eax,%eax
cmpl   $0x16,(%r9,%rcx,4)
setge  %al
ret

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

LLVM IR (-O2):
define i32 @imm0regx1(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture readnone %4, i32* nocapture %5) {
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
%10 = icmp sgt i32 %9, 21
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int stat(char const *, struct stat *);
int omb_utils_file_exists(const char *filename) {
  struct stat st;
  int result = stat(filename, &st);
  return result == 0;
}


x86 assembly (clang, -O0):
<omb_utils_file_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <stat@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<omb_utils_file_exists>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @omb_utils_file_exists(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @stat(i8* %5, %struct.stat* %3)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @omb_utils_file_exists(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
void ASMAtomicXchgU64(void) {}


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

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

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

LLVM IR (-O2):
define void @ASMAtomicXchgU64() {
ret void
}
/* Variables and functions */
scalar_t__ nrand(int);
int rand(void) { return (int)nrand(32768); }


x86 assembly (clang, -O0):
<rand>:
push   %rbp
mov    %rsp,%rbp
mov    $0x8000,%edi
call   1030 <nrand@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand>:
mov    $0x8000,%edi
jmp    1030 <nrand@plt>

LLVM IR (-O0):
define i32 @rand() {
%1 = call i64 @nrand(i32 32768)
%2 = trunc i64 %1 to i32
ret i32 %2
}

LLVM IR (-O2):
define i32 @rand() {
%1 = tail call i64 @nrand(i32 32768)
%2 = trunc i64 %1 to i32
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ X509_VAL;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
int /*<<< orphan*/ ASN1_item_free(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ X509_VAL_it;
void X509_VAL_free(X509_VAL *a) {
  ASN1_item_free((ASN1_VALUE *)a, &X509_VAL_it);
}


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

x86 assembly (clang, -O2):
<X509_VAL_free>:
mov    0x2ed1(%rip),%rsi
jmp    1030 <ASN1_item_free@plt>

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

LLVM IR (-O2):
@X509_VAL_it = global i32 0
define void @X509_VAL_free(i32* %0) {
%2 = tail call i32 @ASN1_item_free(i32* %0, i32* @X509_VAL_it)
ret void
}
const char *TestFunction() { return "Hello from the DLL\n"; }


x86 assembly (clang, -O0):
<TestFunction>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestFunction>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Hello from the DLL\0A\00"
define i8* @TestFunction() {
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [20 x i8] c"Hello from the DLL\0A\00"
define i8* @TestFunction() {
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0)
}