xunge/DecIR huggingface dataset:
/* Variables and functions */
int cu2ho(double *, double *, int);
int ho2om(double *, double *, int);
int cu2om(double *cu, double *om, int p) {
  double ho[3];
  int trash;
  trash = cu2ho(cu, ho, p);
  trash = ho2om(ho, om, p);
  return 1;
}


x86 assembly (clang, -O0):
<cu2om>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <cu2ho@plt>
mov    %eax,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <ho2om@plt>
mov    %eax,-0x34(%rbp)
mov    $0x1,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cu2om>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rsp,%r15
mov    %r15,%rsi
call   1040 <cu2ho@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1030 <ho2om@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @cu2om(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca [3 x double]
%8 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
%9 = load double*, double** %4
%10 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%11 = load i32, i32* %6
%12 = call i32 @cu2ho(double* %9, double* %10, i32 %11)
store i32 %12, i32* %8
%13 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%14 = load double*, double** %5
%15 = load i32, i32* %6
%16 = call i32 @ho2om(double* %13, double* %14, i32 %15)
store i32 %16, i32* %8
ret i32 1
}

LLVM IR (-O2):
define i32 @cu2om(double* %0, double* %1, i32 %2) {
%4 = alloca [3 x double]
%5 = bitcast [3 x double]* %4 to i8*
%6 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%7 = call i32 @cu2ho(double* %0, double* %6, i32 %2)
%8 = call i32 @ho2om(double* %6, double* %1, i32 %2)
ret i32 1
}
void c99_bool_test(void) {}


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

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

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

LLVM IR (-O2):
define void @c99_bool_test() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cave_set_feat_aux(int, int, int);
void reapply_tree(int y, int x, int r) { cave_set_feat_aux(y, x, r); }


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

x86 assembly (clang, -O2):
<reapply_tree>:
jmp    1030 <cave_set_feat_aux@plt>

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

LLVM IR (-O2):
define void @reapply_tree(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @cave_set_feat_aux(i32 %0, i32 %1, i32 %2)
ret void
}
int test_02(unsigned short x) { return x & -129 ? -20 : -40; }


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

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

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

