xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int setreuse(int fd) {
  int yes = 1;
  return setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int));
}


x86 assembly (clang, -O0):
<setreuse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebc(%rip),%rax
mov    (%rax),%esi
mov    0x2ea3(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setreuse>:
push   %rax
movl   $0x1,0x4(%rsp)
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
mov    0x2eaf(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
pop    %rcx
ret

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
define i32 @setreuse(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* @SOL_SOCKET
%6 = load i32, i32* @SO_REUSEADDR
%7 = call i32 @setsockopt(i32 %4, i32 %5, i32 %6, i32* %3, i32 4)
ret i32 %7
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
define i32 @setreuse(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%4 = load i32, i32* @SOL_SOCKET
%5 = load i32, i32* @SO_REUSEADDR
%6 = call i32 @setsockopt(i32 %0, i32 %4, i32 %5, i32* %2, i32 4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ ss2snfe(float);
void ss2snfe_(float *expand) { ss2snfe(*expand); }


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

x86 assembly (clang, -O2):
<ss2snfe_>:
movss  (%rdi),%xmm0
jmp    1030 <ss2snfe@plt>

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

LLVM IR (-O2):
define void @ss2snfe_(float* nocapture %0) {
%2 = load float, float* %0
%3 = tail call i32 @ss2snfe(float %2)
ret void
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int celcon_read_quaddobl_random_coefficient_system(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(471, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<celcon_read_quaddobl_random_coefficient_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1d7,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<celcon_read_quaddobl_random_coefficient_system>:
mov    $0x1d7,%edi
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @celcon_read_quaddobl_random_coefficient_system() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 471, i32* %5, i32* %6, double* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @celcon_read_quaddobl_random_coefficient_system() {
%1 = tail call i32 @_ada_use_c2phc(i32 471, i32* undef, i32* undef, double* undef)
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ err(int, char *, char const *);
int /*<<< orphan*/ *fopen(char const *, char const *);
FILE *file(const char *name, const char *mode) {
  FILE *fp;
  if ((fp = fopen(name, mode)) == NULL)
    err(1, "%s", name);
  return (fp);
}


x86 assembly (clang, -O0):
<file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1160 <file+0x40>
mov    -0x8(%rbp),%rdx
mov    $0x1,%edi
lea    0xea5(%rip),%rsi
call   1030 <err@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1148 <file+0x28>
lea    0xec5(%rip),%rsi
mov    $0x1,%edi
mov    %r14,%rdx
call   1030 <err@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32* @file(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32* @fopen(i8* %6, i8* %7)
store i32* %8, i32** %5
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = call i32 @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %10, %2
%14 = load i32*, i32** %5
ret i32* %14
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define noalias i32* @file(i8* %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* %1)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %5, %2
ret i32* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, int *, double *);
int main() {
  int X;
  double Y, kml;
  scanf("%d %lf", &X, &Y);
  kml = (float)X / Y;
  printf("%.3lf km/l\n", kml);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <scanf@plt>
cvtsi2ssl -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1040 <scanf@plt>
cvtsi2ssl 0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0x10(%rsp),%xmm0
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d %lf\00"
@.str.1 = [12 x i8] c"%.3lf km/l\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %2, double* %3)
%6 = load i32, i32* %2
%7 = sitofp i32 %6 to float
%8 = fpext float %7 to double
%9 = load double, double* %3
%10 = fdiv double %8, %9
store double %10, double* %4
%11 = load double, double* %4
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %lf\00"
@.str.1 = [12 x i8] c"%.3lf km/l\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = bitcast i32* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, double* %2)
%6 = load i32, i32* %1
%7 = sitofp i32 %6 to float
%8 = fpext float %7 to double
%9 = load double, double* %2
%10 = fdiv double %8, %9
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ func2();
int /*<<< orphan*/ func3();
int /*<<< orphan*/ func5();
void func1() {
  func2();
  func3();
  func5();
}


x86 assembly (clang, -O0):
<func1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <func2@plt>
mov    $0x0,%al
call   1030 <func3@plt>
mov    $0x0,%al
call   1040 <func5@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<func1>:
push   %rax
xor    %eax,%eax
call   1050 <func2@plt>
xor    %eax,%eax
call   1030 <func3@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <func5@plt>

LLVM IR (-O0):
define void @func1() {
%1 = call i32 (...) @func2()
%2 = call i32 (...) @func3()
%3 = call i32 (...) @func5()
ret void
}

LLVM IR (-O2):
define void @func1() {
%1 = tail call i32 (...) @func2()
%2 = tail call i32 (...) @func3()
%3 = tail call i32 (...) @func5()
ret void
}
int main(int argc, char *argv[]) {
  int a = 42;
  a = a * a;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x2a,-0x14(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
int lookup2(int i) {
  int a[] = {0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14, 15,
             16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
  return a[i + 1];
}


x86 assembly (clang, -O0):
<lookup2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x90(%rbp),%rdi
lea    0xed4(%rip),%rsi
mov    $0x80,%edx
call   1030 <memcpy@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x90(%rbp,%rax,4),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookup2>:
movslq %edi,%rax
lea    0xef6(%rip),%rcx
mov    0x4(%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
@__const.lookup2.a = [32 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31]
define i32 @lookup2(i32 %0) {
%2 = alloca i32
%3 = alloca [32 x i32]
store i32 %0, i32* %2
%4 = bitcast [32 x i32]* %3 to i8*
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 %7
%9 = load i32, i32* %8
ret i32 %9
}

LLVM IR (-O2):
@__const.lookup2.a = [32 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31]
define i32 @lookup2(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds [32 x i32], [32 x i32]* @__const.lookup2.a, i64 0, i64 %3
%5 = load i32, i32* %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printw(char *);
void hudMenuWrite(char *line) {
  printw(line);
  printw("\n");
}


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

x86 assembly (clang, -O2):
<hudMenuWrite>:
push   %rax
call   1030 <printw@plt>
lea    0xee3(%rip),%rdi
pop    %rax
jmp    1030 <printw@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @hudMenuWrite(i8* %0) {
%2 = tail call i32 @printw(i8* %0)
%3 = tail call i32 @printw(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ isprint(char);
int /*<<< orphan*/ isspace(char);
int isword(char c) { return isprint(c) && !isspace(c); }


x86 assembly (clang, -O0):
<isword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <isprint@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
je     115d <isword+0x3d>
movsbl -0x1(%rbp),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isword>:
push   %rbx
mov    %edi,%ebx
call   1040 <isprint@plt>
test   %rax,%rax
je     1140 <isword+0x20>
movsbl %bl,%edi
call   1030 <isspace@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isword(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @isprint(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8, i8* %2
%8 = call i32 @isspace(i8 signext %7)
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
br label %11
11: ; preds = %6, %1
%12 = phi i1 [ false, %1 ], [ %10, %6 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @isword(i8 signext %0) {
%2 = tail call i64 @isprint(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @isspace(i8 signext %0)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %9
}
int download_package(char *url) {}


x86 assembly (clang, -O0):
<download_package>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @download_package(i8* nocapture readnone %0) {
ret i32 undef
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t shabal_v(uint32_t a) { return (a << 2) + a; }


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

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

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

LLVM IR (-O2):
define i32 @shabal_v(i32 %0) {
%2 = mul i32 %0, 5
ret i32 %2
}
/* Variables and functions */
double atof(char *);
int /*<<< orphan*/ printf(char *, double);
void test9() {
  double d;
  d = atof("0.0234");
  printf("D: %f\n", d);
}


x86 assembly (clang, -O0):
<test9>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xec2(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test9>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <atof@plt>
lea    0xed3(%rip),%rdi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"0.0234\00"
@.str.1 = [7 x i8] c"D: %f\0A\00"
define void @test9() {
%1 = alloca double
%2 = call double @atof(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store double %2, double* %1
%3 = load double, double* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %3)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"0.0234\00"
@.str.1 = [7 x i8] c"D: %f\0A\00"
define void @test9() {
%1 = tail call double @atof(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %1)
ret void
}
/* Variables and functions */
scalar_t__ COND_MI();
int /*<<< orphan*/ EA_AL_8();
int /*<<< orphan*/ m68ki_write_8(int /*<<< orphan*/, int);
void m68k_op_smi_8_al(void) { m68ki_write_8(EA_AL_8(), COND_MI() ? 0xff : 0); }


x86 assembly (clang, -O0):
<m68k_op_smi_8_al>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <EA_AL_8@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <COND_MI@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rcx
xor    %esi,%esi
mov    $0xff,%eax
cmp    $0x0,%rcx
cmovne %eax,%esi
call   1050 <m68ki_write_8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m68k_op_smi_8_al>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <EA_AL_8@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <COND_MI@plt>
test   %rax,%rax
mov    $0xff,%esi
cmove  %ebp,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <m68ki_write_8@plt>

LLVM IR (-O0):
define void @m68k_op_smi_8_al() {
%1 = call i32 (...) @EA_AL_8()
%2 = call i64 (...) @COND_MI()
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i32 255, i32 0
%6 = call i32 @m68ki_write_8(i32 %1, i32 %5)
ret void
}

LLVM IR (-O2):
define void @m68k_op_smi_8_al() {
%1 = tail call i32 (...) @EA_AL_8()
%2 = tail call i64 (...) @COND_MI()
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 0, i32 255
%5 = tail call i32 @m68ki_write_8(i32 %1, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int int_var = 5;
  int *int_ptr;
  int_ptr = &int_var;
  printf("%d", *int_ptr);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 5)
ret i32 0
}
int enclave_fcntl() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @enclave_fcntl() {
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint32_t;
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
uint32_t timeGetTime() {
  uint32_t ret;
  struct timeval tv;
  gettimeofday(&tv, NULL);
  ret = ((uint32_t)(tv.tv_sec * 1000 + tv.tv_usec / 1000));
  return ret;
}


x86 assembly (clang, -O0):
<timeGetTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,-0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeGetTime>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq (%rsp),%rax
imul   $0x3e8,%rax,%rcx
movslq 0x4(%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
cltq
add    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i64 @timeGetTime() {
%1 = alloca i64
%2 = alloca %struct.timeval
%3 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %6, %9
%11 = sext i32 %10 to i64
store i64 %11, i64* %1
%12 = load i64, i64* %1
ret i64 %12
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i64 @timeGetTime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %9, %6
%11 = sext i32 %10 to i64
ret i64 %11
}
int g(int u, int v) {
  int k = u / v;
  return k;
}


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

x86 assembly (clang, -O2):
<g>:
mov    %edi,%eax
cltd
idiv   %esi
ret

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

LLVM IR (-O2):
define i32 @g(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
int main() {
  write(1, "abcd", sizeof(("abcd")) - 1);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x1,%edi
mov    $0x4,%edx
call   1030 <write@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"abcd\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @write(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"abcd\00"
define i32 @main() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
ret i32 0
}
/* Type definitions */
struct suffix_mult {
  int dummy;
};

/* Variables and functions */
unsigned long xstrtoull_sfx(char const *, int, struct suffix_mult const *);
unsigned long xstrtoul_sfx(const char *str, int b,
                           const struct suffix_mult *sfx) {
  return xstrtoull_sfx(str, b, sfx);
}


x86 assembly (clang, -O0):
<xstrtoul_sfx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <xstrtoull_sfx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrtoul_sfx>:
jmp    1030 <xstrtoull_sfx@plt>

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

LLVM IR (-O2):
%struct.suffix_mult = type { i32 }
define i64 @xstrtoul_sfx(i8* %0, i32 %1, %struct.suffix_mult* %2) {
%4 = tail call i64 @xstrtoull_sfx(i8* %0, i32 %1, %struct.suffix_mult* %2)
ret i64 %4
}
/* Variables and functions */
double atof(char *);
int /*<<< orphan*/ printf(char *, double);
int main(void) {
  char s[] = "  -100.312e-16 ";
  double res = atof(s);
  printf("%e\n", res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@__const.main.s = [16 x i8] c" -100.312e-16 \00"
@.str = [4 x i8] c"%e\0A\00"
define i32 @main() {
%1 = tail call double @atof(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @__const.main.s, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ dummy(int *);
void paths_unsure_multi(void) {
  int x;
  int y = 0;
  if (y == 1) {
    dummy(&x);
  }
  dummy(&x);
  y += x;
}


x86 assembly (clang, -O0):
<paths_unsure_multi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1132 <paths_unsure_multi+0x22>
lea    -0x4(%rbp),%rdi
call   1030 <dummy@plt>
lea    -0x4(%rbp),%rdi
call   1030 <dummy@plt>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<paths_unsure_multi>:
push   %rax
lea    0x4(%rsp),%rdi
call   1030 <dummy@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @paths_unsure_multi() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @dummy(i32* %1)
br label %7
7: ; preds = %5, %0
%8 = call i32 @dummy(i32* %1)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = add nsw i32 %10, %9
store i32 %11, i32* %2
ret void
}

LLVM IR (-O2):
define void @paths_unsure_multi() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @dummy(i32* %1)
ret void
}
int test_imm_43int16_mem(short *val) {
  return ((*val) & (0x43 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_43int16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0x43,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_43int16_mem>:
testb  $0x43,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_43int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 67
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int, void *);
int /*<<< orphan*/ stderr;
void test_process_init(int fd, int client_p, void *apparg) {
  fprintf(stderr, "test_process_init(fd = %d, client_p = %d, apparg = %p)\n",
          fd, client_p, apparg);
}


x86 assembly (clang, -O0):
<test_process_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    0x2eb7(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%r8
lea    0xec4(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_process_init>:
mov    %rdx,%r8
mov    %esi,%ecx
mov    %edi,%edx
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
lea    0xed9(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [56 x i8] c"test_process_init(fd = %d, client_p = %d, apparg = %p)\0A\00"
define void @test_process_init(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* @stderr
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9, i8* %10)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [56 x i8] c"test_process_init(fd = %d, client_p = %d, apparg = %p)\0A\00"
define void @test_process_init(i32 %0, i32 %1, i8* %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i8* %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
uint64_t dtoi(const double x) {
  union {
    uint64_t i;
    double d;
  } u;
  u.d = x;
  return u.i;
}


x86 assembly (clang, -O0):
<dtoi>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dtoi>:
movq   %xmm0,%rax
ret

LLVM IR (-O0):
%union.anon = type { double }
define i32 @dtoi(double %0) {
%2 = alloca double
%3 = alloca %union.anon
store double %0, double* %2
%4 = load double, double* %2
%5 = bitcast %union.anon* %3 to double*
store double %4, double* %5
%6 = bitcast %union.anon* %3 to i32*
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @dtoi(double %0) {
%2 = bitcast double %0 to i64
%3 = trunc i64 %2 to i32
ret i32 %3
}
double pid(double e) {
  double u = 1;
  return u;
}


x86 assembly (clang, -O0):
<pid>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<pid>:
movsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @pid(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
store double 1.000000e+00, double* %3
%4 = load double, double* %3
ret double %4
}

LLVM IR (-O2):
define double @pid(double %0) {
ret double 1.000000e+00
}
OP(fd, d4) { op_d4(); }


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @op_d4()
ret i32 undef
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ free(int *);
int new_integer();
int *new_integer_ptr();
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("New integer from the stack: %d\n", new_integer());
  int *num = new_integer_ptr();
  printf("New integer from the stack return pointer: %d\n", *num);
  free(num);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <new_integer@plt>
mov    %eax,%esi
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <new_integer_ptr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1060 <new_integer@plt>
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <new_integer_ptr@plt>
mov    %rax,%rbx
mov    (%rax),%esi
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x2e63(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"New integer from the stack: %d\0A\00"
@.str.1 = [47 x i8] c"New integer from the stack return pointer: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32 (...) @new_integer()
%4 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32* (...) @new_integer_ptr()
store i32* %5, i32** %2
%6 = load i32*, i32** %2
%7 = load i32, i32* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = load i32*, i32** %2
%10 = call i32 @free(i32* %9)
%11 = load i32, i32* @EXIT_SUCCESS
ret i32 %11
}

LLVM IR (-O2):
@.str = [32 x i8] c"New integer from the stack: %d\0A\00"
@.str.1 = [47 x i8] c"New integer from the stack return pointer: %d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @new_integer()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32* (...) @new_integer_ptr()
%4 = load i32, i32* %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = tail call i32 @free(i32* %3)
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}
int ft_sqrt(int nb) {
  int div;
  if (nb <= 0)
    return (0);
  if (nb == 1)
    return (1);
  div = 2;
  while (div < nb / div)
    div++;
  if (div * div == nb)
    return (div);
  return (0);
}


x86 assembly (clang, -O0):
<ft_sqrt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     111d <ft_sqrt+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1184 <ft_sqrt+0x84>
cmpl   $0x1,-0x8(%rbp)
jne    1133 <ft_sqrt+0x33>
movl   $0x1,-0x4(%rbp)
jmp    1184 <ft_sqrt+0x84>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jge    1162 <ft_sqrt+0x62>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <ft_sqrt+0x3a>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    117d <ft_sqrt+0x7d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1184 <ft_sqrt+0x84>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_sqrt>:
test   %edi,%edi
jle    1139 <ft_sqrt+0x39>
mov    $0x1,%eax
cmp    $0x1,%edi
je     1138 <ft_sqrt+0x38>
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ecx
mov    %edi,%eax
cltd
idiv   %ecx
cmp    %eax,%ecx
jl     1120 <ft_sqrt+0x20>
mov    %ecx,%edx
imul   %ecx,%edx
xor    %eax,%eax
cmp    %edi,%edx
cmove  %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_sqrt(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = icmp eq i32 %0, 1
br i1 %4, label %14, label %5
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ 2, %3 ]
%7 = sdiv i32 %0, %6
%8 = icmp slt i32 %6, %7
%9 = add nuw nsw i32 %6, 1
br i1 %8, label %5, label %10
10: ; preds = %5
%11 = mul nsw i32 %6, %6
%12 = icmp eq i32 %11, %0
%13 = select i1 %12, i32 %6, i32 0
br label %14
14: ; preds = %10, %3, %1
%15 = phi i32 [ 0, %1 ], [ 1, %3 ], [ %13, %10 ]
ret i32 %15
}
void swap(int arr[], int a, int b) {
  int t = arr[a];
  arr[a] = arr[b];
  arr[b] = t;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

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

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
int main() {
  struct S {
    unsigned a : 3;
    signed b : 3;
    int c : 3;
  };
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void print_help(void) {
  puts("Usage: feldgenerator [--spread spread] [--scale scale] infile outfile");
}


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

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

LLVM IR (-O0):
@.str = [70 x i8] c"Usage: feldgenerator [--spread spread] [--scale scale] infile outfile\00"
define void @print_help() {
%1 = call i32 @puts(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [70 x i8] c"Usage: feldgenerator [--spread spread] [--scale scale] infile outfile\00"
define void @print_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef scalar_t__ const wchar_t;

/* Variables and functions */
wchar_t *(wmemrchr)(const wchar_t *segment, wchar_t c, size_t size) {
  while (size--)
    if (segment[size] == c)
      return segment + size;
  return NULL;
}


x86 assembly (clang, -O0):
<wmemrchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
cmp    $0x0,%rax
je     115c <wmemrchr+0x5c>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmp    -0x18(%rbp),%rax
jne    1157 <wmemrchr+0x57>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1164 <wmemrchr+0x64>
jmp    1110 <wmemrchr+0x10>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wmemrchr>:
lea    (%rdi,%rdx,8),%rcx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
sub    $0x1,%rdx
jb     1124 <wmemrchr+0x24>
lea    -0x8(%rcx),%rax
cmp    %rsi,-0x8(%rcx)
mov    %rax,%rcx
jne    1110 <wmemrchr+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64* @wmemrchr(i64* %0, i64 %1, i64 %2) {
br label %4
4: ; preds = %8, %3
%5 = phi i64 [ %2, %3 ], [ %6, %8 ]
%6 = add i64 %5, -1
%7 = icmp eq i64 %5, 0
br i1 %7, label %14, label %8
8: ; preds = %4
%9 = getelementptr inbounds i64, i64* %0, i64 %6
%10 = load i64, i64* %9
%11 = icmp eq i64 %10, %1
br i1 %11, label %12, label %4
12: ; preds = %8
%13 = getelementptr inbounds i64, i64* %0, i64 %6
br label %14
14: ; preds = %4, %12
%15 = phi i64* [ %13, %12 ], [ null, %4 ]
ret i64* %15
}
extern __attribute__((gnu_)) int NewhashpjwAppendChar(char c, int _h) {
  unsigned h = _h, g;
  h = (h << 4) + c;
  if ((g = h & 0xf0000000) != 0) {
    h = h ^ (g >> 24);
    h = h ^ g;
  }
  return h;
}


x86 assembly (clang, -O0):
<NewhashpjwAppendChar>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x4,%eax
movsbl -0x1(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xf0000000,%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     114d <NewhashpjwAppendChar+0x4d>
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
shr    $0x18,%ecx
xor    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<NewhashpjwAppendChar>:
shl    $0x4,%esi
lea    (%rsi,%rdi,1),%ecx
mov    %ecx,%edx
and    $0xf0000000,%edx
mov    %edx,%esi
shr    $0x18,%esi
mov    %ecx,%eax
and    $0xfffffff,%eax
xor    %esi,%eax
test   %edx,%edx
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @NewhashpjwAppendChar(i8 signext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = shl i32 %8, 4
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = add i32 %9, %11
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = and i32 %13, -268435456
store i32 %14, i32* %6
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %24
16: ; preds = %2
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = lshr i32 %18, 24
%20 = xor i32 %17, %19
store i32 %20, i32* %5
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = xor i32 %21, %22
store i32 %23, i32* %5
br label %24
24: ; preds = %16, %2
%25 = load i32, i32* %5
ret i32 %25
}

LLVM IR (-O2):
define i32 @NewhashpjwAppendChar(i8 signext %0, i32 %1) {
%3 = shl i32 %1, 4
%4 = sext i8 %0 to i32
%5 = add i32 %3, %4
%6 = and i32 %5, -268435456
%7 = icmp eq i32 %6, 0
%8 = lshr exact i32 %6, 24
%9 = and i32 %5, 268435455
%10 = xor i32 %9, %8
%11 = select i1 %7, i32 %5, i32 %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ ffpmsg(char *);
void bz_internal_error(int errcode) {
  ffpmsg("bzip2 returned an internal error");
  ffpmsg("This should never happen");
  return;
}


x86 assembly (clang, -O0):
<bz_internal_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <ffpmsg@plt>
lea    0xef3(%rip),%rdi
call   1030 <ffpmsg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bz_internal_error>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <ffpmsg@plt>
lea    0xefd(%rip),%rdi
pop    %rax
jmp    1030 <ffpmsg@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"bzip2 returned an internal error\00"
@.str.1 = [25 x i8] c"This should never happen\00"
define void @bz_internal_error(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @ffpmsg(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @ffpmsg(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"bzip2 returned an internal error\00"
@.str.1 = [25 x i8] c"This should never happen\00"
define void @bz_internal_error(i32 %0) {
%2 = tail call i32 @ffpmsg(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @ffpmsg(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
ret void
}