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

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ malloc(int);
void *alloc_XIMPreeditDrawCallbackStruct(void) {
  XIMPreeditDrawCallbackStruct *_p = (XIMPreeditDrawCallbackStruct *)malloc(
      sizeof(XIMPreeditDrawCallbackStruct));
  if (_p == NULL)
    abort();
  return (void *)_p;
}


x86 assembly (clang, -O0):
<alloc_XIMPreeditDrawCallbackStruct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <alloc_XIMPreeditDrawCallbackStruct+0x28>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_XIMPreeditDrawCallbackStruct>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1132 <alloc_XIMPreeditDrawCallbackStruct+0x12>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @alloc_XIMPreeditDrawCallbackStruct() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = load i32*, i32** %1
%10 = bitcast i32* %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @alloc_XIMPreeditDrawCallbackStruct() {
%1 = tail call i64 @malloc(i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = inttoptr i64 %1 to i8*
ret i8* %6
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ test_double_conf();
int /*<<< orphan*/ test_simple_conf();
int main(void) {
  test_simple_conf();
  test_double_conf();
  return EXIT_SUCCESS;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <test_simple_conf@plt>
xor    %eax,%eax
call   1030 <test_double_conf@plt>
mov    0x2eaa(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_simple_conf()
%3 = call i32 (...) @test_double_conf()
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @test_simple_conf()
%2 = tail call i32 (...) @test_double_conf()
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}
int treeops_init(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @treeops_init() {
ret i32 0
}
/* Variables and functions */
int atoi(char *);
int get_radix(char *s) {
  int r = atoi(s);
  if (r < 2 || 8 < r)
    r = 2;
  return r;
}


x86 assembly (clang, -O0):
<get_radix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <atoi@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jl     1140 <get_radix+0x30>
mov    $0x8,%eax
cmp    -0xc(%rbp),%eax
jge    1147 <get_radix+0x37>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_radix>:
push   %rax
call   1030 <atoi@plt>
lea    -0x9(%rax),%ecx
cmp    $0xfffffff9,%ecx
mov    $0x2,%ecx
cmovb  %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @get_radix(i8* nocapture %0) {
%2 = tail call i32 @atoi(i8* %0)
%3 = add i32 %2, -9
%4 = icmp ult i32 %3, -7
%5 = select i1 %4, i32 2, i32 %2
ret i32 %5
}
int matchInt(void *ptr, void *key) { return (*(int *)ptr == *(int *)key); }


x86 assembly (clang, -O0):
<matchInt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<matchInt>:
mov    (%rdi),%ecx
xor    %eax,%eax
cmp    (%rsi),%ecx
sete   %al
ret

LLVM IR (-O0):
define i32 @matchInt(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = icmp eq i32 %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @matchInt(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp eq i32 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
void saveEnv() {}


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

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

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

LLVM IR (-O2):
define void @saveEnv() {
ret void
}
/* Variables and functions */
char peek_token();
int /*<<< orphan*/ shift_token();
char next_token() {
  char c = peek_token();
  shift_token();
  return c;
}


x86 assembly (clang, -O0):
<next_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <peek_token@plt>
mov    %al,-0x1(%rbp)
mov    $0x0,%al
call   1040 <shift_token@plt>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @next_token() {
%1 = alloca i8
%2 = call signext i8 (...) @peek_token()
store i8 %2, i8* %1
%3 = call i32 (...) @shift_token()
%4 = load i8, i8* %1
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @next_token() {
%1 = tail call signext i8 (...) @peek_token()
%2 = tail call i32 (...) @shift_token()
ret i8 %1
}
/* Variables and functions */
int /*<<< orphan*/ k_error(int /*<<< orphan*/);
int /*<<< orphan*/ sysmsg(int);
void k_nary_length_error() { k_error(sysmsg(1117)); }


x86 assembly (clang, -O0):
<k_nary_length_error>:
push   %rbp
mov    %rsp,%rbp
mov    $0x45d,%edi
call   1030 <sysmsg@plt>
mov    %eax,%edi
call   1040 <k_error@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<k_nary_length_error>:
push   %rax
mov    $0x45d,%edi
call   1030 <sysmsg@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <k_error@plt>

LLVM IR (-O0):
define void @k_nary_length_error() {
%1 = call i32 @sysmsg(i32 1117)
%2 = call i32 @k_error(i32 %1)
ret void
}

LLVM IR (-O2):
define void @k_nary_length_error() {
%1 = tail call i32 @sysmsg(i32 1117)
%2 = tail call i32 @k_error(i32 %1)
ret void
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int padcon_get_dobldobl_closest_pole(double *cre, double *cim) {
  int fail;
  int precision = 1;
  int *b;
  double nbr[2];
  fail = _ada_use_c2phc4c(866, &precision, b, nbr, 0);
  *cre = nbr[0];
  *cim = nbr[1];
  return fail;
}


x86 assembly (clang, -O0):
<padcon_get_dobldobl_closest_pole>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x20(%rbp),%rdx
lea    -0x30(%rbp),%rcx
mov    $0x362,%edi
lea    -0x18(%rbp),%rsi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<padcon_get_dobldobl_closest_pole>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movl   $0x1,0xc(%rsp)
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rcx
mov    $0x362,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @padcon_get_dobldobl_closest_pole(double* nocapture writeonly %0, double* nocapture writeonly %1) {
%3 = alloca i32
%4 = alloca [2 x double]
%5 = bitcast i32* %3 to i8*
store i32 1, i32* %3
%6 = bitcast [2 x double]* %4 to i8*
%7 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 0
%8 = call i32 @_ada_use_c2phc4c(i32 866, i32* %3, i32* undef, double* %7, i32 0)
%9 = load double, double* %7
store double %9, double* %0
%10 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 1
%11 = load double, double* %10
store double %11, double* %1
ret i32 %8
}
/* Variables and functions */
int strlen(char *);
long hash(char *word) {
  int i = 0;
  long hashs = 42;
  while (i <= strlen(word)) {
    hashs += word[i] * (i + 1);
    i++;
  }
  return hashs;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movq   $0x2a,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cmp    %ecx,%eax
jg     1174 <hash+0x64>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
cltq
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112b <hash+0x1b>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    $0x2a,%r15d
test   %eax,%eax
js     1158 <hash+0x48>
mov    $0x1,%ebx
nopl   0x0(%rax)
movsbl -0x1(%r14,%rbx,1),%eax
imul   %ebx,%eax
cltq
add    %rax,%r15
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
lea    0x1(%rbx),%rcx
add    $0xffffffffffffffff,%rbx
cmp    %rax,%rbx
mov    %rcx,%rbx
jl     1130 <hash+0x20>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @hash(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %18, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %10, %4 ], [ 0, %1 ]
%6 = phi i64 [ %14, %4 ], [ 42, %1 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %5
%8 = load i8, i8* %7
%9 = sext i8 %8 to i64
%10 = add nuw nsw i64 %5, 1
%11 = mul i64 %10, %9
%12 = shl i64 %11, 32
%13 = ashr exact i64 %12, 32
%14 = add nsw i64 %6, %13
%15 = tail call i32 @strlen(i8* %0)
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %5, %16
br i1 %17, label %4, label %18
18: ; preds = %4, %1
%19 = phi i64 [ 42, %1 ], [ %14, %4 ]
ret i64 %19
}
unsigned normal2x_generic_input_fmts(void) { return (1 << 1) | (1 << 0); }


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

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

LLVM IR (-O0):
define i32 @normal2x_generic_input_fmts() {
ret i32 3
}

LLVM IR (-O2):
define i32 @normal2x_generic_input_fmts() {
ret i32 3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, int, int);
void intcb(const char *l, char s, int v) {
  printf("Callback [int]: %s %d %d\n", l, (int)s, v);
}


x86 assembly (clang, -O0):
<intcb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
movsbl -0x9(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intcb>:
mov    %edx,%ecx
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee2(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Callback [int]: %s %d %d\0A\00"
define void @intcb(i8* %0, i8 signext %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 = sext i8 %8 to i32
%10 = load i32, i32* %6
%11 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %9, i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Callback [int]: %s %d %d\0A\00"
define void @intcb(i8* %0, i8 signext %1, i32 %2) {
%4 = sext i8 %1 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %4, i32 %2)
ret void
}
void __VERIFIER_error() {}


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

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

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

LLVM IR (-O2):
define void @__VERIFIER_error() {
ret void
}
int main(void) {
  int i;
  void auto_static(void);
  for (i = 0; i < 5; ++i) {
    auto_static();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1143 <main+0x33>
call   1030 <auto_static@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <auto_static@plt>
call   1030 <auto_static@plt>
call   1030 <auto_static@plt>
call   1030 <auto_static@plt>
call   1030 <auto_static@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
br label %3
3: ; preds = %7, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 5
br i1 %5, label %6, label %10
6: ; preds = %3
br label %7
7: ; preds = %6
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 1
store i32 %9, i32* %2
br label %3
10: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
tail call void @auto_static()
tail call void @auto_static()
tail call void @auto_static()
tail call void @auto_static()
tail call void @auto_static()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bubblesort(int *, int);
int /*<<< orphan*/ printarray(int *, int);
int /*<<< orphan*/ testswap();
void solve() {
  testswap();
  int A[] = {5, 4, 3, 2, 1};
  printarray(A, 5);
  bubblesort(A, 5);
}


x86 assembly (clang, -O0):
<solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1030 <testswap@plt>
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb5(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1040 <printarray@plt>
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1050 <bubblesort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve>:
push   %rbx
sub    $0x20,%rsp
xor    %eax,%eax
call   1030 <testswap@plt>
mov    0xece(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <printarray@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <bubblesort@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.solve.A = [5 x i32] [i32 5, i32 4, i32 3, i32 2, i32 1]
define void @solve() {
%1 = alloca [5 x i32]
%2 = call i32 (...) @testswap()
%3 = bitcast [5 x i32]* %1 to i8*
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%5 = call i32 @printarray(i32* %4, i32 5)
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%7 = call i32 @bubblesort(i32* %6, i32 5)
ret void
}

LLVM IR (-O2):
@__const.solve.A = [5 x i32] [i32 5, i32 4, i32 3, i32 2, i32 1]
define void @solve() {
%1 = alloca [5 x i32]
%2 = tail call i32 (...) @testswap()
%3 = bitcast [5 x i32]* %1 to i8*
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%5 = call i32 @printarray(i32* %4, i32 5)
%6 = call i32 @bubblesort(i32* %4, i32 5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gmx_dih(int, char **);
int main(int argc, char *argv[]) {
  gmx_dih(argc, argv);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @gmx_dih(i32 %0, i8** %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ muntrace();
__attribute__((destructor())) void mtrace_unhook() { muntrace(); }


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

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

LLVM IR (-O0):
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @mtrace_unhook, i8* null }]
define void @mtrace_unhook() {
%1 = call i32 (...) @muntrace()
ret void
}

LLVM IR (-O2):
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @mtrace_unhook, i8* null }]
define void @mtrace_unhook() {
%1 = tail call i32 (...) @muntrace()
ret void
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *str_join(char *s1, char *s2) {
  char *s;
  s = malloc(strlen(s1) + strlen(s2) + 1);
  strcpy(s, s1);
  strcat(s, s2);
  return s;
}


x86 assembly (clang, -O0):
<str_join>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_join>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    (%r15,%rax,1),%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @str_join(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
%10 = add nsw i64 %7, %9
%11 = add nsw i64 %10, 1
%12 = call i8* @malloc(i64 %11)
store i8* %12, i8** %5
%13 = load i8*, i8** %5
%14 = load i8*, i8** %3
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = load i8*, i8** %5
%17 = load i8*, i8** %4
%18 = call i32 @strcat(i8* %16, i8* %17)
%19 = load i8*, i8** %5
ret i8* %19
}

LLVM IR (-O2):
define i8* @str_join(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add i64 %3, 1
%6 = add i64 %5, %4
%7 = tail call i8* @malloc(i64 %6)
%8 = tail call i32 @strcpy(i8* %7, i8* %0)
%9 = tail call i32 @strcat(i8* %7, i8* %1)
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ Dec(char *, char *, char);
int /*<<< orphan*/ Enc(char *, char *, char);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char plain[5] = "abcd";
  char cipher[5] = "";
  char key = 0x80;
  Enc(plain, cipher, key);
  Dec(cipher, plain, key);
  printf("%s\n", plain);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xeb2(%rip),%eax
mov    %eax,-0x5(%rbp)
mov    0xead(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0xa(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1050 <memset@plt>
movb   $0x80,-0xb(%rbp)
lea    -0x5(%rbp),%rdi
lea    -0xa(%rbp),%rsi
movsbl -0xb(%rbp),%edx
call   1060 <Enc@plt>
lea    -0xa(%rbp),%rdi
lea    -0x5(%rbp),%rsi
movsbl -0xb(%rbp),%edx
call   1030 <Dec@plt>
lea    -0x5(%rbp),%rsi
lea    0xe6a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movb   $0x0,0x14(%rsp)
movl   $0x64636261,0x10(%rsp)
64
movb   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0x10(%rsp),%rbx
lea    0x8(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xffffff80,%edx
call   1050 <Enc@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0xffffff80,%edx
call   1030 <Dec@plt>
lea    0xe83(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.plain = [5 x i8] c"abcd\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = alloca [5 x i8]
%3 = alloca i8
%4 = bitcast [5 x i8]* %1 to i8*
%5 = bitcast [5 x i8]* %2 to i8*
store i8 -128, i8* %3
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%8 = load i8, i8* %3
%9 = call i32 @Enc(i8* %6, i8* %7, i8 signext %8)
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%12 = load i8, i8* %3
%13 = call i32 @Dec(i8* %10, i8* %11, i8 signext %12)
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %14)
ret i32 0
}

LLVM IR (-O2):
@__const.main.plain = [5 x i8] c"abcd\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%5 = call i32 @Enc(i8* %3, i8* %4, i8 signext -128)
%6 = call i32 @Dec(i8* %4, i8* %3, i8 signext -128)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}
/* Variables and functions */
int aaip_get_acl_text(char *, char **, int);
int iso_local_get_acl_text(char *disk_path, char **text, int flag) {
  int ret;
  ret = aaip_get_acl_text(disk_path, text, flag & (1 | 16 | 32 | (1 << 15)));
  return ret;
}


x86 assembly (clang, -O0):
<iso_local_get_acl_text>:
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
and    $0x8031,%edx
call   1030 <aaip_get_acl_text@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iso_local_get_acl_text>:
and    $0x8031,%edx
jmp    1030 <aaip_get_acl_text@plt>

LLVM IR (-O0):
define i32 @iso_local_get_acl_text(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 = load i8**, i8*** %5
%10 = load i32, i32* %6
%11 = and i32 %10, 32817
%12 = call i32 @aaip_get_acl_text(i8* %8, i8** %9, i32 %11)
store i32 %12, i32* %7
%13 = load i32, i32* %7
ret i32 %13
}

LLVM IR (-O2):
define i32 @iso_local_get_acl_text(i8* %0, i8** %1, i32 %2) {
%4 = and i32 %2, 32817
%5 = tail call i32 @aaip_get_acl_text(i8* %0, i8** %1, i32 %4)
ret i32 %5
}
/* Type definitions */
typedef int (*FPTR)(int, int);

/* Variables and functions */
void *dlopen(char *, int);
scalar_t__ dlsym(void *, char *);
int stub1(int, int);
int do_test_so_func(int a, int b) {
  void *handle;
  typedef int (*FPTR)(int, int);
  handle = dlopen("./test_so.dylib", 1);
  FPTR fptr = (FPTR)dlsym(handle, "test_so_func");
  int result = (*fptr)(a, b);
  return result;
}


x86 assembly (clang, -O0):
<do_test_so_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xecb(%rip),%rdi
mov    $0x1,%esi
call   1030 <dlopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1040 <dlsym@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   *%rax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_test_so_func>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xed2(%rip),%rdi
mov    $0x1,%esi
call   1030 <dlopen@plt>
lea    0xed1(%rip),%rsi
mov    %rax,%rdi
call   1040 <dlsym@plt>
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    *%rax

LLVM IR (-O0):
@.str = [16 x i8] c"./test_so.dylib\00"
@.str.1 = [13 x i8] c"test_so_func\00"
define i32 @do_test_so_func(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32 (i32, i32)*
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = call i8* @dlopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 1)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = call i64 @dlsym(i8* %9, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%11 = inttoptr i64 %10 to i32 (i32, i32)*
store i32 (i32, i32)* %11, i32 (i32, i32)** %6
%12 = load i32 (i32, i32)*, i32 (i32, i32)** %6
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i32 %12(i32 %13, i32 %14)
store i32 %15, i32* %7
%16 = load i32, i32* %7
ret i32 %16
}

LLVM IR (-O2):
@.str = [16 x i8] c"./test_so.dylib\00"
@.str.1 = [13 x i8] c"test_so_func\00"
define i32 @do_test_so_func(i32 %0, i32 %1) {
%3 = tail call i8* @dlopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = tail call i64 @dlsym(i8* %3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%5 = inttoptr i64 %4 to i32 (i32, i32)*
%6 = tail call i32 %5(i32 %0, i32 %1)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int sum();
int main() {
  printf("wynik: %d\n", sum());
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <sum@plt>
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <sum@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"wynik: %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @sum()
%3 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [11 x i8] c"wynik: %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @sum()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
double JDLocalTimetoUTC(double);
double JDUTCtoTD(double);
double JDLocalTimetoTD(double localJD) {
  double tmp = JDLocalTimetoUTC(localJD);
  return JDUTCtoTD(tmp);
}


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

x86 assembly (clang, -O2):
<JDLocalTimetoTD>:
push   %rax
call   1030 <JDLocalTimetoUTC@plt>
pop    %rax
jmp    1040 <JDUTCtoTD@plt>

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

LLVM IR (-O2):
define double @JDLocalTimetoTD(double %0) {
%2 = tail call double @JDLocalTimetoUTC(double %0)
%3 = tail call double @JDUTCtoTD(double %2)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ getCurrentTime();
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main() {
  printf("c/c++ program:%ld\n", getCurrentTime());
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [19 x i8] c"c/c++ program:%ld\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @getCurrentTime()
%3 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"c/c++ program:%ld\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getCurrentTime()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int compute_sample(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  printf("%d\n", compute_sample(5));
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x5,%edi
call   1050 <compute_sample@plt>
mov    %eax,%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
call   1050 <compute_sample@plt>
lea    0xebe(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @compute_sample(i32 5)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @compute_sample(i32 5)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @exit(i32 0)
unreachable
}
int exact_square(int a) {
  int res = 0, m;
  for (m = 1; res < a; m++) {
    res = m * m;
    if (res == a)
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<exact_square>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1156 <exact_square+0x56>
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1143 <exact_square+0x43>
movl   $0x1,-0x4(%rbp)
jmp    115d <exact_square+0x5d>
jmp    1148 <exact_square+0x48>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1115 <exact_square+0x15>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exact_square>:
xor    %eax,%eax
test   %edi,%edi
jle    1120 <exact_square+0x20>
mov    $0x1,%ecx
nopl   0x0(%rax,%rax,1)
mov    %ecx,%edx
imul   %ecx,%edx
cmp    %edi,%edx
je     1121 <exact_square+0x21>
add    $0x1,%ecx
cmp    %edi,%edx
jl     1110 <exact_square+0x10>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @exact_square(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %6, label %10
3: ; preds = %6
%4 = add nuw nsw i32 %7, 1
%5 = icmp slt i32 %8, %0
br i1 %5, label %6, label %10
6: ; preds = %1, %3
%7 = phi i32 [ %4, %3 ], [ 1, %1 ]
%8 = mul nsw i32 %7, %7
%9 = icmp eq i32 %8, %0
br i1 %9, label %10, label %3
10: ; preds = %6, %3, %1
%11 = phi i32 [ 0, %1 ], [ 0, %3 ], [ 1, %6 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int mkstemp(char *);
int /*<<< orphan*/ unlink(char *);
char *mktemp(char *template) {
  int fd;
  fd = mkstemp(template);
  if (fd < 0) {
    return NULL;
  }
  close(fd);
  unlink(template);
  return template;
}


x86 assembly (clang, -O0):
<mktemp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <mkstemp@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    115f <mktemp+0x2f>
movq   $0x0,-0x8(%rbp)
jmp    1178 <mktemp+0x48>
mov    -0x14(%rbp),%edi
call   1040 <close@plt>
mov    -0x10(%rbp),%rdi
call   1030 <unlink@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mktemp>:
push   %rbx
mov    %rdi,%rbx
call   1050 <mkstemp@plt>
test   %eax,%eax
js     114e <mktemp+0x1e>
mov    %eax,%edi
call   1040 <close@plt>
mov    %rbx,%rdi
call   1030 <unlink@plt>
jmp    1150 <mktemp+0x20>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @mktemp(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @mkstemp(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i8* null, i8** %2
br label %16
10: ; preds = %1
%11 = load i32, i32* %4
%12 = call i32 @close(i32 %11)
%13 = load i8*, i8** %3
%14 = call i32 @unlink(i8* %13)
%15 = load i8*, i8** %3
store i8* %15, i8** %2
br label %16
16: ; preds = %10, %9
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
define i8* @mktemp(i8* %0) {
%2 = tail call i32 @mkstemp(i8* %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @close(i32 %2)
%6 = tail call i32 @unlink(i8* %0)
br label %7
7: ; preds = %1, %4
%8 = phi i8* [ %0, %4 ], [ null, %1 ]
ret i8* %8
}
unsigned long x86_get_flags(void) {
  unsigned long erflags;
  __asm__ volatile("pushf; pop	%0" : "=r"(erflags));
  return erflags;
}


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

x86 assembly (clang, -O2):
<x86_get_flags>:
pushf
pop    %rax
ret

LLVM IR (-O0):
define i64 @x86_get_flags() {
%1 = alloca i64
%2 = call i64 asm sideeffect "pushf; pop\09$0", "=r,~{dirflag},~{fpsr},~{flags}"()
store i64 %2, i64* %1
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @x86_get_flags() {
%1 = tail call i64 asm sideeffect "pushf; pop\09$0", "=r,~{dirflag},~{fpsr},~{flags}"()
ret i64 %1
}
/* Variables and functions */
int *unknown1();
int *unknown2();
void unknown_alias_Good() {
  int *x = unknown1();
  int *y = unknown2();
  if (*x < *y) {
    int a[10];
    a[5] = 0;
  }
}


x86 assembly (clang, -O0):
<unknown_alias_Good>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    $0x0,%al
call   1030 <unknown1@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <unknown2@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    1157 <unknown_alias_Good+0x37>
movl   $0x0,-0x2c(%rbp)
add    $0x40,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @unknown_alias_Good() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca [10 x i32]
%4 = call i32* (...) @unknown1()
store i32* %4, i32** %1
%5 = call i32* (...) @unknown2()
store i32* %5, i32** %2
%6 = load i32*, i32** %1
%7 = load i32, i32* %6
%8 = load i32*, i32** %2
%9 = load i32, i32* %8
%10 = icmp slt i32 %7, %9
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 5
store i32 0, i32* %12
br label %13
13: ; preds = %11, %0
ret void
}

LLVM IR (-O2):
define void @unknown_alias_Good() {
%1 = tail call i32* (...) @unknown1()
%2 = tail call i32* (...) @unknown2()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stdout;
void printStr(const char *str) { fprintf(stdout, "%s", str); }


x86 assembly (clang, -O0):
<printStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printStr>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stdout = global i32 0
@.str = [3 x i8] c"%s\00"
define void @printStr(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int f1(int x) { return x * 2; }


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

x86 assembly (clang, -O2):
<f1>:
lea    (%rdi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @f1(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
int main(int argc, char **argv) {
  while (1) {
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
jmp    1112 <main+0x12>

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %6
6: ; preds = %2, %6
br label %6
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ puts(char *);
void get_y_or_n(void) {
  char response[8];
  puts("Continue? [y] n: ");
  gets(response);
  if (response[0] == 'n')
    exit(0);
  return;
}


x86 assembly (clang, -O0):
<get_y_or_n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    -0x8(%rbp),%rdi
call   1040 <gets@plt>
movsbl -0x8(%rbp),%eax
cmp    $0x6e,%eax
jne    1161 <get_y_or_n+0x31>
xor    %edi,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_y_or_n>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
call   1040 <gets@plt>
cmpb   $0x6e,(%rsp)
je     114d <get_y_or_n+0x1d>
pop    %rax
ret
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"Continue? [y] n: \00"
define void @get_y_or_n() {
%1 = alloca [8 x i8]
%2 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%4 = call i32 @gets(i8* %3)
%5 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 110
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %0
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"Continue? [y] n: \00"
define void @get_y_or_n() {
%1 = alloca [8 x i8]
%2 = getelementptr inbounds [8 x i8], [8 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 110
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @exit(i32 0)
unreachable
9: ; preds = %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ challenge_PI_go_off();
int /*<<< orphan*/ challenge_PI_run();
int /*<<< orphan*/ challenge_initStates();
int main() {
  challenge_initStates();
  challenge_PI_run();
  challenge_PI_go_off();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @challenge_initStates()
%2 = tail call i32 (...) @challenge_PI_run()
%3 = tail call i32 (...) @challenge_PI_go_off()
ret i32 0
}
/* Type definitions */
struct proctal {
  int dummy;
};

/* Variables and functions */
int proctal_implementation_scan_region_next(struct proctal *, void **, void **);
int proctal_scan_region_next(struct proctal *p, void **start, void **end) {
  return proctal_implementation_scan_region_next(p, start, end);
}


x86 assembly (clang, -O0):
<proctal_scan_region_next>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <proctal_implementation_scan_region_next@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<proctal_scan_region_next>:
jmp    1030 <proctal_implementation_scan_region_next@plt>

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

LLVM IR (-O2):
%struct.proctal = type { i32 }
define i32 @proctal_scan_region_next(%struct.proctal* %0, i8** %1, i8** %2) {
%4 = tail call i32 @proctal_implementation_scan_region_next(%struct.proctal* %0, i8** %1, i8** %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
int write(int, char const *, int);
void write_ch(const char c) {
  if (write(1, &c, 1) == -1)
    _exit(1);
}


x86 assembly (clang, -O0):
<write_ch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x1,%edx
lea    -0x1(%rbp),%rsi
mov    %edx,%edi
call   1040 <write@plt>
cmp    $0xffffffff,%eax
jne    1151 <write_ch+0x31>
mov    $0x1,%edi
call   1030 <_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_ch>:
push   %rax
mov    %dil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1040 <write@plt>
cmp    $0xffffffff,%eax
je     1141 <write_ch+0x21>
pop    %rax
ret
mov    $0x1,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define void @write_ch(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @write(i32 1, i8* %2, i32 1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @_exit(i32 1)
unreachable
7: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @write_ch(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @write(i32 1, i8* %2, i32 1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @_exit(i32 1)
unreachable
7: ; preds = %1
ret void
}