LLVM IR (-O2):
define i32 @test_02(i16 zeroext %0) {
%2 = and i16 %0, -129
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
typedef scalar_t__ gid_t;

/* Variables and functions */
int uid_is_container(int /*<<< orphan*/);
bool gid_is_container(gid_t gid) { return uid_is_container((uid_t)gid); }


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

x86 assembly (clang, -O2):
<gid_is_container>:
jmp    1030 <uid_is_container@plt>

LLVM IR (-O0):
define i32 @gid_is_container(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = call i32 @uid_is_container(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @gid_is_container(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = tail call i32 @uid_is_container(i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ SIGFPE;
int /*<<< orphan*/ raise(int /*<<< orphan*/);
void testThree(void) { raise(SIGFPE); }


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

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

LLVM IR (-O0):
@SIGFPE = global i32 0
define void @testThree() {
%1 = load i32, i32* @SIGFPE
%2 = call i32 @raise(i32 %1)
ret void
}

LLVM IR (-O2):
@SIGFPE = global i32 0
define void @testThree() {
%1 = load i32, i32* @SIGFPE
%2 = tail call i32 @raise(i32 %1)
ret void
}
/* Type definitions */
struct dnaSeq {
  int dummy;
};

/* Variables and functions */
struct dnaSeq *faReadSeq(char *, int);
struct dnaSeq *faReadDna(char *fileName) {
  return faReadSeq(fileName, 1);
}


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

x86 assembly (clang, -O2):
<faReadDna>:
mov    $0x1,%esi
jmp    1030 <faReadSeq@plt>

LLVM IR (-O0):
%struct.dnaSeq = type { i32 }
define %struct.dnaSeq* @faReadDna(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call %struct.dnaSeq* @faReadSeq(i8* %3, i32 1)
ret %struct.dnaSeq* %4
}

LLVM IR (-O2):
%struct.dnaSeq = type { i32 }
define %struct.dnaSeq* @faReadDna(i8* %0) {
%2 = tail call %struct.dnaSeq* @faReadSeq(i8* %0, i32 1)
ret %struct.dnaSeq* %2
}
/* Variables and functions */
int /*<<< orphan*/ print_logarithm(double);
int main() {
  print_logarithm(0.0);
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @print_logarithm(double 0.000000e+00)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @print_logarithm(double 0.000000e+00)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int);
void die(const char *msg, int err) {
  if (err == 0)
    err = errno;
  fprintf(stderr, "%s: %s\n", msg, strerror(err));
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1155 <die+0x25>
mov    0x2e88(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    0x2e84(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rdx
mov    %rax,%rcx
lea    0xe7e(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
test   %esi,%esi
jne    1143 <die+0x13>
mov    0x2e97(%rip),%rax
mov    (%rax),%esi
mov    0x2e96(%rip),%rax
mov    (%rax),%ebp
mov    %esi,%edi
call   1050 <strerror@plt>
lea    0xea6(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1030 <fprintf@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@errno = global i32 0
@stderr = global i32 0
@.str = [8 x i8] c"%s: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @die(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load i32, i32* @errno
store i32 %8, i32* %4
br label %9
9: ; preds = %7, %2
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = call i8* @strerror(i32 %12)
%14 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %13)
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
}

LLVM IR (-O2):
@errno = global i32 0
@stderr = global i32 0
@.str = [8 x i8] c"%s: %s\0A\00"
@EXIT_FAILURE = global i32 0
define void @die(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = load i32, i32* @errno
%5 = select i1 %3, i32 %4, i32 %1
%6 = load i32, i32* @stderr
%7 = tail call i8* @strerror(i32 %5)
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %7)
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
}
int checkBinary(int y) {
  int check = 0;
  int x = y;
  while (x > 10) {
    x = x % 10;
  }
  if (x == 1 || x == 0) {
    check = 1;
  }
  return check;
}


x86 assembly (clang, -O0):
<checkBinary>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jle    1131 <checkBinary+0x31>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
jmp    1114 <checkBinary+0x14>
cmpl   $0x1,-0xc(%rbp)
je     1145 <checkBinary+0x45>
cmpl   $0x0,-0xc(%rbp)
jne    114c <checkBinary+0x4c>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkBinary>:
cmp    $0xb,%edi
jl     111b <checkBinary+0x1b>
mov    %edi,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x23,%rcx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%eax
sub    %eax,%edi
xor    %eax,%eax
cmp    $0x2,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @checkBinary(i32 %0) {
%2 = icmp sgt i32 %0, 10
%3 = urem i32 %0, 10
%4 = select i1 %2, i32 %3, i32 %0
%5 = icmp ult i32 %4, 2
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ myprint(char *, ...);
void test() {
  myprint("i=%d\n", 6);
  myprint("i=%s\n", 6);
  myprint("i=%s\n", "abc");
  myprint("%s,%d,%d\n", 1, 2);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x6,%esi
mov    $0x0,%al
call   1030 <myprint@plt>
lea    0xed8(%rip),%rdi
mov    $0x6,%esi
mov    $0x0,%al
call   1030 <myprint@plt>
lea    0xec5(%rip),%rdi
lea    0xec4(%rip),%rsi
mov    $0x0,%al
call   1030 <myprint@plt>
lea    0xeba(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x0,%al
call   1030 <myprint@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rbx
lea    0xee8(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <myprint@plt>
lea    0xedb(%rip),%rbx
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1030 <myprint@plt>
lea    0xecb(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <myprint@plt>
lea    0xebe(%rip),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
xor    %eax,%eax
pop    %rbx
jmp    1030 <myprint@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"i=%d\0A\00"
@.str.1 = [6 x i8] c"i=%s\0A\00"
@.str.2 = [4 x i8] c"abc\00"
@.str.3 = [10 x i8] c"%s,%d,%d\0A\00"
define void @test() {
%1 = call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 6)
%2 = call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 6)
%3 = call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 2)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"i=%d\0A\00"
@.str.1 = [6 x i8] c"i=%s\0A\00"
@.str.2 = [4 x i8] c"abc\00"
@.str.3 = [10 x i8] c"%s,%d,%d\0A\00"
define void @test() {
%1 = tail call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 6)
%2 = tail call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 6)
%3 = tail call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @myprint(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 2)
ret void
}
int fun905() { return 905; }


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

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

LLVM IR (-O0):
define i32 @fun905() {
ret i32 905
}

LLVM IR (-O2):
define i32 @fun905() {
ret i32 905
}
/* Variables and functions */
int anetWriteWidthType(int, char *, int, int /*<<< orphan*/,
                       int /*<<< orphan*/);
int catAnetNoBlockWrite(int fd, char *buf, int count) {
  return anetWriteWidthType(fd, buf, count, 0, 0);
}


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

x86 assembly (clang, -O2):
<catAnetNoBlockWrite>:
xor    %ecx,%ecx
xor    %r8d,%r8d
jmp    1030 <anetWriteWidthType@plt>

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

LLVM IR (-O2):
define i32 @catAnetNoBlockWrite(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @anetWriteWidthType(i32 %0, i8* %1, i32 %2, i32 0, i32 0)
ret i32 %4
}
/* Type definitions */
struct locale {
  int dummy;
};

/* Variables and functions */
struct locale *get_locale(char const *);
char const *locale_getstring(struct locale *, char const *);
const char *locale_get(const char *lang, const char *key) {
  struct locale *loc = get_locale(lang);
  if (loc) {
    return locale_getstring(loc, key);
  }
  return 0;
}


x86 assembly (clang, -O0):
<locale_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <get_locale@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     115e <locale_get+0x3e>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <locale_getstring@plt>
mov    %rax,-0x8(%rbp)
jmp    1166 <locale_get+0x46>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<locale_get>:
push   %rbx
mov    %rsi,%rbx
call   1040 <get_locale@plt>
test   %rax,%rax
je     113a <locale_get+0x1a>
mov    %rax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <locale_getstring@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.locale = type { i32 }
define i8* @locale_get(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca %struct.locale*
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = call %struct.locale* @get_locale(i8* %7)
store %struct.locale* %8, %struct.locale** %6
%9 = load %struct.locale*, %struct.locale** %6
%10 = icmp ne %struct.locale* %9, null
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load %struct.locale*, %struct.locale** %6
%13 = load i8*, i8** %5
%14 = call i8* @locale_getstring(%struct.locale* %12, i8* %13)
store i8* %14, i8** %3
br label %16
15: ; preds = %2
store i8* null, i8** %3
br label %16
16: ; preds = %15, %11
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
%struct.locale = type { i32 }
define i8* @locale_get(i8* %0, i8* %1) {
%3 = tail call %struct.locale* @get_locale(i8* %0)
%4 = icmp eq %struct.locale* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i8* @locale_getstring(%struct.locale* %3, i8* %1)
br label %7
7: ; preds = %2, %5
%8 = phi i8* [ %6, %5 ], [ null, %2 ]
ret i8* %8
}
void MUSIC_StopFade(void) {}


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

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

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

LLVM IR (-O2):
define void @MUSIC_StopFade() {
ret void
}
/* Variables and functions */
unsigned long long strtol(char const *, char **, int);
unsigned long long strtoull(const char *nptr, char **endptr, int base) {
  return strtol(nptr, endptr, base);
}


x86 assembly (clang, -O0):
<strtoull>:
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 <strtol@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtoull>:
jmp    1030 <strtol@plt>

LLVM IR (-O0):
define i64 @strtoull(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 @strtol(i8* %7, i8** %8, i32 %9)
ret i64 %10
}

LLVM IR (-O2):
define i64 @strtoull(i8* %0, i8** nocapture %1, i32 %2) {
%4 = tail call i64 @strtol(i8* %0, i8** %1, i32 %2)
ret i64 %4
}
int main(void) {
  int a = ((sizeof(int) + sizeof(16)) + sizeof(0));
  return a;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 12, i32* %2
%3 = load i32, i32* %2
ret i32 %3
}

LLVM IR (-O2):
define i32 @main() {
ret i32 12
}
/* Type definitions */
struct ProxySettings {
  int dummy;
};

/* Variables and functions */
struct ProxySettings *processArgs(int, char **);
int /*<<< orphan*/ runProxy(struct ProxySettings const *);
int /*<<< orphan*/ setupInitialPledge();
int /*<<< orphan*/ setupRunLoopPledge();
int /*<<< orphan*/ setupSignals();
int main(int argc, char **argv) {
  const struct ProxySettings *proxySettings;
  setupInitialPledge();
  setupSignals();
  proxySettings = processArgs(argc, argv);
  setupRunLoopPledge();
  runProxy(proxySettings);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <setupInitialPledge@plt>
mov    $0x0,%al
call   1070 <setupSignals@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <processArgs@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1060 <setupRunLoopPledge@plt>
mov    -0x18(%rbp),%rdi
call   1030 <runProxy@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1050 <setupInitialPledge@plt>
xor    %eax,%eax
call   1070 <setupSignals@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <processArgs@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <setupRunLoopPledge@plt>
mov    %rbx,%rdi
call   1030 <runProxy@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.ProxySettings = type { i32 }
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.ProxySettings*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @setupInitialPledge()
%8 = call i32 (...) @setupSignals()
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call %struct.ProxySettings* @processArgs(i32 %9, i8** %10)
store %struct.ProxySettings* %11, %struct.ProxySettings** %6
%12 = call i32 (...) @setupRunLoopPledge()
%13 = load %struct.ProxySettings*, %struct.ProxySettings** %6
%14 = call i32 @runProxy(%struct.ProxySettings* %13)
ret i32 0
}

LLVM IR (-O2):
%struct.ProxySettings = type { i32 }
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (...) @setupInitialPledge()
%4 = tail call i32 (...) @setupSignals()
%5 = tail call %struct.ProxySettings* @processArgs(i32 %0, i8** %1)
%6 = tail call i32 (...) @setupRunLoopPledge()
%7 = tail call i32 @runProxy(%struct.ProxySettings* %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
int main() {
  int i = 0;
  switch (i) {
  case 0:
    i = 1;
    break;
  case 1:
    i = 2;
    break;
  default:
    break;
  }
  switch (i) {
  case 0:
    i = 1;
    break;
  case 1:
    i = 2;
  default:
    break;
  }
  switch (i) {
  case 1:
  case 2:
    i = 11;
  case 3:
  case 4:
    i = 99;
  }
  foo(1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     114a <main+0x3a>
jmp    1139 <main+0x29>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
je     1156 <main+0x46>
jmp    1162 <main+0x52>
movl   $0x1,-0x8(%rbp)
jmp    1167 <main+0x57>
movl   $0x2,-0x8(%rbp)
jmp    1167 <main+0x57>
jmp    1167 <main+0x57>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     118b <main+0x7b>
jmp    117a <main+0x6a>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     1197 <main+0x87>
jmp    119e <main+0x8e>
movl   $0x1,-0x8(%rbp)
jmp    11a3 <main+0x93>
movl   $0x2,-0x8(%rbp)
jmp    11a3 <main+0x93>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
add    $0xffffffff,%eax
sub    $0x2,%eax
jb     11ce <main+0xbe>
jmp    11ba <main+0xaa>
mov    -0x14(%rbp),%eax
add    $0xfffffffd,%eax
sub    $0x2,%eax
jb     11d5 <main+0xc5>
jmp    11dc <main+0xcc>
movl   $0xb,-0x8(%rbp)
movl   $0x63,-0x8(%rbp)
mov    $0x1,%edi
call   1030 <foo@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %6 [
i32 0, label %4
i32 1, label %5
]
4: ; preds = %0
store i32 1, i32* %2
br label %7
5: ; preds = %0
store i32 2, i32* %2
br label %7
6: ; preds = %0
br label %7
7: ; preds = %6, %5, %4
%8 = load i32, i32* %2
switch i32 %8, label %11 [
i32 0, label %9
i32 1, label %10
]
9: ; preds = %7
store i32 1, i32* %2
br label %12
10: ; preds = %7
store i32 2, i32* %2
br label %11
11: ; preds = %7, %10
br label %12
12: ; preds = %11, %9
%13 = load i32, i32* %2
switch i32 %13, label %16 [
i32 1, label %14
i32 2, label %14
i32 3, label %15
i32 4, label %15
]
14: ; preds = %12, %12
store i32 11, i32* %2
br label %15
15: ; preds = %12, %12, %14
store i32 99, i32* %2
br label %16
16: ; preds = %15, %12
%17 = call i32 @foo(i32 1)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ upse_r3000_cpu_execute();
void upse_execute(void) {
  {};
  upse_r3000_cpu_execute();
  {};
}


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

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

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

LLVM IR (-O2):
define void @upse_execute() {
%1 = tail call i32 (...) @upse_r3000_cpu_execute()
ret void
}
/* Type definitions */
struct stat {
  int st_size;
};
typedef int off_t;

/* Variables and functions */
scalar_t__ stat(char const *, struct stat *);
off_t file_size(const char *filename) {
  struct stat st;
  if (stat(filename, &st) == 0)
    return st.st_size;
  do {
  } while (0);
  return -1;
}


x86 assembly (clang, -O0):
<file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jne    113e <file_size+0x2e>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114f <file_size+0x3f>
jmp    1143 <file_size+0x33>
jmp    1148 <file_size+0x38>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_size>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
neg    %rax
sbb    %eax,%eax
or     (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @file_size(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%10 = load i32, i32* %9
store i32 %10, i32* %2
br label %14
11: ; preds = %1
br label %12
12: ; preds = %11
br label %13
13: ; preds = %12
store i32 -1, i32* %2
br label %14
14: ; preds = %13, %8
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @file_size(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = select i1 %5, i32 %7, i32 -1
ret i32 %8
}
int ls_costN_nm10_n_in(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @ls_costN_nm10_n_in() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void il_parent(int pid) {
  printf("parent: I'm the parent\n");
  sleep(10);
  printf("parent: exiting\n");
}


x86 assembly (clang, -O0):
<il_parent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    $0xa,%edi
call   1040 <sleep@plt>
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<il_parent>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xa,%edi
call   1040 <sleep@plt>
lea    0xed9(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"parent: I'm the parent\0A\00"
@.str.1 = [17 x i8] c"parent: exiting\0A\00"
define void @il_parent(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @sleep(i32 10)
%5 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [23 x i8] c"parent: I'm the parent\00"
@str.2 = [16 x i8] c"parent: exiting\00"
define void @il_parent(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @sleep(i32 10)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit_msg(char *, char const *, char const *, int);
void *realloc(void *, size_t);
void *_realloc_w(void *buf, size_t size, const char *caller, const char *file,
                 int line) {
  void *buffer;
  buffer = realloc(buf, size);
  if (!buffer)
    exit_msg("Failed to allocate memory in %s() %s:%d", caller, file, line);
  ;
  return buffer;
}


x86 assembly (clang, -O0):
<_realloc_w>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    116f <_realloc_w+0x4f>
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
lea    0xe96(%rip),%rdi
call   1040 <exit_msg@plt>
mov    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_realloc_w>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%r14d
mov    %rcx,%r15
mov    %rdx,%rbp
call   1030 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1152 <_realloc_w+0x32>
lea    0xebc(%rip),%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1040 <exit_msg@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Failed to allocate memory in %s() %s:%d\00"
define i8* @_realloc_w(i8* %0, i64 %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
store i8* %0, i8** %6
store i64 %1, i64* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%12 = load i8*, i8** %6
%13 = load i64, i64* %7
%14 = call i8* @realloc(i8* %12, i64 %13)
store i8* %14, i8** %11
%15 = load i8*, i8** %11
%16 = icmp ne i8* %15, null
br i1 %16, label %22, label %17
17: ; preds = %5
%18 = load i8*, i8** %8
%19 = load i8*, i8** %9
%20 = load i32, i32* %10
%21 = call i32 @exit_msg(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %18, i8* %19, i32 %20)
br label %22
22: ; preds = %17, %5
%23 = load i8*, i8** %11
ret i8* %23
}

LLVM IR (-O2):
@.str = [40 x i8] c"Failed to allocate memory in %s() %s:%d\00"
define noalias i8* @_realloc_w(i8* nocapture %0, i64 %1, i8* %2, i8* %3, i32 %4) {
%6 = tail call i8* @realloc(i8* %0, i64 %1)
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @exit_msg(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %3, i32 %4)
br label %10
10: ; preds = %8, %5
ret i8* %6
}
unsigned long v_unsigned_long_func() { return (0); }


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

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

LLVM IR (-O0):
define i64 @v_unsigned_long_func() {
ret i64 0
}

LLVM IR (-O2):
define i64 @v_unsigned_long_func() {
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ osw_abort();
void exit_log(const char *msg, ...) { osw_abort(); }


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

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

LLVM IR (-O0):
define void @exit_log(i8* %0, ...) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @osw_abort()
ret void
}

LLVM IR (-O2):
define void @exit_log(i8* nocapture readnone %0, ...) {
%2 = tail call i32 (...) @osw_abort()
ret void
}
double square(int a) { return a * a; }


x86 assembly (clang, -O0):
<square>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<square>:
imul   %edi,%edi
cvtsi2sd %edi,%xmm0
ret

LLVM IR (-O0):
define double @square(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = mul nsw i32 %3, %4
%6 = sitofp i32 %5 to double
ret double %6
}

LLVM IR (-O2):
define double @square(i32 %0) {
%2 = mul nsw i32 %0, %0
%3 = sitofp i32 %2 to double
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ foo();
void bar() { foo(); }


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

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

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

LLVM IR (-O2):
define void @bar() {
%1 = tail call i32 (...) @foo()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ msg_format(char *, char *, char *);
void do_cmd_version(void) {
  msg_format("You are playing %s %s.  Type '?' for more info.", "Minimal",
             "1.0.0");
}


x86 assembly (clang, -O0):
<do_cmd_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xf0e(%rip),%rsi
lea    0xf0f(%rip),%rdx
call   1030 <msg_format@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_cmd_version>:
lea    0xee9(%rip),%rdi
lea    0xf12(%rip),%rsi
lea    0xf13(%rip),%rdx
jmp    1030 <msg_format@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"You are playing %s %s. Type '?' for more info.\00"
@.str.1 = [8 x i8] c"Minimal\00"
@.str.2 = [6 x i8] c"1.0.0\00"
define void @do_cmd_version() {
%1 = call i32 @msg_format(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"You are playing %s %s. Type '?' for more info.\00"
@.str.1 = [8 x i8] c"Minimal\00"
@.str.2 = [6 x i8] c"1.0.0\00"
define void @do_cmd_version() {
%1 = tail call i32 @msg_format(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret void
}
void touch_atime(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<touch_atime>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<touch_atime>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.touch_atime = [12 x i8] c"touch_atime\00"
define void @touch_atime() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.touch_atime, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.touch_atime = [12 x i8] c"touch_atime\00"
define void @touch_atime() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.touch_atime, i64 0, i64 0))
ret void
}
int current_nid() { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @current_nid() {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void print_par(int i, void *d, void *u) { printf("(%i,%i)\n", i, *(int *)d); }


x86 assembly (clang, -O0):
<print_par>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_par>:
mov    %edi,%eax
mov    (%rsi),%edx
lea    0xee5(%rip),%rdi
mov    %eax,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"(%i,%i)\0A\00"
define void @print_par(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"(%i,%i)\0A\00"
define void @print_par(i32 %0, i8* nocapture %1, i8* nocapture readnone %2) {
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %5)
ret void
}
int legalmoves(int *p) {
  int i;
  for (i = 0; i < 6; ++i)
    if (*(p + i) == (6 - i))
      return 6 - i;
  return 0;
}


x86 assembly (clang, -O0):
<legalmoves>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x6,-0x14(%rbp)
jge    1157 <legalmoves+0x57>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    $0x6,%ecx
sub    -0x14(%rbp),%ecx
cmp    %ecx,%eax
jne    1144 <legalmoves+0x44>
mov    $0x6,%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115e <legalmoves+0x5e>
jmp    1149 <legalmoves+0x49>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    110f <legalmoves+0xf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<legalmoves>:
mov    $0x6,%eax
cmpl   $0x6,(%rdi)
je     113f <legalmoves+0x3f>
mov    $0x5,%eax
cmpl   $0x5,0x4(%rdi)
je     113f <legalmoves+0x3f>
mov    $0x4,%eax
cmpl   $0x4,0x8(%rdi)
je     113f <legalmoves+0x3f>
mov    $0x3,%eax
cmpl   $0x3,0xc(%rdi)
je     113f <legalmoves+0x3f>
mov    $0x2,%eax
cmpl   $0x2,0x10(%rdi)
je     113f <legalmoves+0x3f>
xor    %eax,%eax
cmpl   $0x1,0x14(%rdi)
sete   %al
ret

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

LLVM IR (-O2):
define i32 @legalmoves(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 6
br i1 %3, label %25, label %4
4: ; preds = %1
%5 = getelementptr inbounds i32, i32* %0, i64 1
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 5
br i1 %7, label %25, label %8
8: ; preds = %4
%9 = getelementptr inbounds i32, i32* %0, i64 2
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 4
br i1 %11, label %25, label %12
12: ; preds = %8
%13 = getelementptr inbounds i32, i32* %0, i64 3
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 3
br i1 %15, label %25, label %16
16: ; preds = %12
%17 = getelementptr inbounds i32, i32* %0, i64 4
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, 2
br i1 %19, label %25, label %20
20: ; preds = %16
%21 = getelementptr inbounds i32, i32* %0, i64 5
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, 1
%24 = zext i1 %23 to i32
br label %25
25: ; preds = %20, %16, %12, %8, %4, %1
%26 = phi i32 [ 6, %1 ], [ 5, %4 ], [ 4, %8 ], [ 3, %12 ], [ 2, %16 ], [ %24, %20 ]
ret i32 %26
}
int imax(int a, int b) { return a >= b ? a : b; }


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

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

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

LLVM IR (-O2):
define i32 @imax(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, double);
double log10(double);
int /*<<< orphan*/ printf(char *, double, double);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  double num = 100;
  fprintf(stderr, "num = %lf\n", num);
  double result = log10(num);
  printf("log10(%lf) = %lf\n", num, result);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xeb9(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
movsd  -0x18(%rbp),%xmm0
lea    0xea7(%rip),%rsi
call   1040 <fprintf@plt>
movsd  -0x18(%rbp),%xmm0
call   1050 <log10@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
movsd  0xec7(%rip),%xmm0
call   1040 <fprintf@plt>
lea    0xed6(%rip),%rdi
movsd  0xebb(%rip),%xmm1
movsd  0xeab(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"num = %lf\0A\00"
@.str.1 = [18 x i8] c"log10(%lf) = %lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca double
%6 = alloca double
store i32 %0, i32* %3
store i8** %1, i8*** %4
store double 1.000000e+02, double* %5
%7 = load i32, i32* @stderr
%8 = load double, double* %5
%9 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %8)
%10 = load double, double* %5
%11 = call double @log10(double %10)
store double %11, double* %6
%12 = load double, double* %5
%13 = load double, double* %6
%14 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), double %12, double %13)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"num = %lf\0A\00"
@.str.1 = [18 x i8] c"log10(%lf) = %lf\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double 1.000000e+02)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), double 1.000000e+02, double 2.000000e+00)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int service_snmp_init(char *ip, int sp, unsigned char options, char *miscptr,
                      FILE *fp, int port, char *hostname) {
  return 0;
}


x86 assembly (clang, -O0):
<service_snmp_init>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    0x10(%rbp),%rdx
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @service_snmp_init(i8* %0, i32 %1, i8 zeroext %2, i8* %3, i32* %4, i32 %5, i8* %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8
%11 = alloca i8*
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i8*
store i8* %0, i8** %8
store i32 %1, i32* %9
store i8 %2, i8* %10
store i8* %3, i8** %11
store i32* %4, i32** %12
store i32 %5, i32* %13
store i8* %6, i8** %14
ret i32 0
}

LLVM IR (-O2):
define i32 @service_snmp_init(i8* nocapture readnone %0, i32 %1, i8 zeroext %2, i8* nocapture readnone %3, i32* nocapture readnone %4, i32 %5, i8* nocapture readnone %6) {
ret i32 0
}
char *process_colors(unsigned char byte) {
  static char a[4];
  for (int i = 0; i < 4; ++i) {
    a[i] = (byte >> (6 - 2 * i)) & 3;
  }
  return a;
}


x86 assembly (clang, -O0):
<process_colors>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    114f <process_colors+0x4f>
movzbl -0x1(%rbp),%eax
mov    -0x8(%rbp),%edx
shl    $0x1,%edx
mov    $0x6,%ecx
sub    %edx,%ecx
sar    %cl,%eax
and    $0x3,%eax
mov    %al,%dl
movslq -0x8(%rbp),%rcx
lea    0x2ee3(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1111 <process_colors+0x11>
lea    0x2ecb(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_colors>:
mov    %edi,%eax
shr    $0x6,%al
mov    %al,0x2f16(%rip)
lea    0x2f0f(%rip),%rax
mov    %edi,%ecx
shr    $0x4,%cl
and    $0x3,%cl
mov    %cl,0x2f02(%rip)
mov    %edi,%ecx
shr    $0x2,%cl
and    $0x3,%cl
mov    %cl,0x2ef5(%rip)
and    $0x3,%dil
mov    %dil,0x2eeb(%rip)
ret

LLVM IR (-O0):
@process_colors.a = internal global [4 x i8] zeroinitializer
define i8* @process_colors(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 0, i32* %3
br label %4
4: ; preds = %19, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 4
br i1 %6, label %7, label %22
7: ; preds = %4
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = load i32, i32* %3
%11 = mul nsw i32 2, %10
%12 = sub nsw i32 6, %11
%13 = ashr i32 %9, %12
%14 = and i32 %13, 3
%15 = trunc i32 %14 to i8
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [4 x i8], [4 x i8]* @process_colors.a, i64 0, i64 %17
store i8 %15, i8* %18
br label %19
19: ; preds = %7
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %4
22: ; preds = %4
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @process_colors.a, i64 0, i64 0)
}

LLVM IR (-O2):
@process_colors.a = internal global [4 x i8] zeroinitializer
define i8* @process_colors(i8 zeroext %0) {
%2 = lshr i8 %0, 6
store i8 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @process_colors.a, i64 0, i64 0)
%3 = lshr i8 %0, 4
%4 = and i8 %3, 3
store i8 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @process_colors.a, i64 0, i64 1)
%5 = lshr i8 %0, 2
%6 = and i8 %5, 3
store i8 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @process_colors.a, i64 0, i64 2)
%7 = and i8 %0, 3
store i8 %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @process_colors.a, i64 0, i64 3)
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @process_colors.a, i64 0, i64 0)
}