xunge/DecIR huggingface dataset:
double limb_darken(double mu) {
  double a0, a1, a2;
  double I;
  a0 = 0.36795341;
  a1 = 0.8794135;
  a2 = -0.23355535;
  I = a0 + a1 * mu + a2 * mu * mu;
  return I;
}


x86 assembly (clang, -O0):
<limb_darken>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeff(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeea(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xed5(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<limb_darken>:
movsd  0xef8(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xef4(%rip),%xmm1
movsd  0xef4(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @limb_darken(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %2
store double 0x3FD78C8C7599B51D, double* %3
store double 0x3FEC2427C7C5260F, double* %4
store double 0xBFCDE5244707258E, double* %5
%7 = load double, double* %3
%8 = load double, double* %4
%9 = load double, double* %2
%10 = call double @llvm.fmuladd.f64(double %8, double %9, double %7)
%11 = load double, double* %5
%12 = load double, double* %2
%13 = fmul double %11, %12
%14 = load double, double* %2
%15 = call double @llvm.fmuladd.f64(double %13, double %14, double %10)
store double %15, double* %6
%16 = load double, double* %6
ret double %16
}

LLVM IR (-O2):
define double @limb_darken(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double 0x3FEC2427C7C5260F, double 0x3FD78C8C7599B51D)
%3 = fmul double %0, 0xBFCDE5244707258E
%4 = tail call double @llvm.fmuladd.f64(double %3, double %0, double %2)
ret double %4
}
/* Variables and functions */
unsigned int f32(unsigned int);
unsigned int f33(unsigned int a) { return f32(f32(a)); }


x86 assembly (clang, -O0):
<f33>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <f32@plt>
mov    %eax,%edi
call   1030 <f32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f33>:
push   %rax
call   1030 <f32@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <f32@plt>

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

LLVM IR (-O2):
define i32 @f33(i32 %0) {
%2 = tail call i32 @f32(i32 %0)
%3 = tail call i32 @f32(i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void print_usage_exit() {
  printf("Usage: hackbench [-p|--pipe] [-s|--datasize <bytes>] [-l|--loops "
         "<num loops>]\n"
         "\t\t [-g|--groups <num groups] [-f|--fds <num fds>]\n"
         "\t\t [-T|--threads] [-P|--process] [--help]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<print_usage_exit>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_usage_exit>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [171 x i8] c"Usage: hackbench [-p|--pipe] [-s|--datasize <bytes>] [-l|--loops <num loops>]\0A\09\09 [-g|--groups <num groups] [-f|--fds <num fds>]\0A\09\09 [-T|--threads] [-P|--process] [--help]\0A\00"
define void @print_usage_exit() {
%1 = call i32 @printf(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [170 x i8] c"Usage: hackbench [-p|--pipe] [-s|--datasize <bytes>] [-l|--loops <num loops>]\0A\09\09 [-g|--groups <num groups] [-f|--fds <num fds>]\0A\09\09 [-T|--threads] [-P|--process] [--help]\00"
define void @print_usage_exit() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([170 x i8], [170 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
int wide_strlen(short *s) {
  int i;
  for (i = 0; s[i] != 0; i++)
    ;
  return (i);
}


x86 assembly (clang, -O0):
<wide_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movswl (%rax,%rcx,2),%eax
cmp    $0x0,%eax
je     1137 <wide_strlen+0x37>
jmp    1129 <wide_strlen+0x29>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <wide_strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wide_strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpw   $0x0,(%rdi)
lea    0x2(%rdi),%rdi
jne    1110 <wide_strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @wide_strlen(i16* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i16, i16* %0, i64 %3
%5 = load i16, i16* %4
%6 = icmp eq i16 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ __cpuid(unsigned int *, int);
int check_for_aes_instructions() {
  unsigned int cpuid_results[4];
  int yes = 1, no = 0;
  __cpuid(cpuid_results, 1);
  if (cpuid_results[2] & (1 << 25))
    return yes;
  return no;
}


x86 assembly (clang, -O0):
<check_for_aes_instructions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x1,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x1,%esi
call   1030 <__cpuid@plt>
mov    -0x18(%rbp),%eax
and    $0x2000000,%eax
cmp    $0x0,%eax
je     1150 <check_for_aes_instructions+0x40>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1156 <check_for_aes_instructions+0x46>
mov    -0x28(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_for_aes_instructions>:
sub    $0x18,%rsp
mov    %rsp,%rdi
mov    $0x1,%esi
call   1030 <__cpuid@plt>
mov    0x8(%rsp),%eax
shr    $0x19,%eax
and    $0x1,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @check_for_aes_instructions() {
%1 = alloca i32
%2 = alloca [4 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 1, i32* %3
store i32 0, i32* %4
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%6 = call i32 @__cpuid(i32* %5, i32 1)
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 2
%8 = load i32, i32* %7
%9 = and i32 %8, 33554432
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = load i32, i32* %3
store i32 %12, i32* %1
br label %15
13: ; preds = %0
%14 = load i32, i32* %4
store i32 %14, i32* %1
br label %15
15: ; preds = %13, %11
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
define i32 @check_for_aes_instructions() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @__cpuid(i32* %3, i32 1)
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%6 = load i32, i32* %5
%7 = lshr i32 %6, 25
%8 = and i32 %7, 1
ret i32 %8
}
void unescape(char *str) {
  char *dst = str;
  char *curr = str;
  while (*(curr) != '\0') {
    if (*curr != '\\')
      *(dst++) = *curr;
    curr++;
  }
  *dst = '\0';
}


x86 assembly (clang, -O0):
<unescape>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1160 <unescape+0x60>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
je     114f <unescape+0x4f>
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1118 <unescape+0x18>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<unescape>:
mov    %rdi,%rax
jmp    1114 <unescape+0x14>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x5c,%cl
je     1110 <unescape+0x10>
test   %cl,%cl
je     1128 <unescape+0x28>
mov    %cl,(%rdi)
add    $0x1,%rdi
jmp    1110 <unescape+0x10>
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @unescape(i8* nocapture %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %9, %8 ]
%4 = phi i8* [ %0, %1 ], [ %10, %8 ]
%5 = load i8, i8* %4
switch i8 %5, label %6 [
i8 0, label %11
i8 92, label %8
]
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
store i8 %5, i8* %3
br label %8
8: ; preds = %2, %6
%9 = phi i8* [ %7, %6 ], [ %3, %2 ]
%10 = getelementptr inbounds i8, i8* %4, i64 1
br label %2
11: ; preds = %2
store i8 0, i8* %3
ret void
}
/* Variables and functions */
int Cmd_Argc();
int /*<<< orphan*/ Com_Printf(char *);
void Cmd_SimulateHang_f(void) {
  if (Cmd_Argc() != 2) {
    Com_Printf("Usage: hang <msec>\n");
  }
}


x86 assembly (clang, -O0):
<Cmd_SimulateHang_f>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <Cmd_Argc@plt>
cmp    $0x2,%eax
je     1140 <Cmd_SimulateHang_f+0x20>
lea    0xec5(%rip),%rdi
call   1040 <Com_Printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cmd_SimulateHang_f>:
push   %rax
xor    %eax,%eax
call   1030 <Cmd_Argc@plt>
cmp    $0x2,%eax
jne    112f <Cmd_SimulateHang_f+0xf>
pop    %rax
ret
lea    0xeca(%rip),%rdi
pop    %rax
jmp    1040 <Com_Printf@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Usage: hang <msec>\0A\00"
define void @Cmd_SimulateHang_f() {
%1 = call i32 (...) @Cmd_Argc()
%2 = icmp ne i32 %1, 2
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @Com_Printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"Usage: hang <msec>\0A\00"
define void @Cmd_SimulateHang_f() {
%1 = tail call i32 (...) @Cmd_Argc()
%2 = icmp eq i32 %1, 2
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @Com_Printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret void
}
void foo2() {}


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

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

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

LLVM IR (-O2):
define void @foo2() {
ret void
}
/* Type definitions */
struct ut {
  short s;
  char *c;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  union ut {
    short s;
    char c[2];
  } u;
  if (sizeof(short) == 2) {
    u.s = 0x0102;
    if (u.c[0] == 1 && u.c[1] == 2) {
      printf("big enidan/n");
    } else if (u.c[0] == 2 && u.c[1] == 1) {
      printf("little endian.\n");
    }
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movw   $0x102,-0x8(%rbp)
movsbl -0x8(%rbp),%eax
cmp    $0x1,%eax
jne    1150 <main+0x40>
movsbl -0x7(%rbp),%eax
cmp    $0x2,%eax
jne    1150 <main+0x40>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
jmp    117b <main+0x6b>
movsbl -0x8(%rbp),%eax
cmp    $0x2,%eax
jne    1176 <main+0x66>
movsbl -0x7(%rbp),%eax
cmp    $0x1,%eax
jne    1176 <main+0x66>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
jmp    117b <main+0x6b>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%union.ut = type { i16 }
@.str = [13 x i8] c"big enidan/n\00"
@.str.1 = [16 x i8] c"little endian.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %union.ut
store i32 0, i32* %1
%3 = bitcast %union.ut* %2 to i16*
store i16 258, i16* %3
%4 = bitcast %union.ut* %2 to [2 x i8]*
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %17
9: ; preds = %0
%10 = bitcast %union.ut* %2 to [2 x i8]*
%11 = getelementptr inbounds [2 x i8], [2 x i8]* %10, i64 0, i64 1
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %32
17: ; preds = %9, %0
%18 = bitcast %union.ut* %2 to [2 x i8]*
%19 = getelementptr inbounds [2 x i8], [2 x i8]* %18, i64 0, i64 0
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %31
23: ; preds = %17
%24 = bitcast %union.ut* %2 to [2 x i8]*
%25 = getelementptr inbounds [2 x i8], [2 x i8]* %24, i64 0, i64 1
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %31
29: ; preds = %23
%30 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %31
31: ; preds = %29, %23, %17
br label %32
32: ; preds = %31, %15
ret i32 0
}

LLVM IR (-O2):
@str = [15 x i8] c"little endian.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ EVP_MD_CTX;

/* Variables and functions */
int final(EVP_MD_CTX *ctx, unsigned char *md) { return 1; }


x86 assembly (clang, -O0):
<final>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @final(i32* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 1
}
void foo214(int p) {}


x86 assembly (clang, -O0):
<foo214>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @foo214(i32 %0) {
ret void
}
/* Type definitions */
struct forf_env {
  int dummy;
};

/* Variables and functions */
long forf_pop_num(struct forf_env *);
int /*<<< orphan*/ forf_push_num(struct forf_env *, long);
void forf_proc_dup(struct forf_env *env) {
  long a = forf_pop_num(env);
  forf_push_num(env, a);
  forf_push_num(env, a);
}


x86 assembly (clang, -O0):
<forf_proc_dup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <forf_pop_num@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <forf_push_num@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <forf_push_num@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<forf_proc_dup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <forf_pop_num@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <forf_push_num@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <forf_push_num@plt>

LLVM IR (-O0):
%struct.forf_env = type { i32 }
define void @forf_proc_dup(%struct.forf_env* %0) {
%2 = alloca %struct.forf_env*
%3 = alloca i64
store %struct.forf_env* %0, %struct.forf_env** %2
%4 = load %struct.forf_env*, %struct.forf_env** %2
%5 = call i64 @forf_pop_num(%struct.forf_env* %4)
store i64 %5, i64* %3
%6 = load %struct.forf_env*, %struct.forf_env** %2
%7 = load i64, i64* %3
%8 = call i32 @forf_push_num(%struct.forf_env* %6, i64 %7)
%9 = load %struct.forf_env*, %struct.forf_env** %2
%10 = load i64, i64* %3
%11 = call i32 @forf_push_num(%struct.forf_env* %9, i64 %10)
ret void
}

LLVM IR (-O2):
%struct.forf_env = type { i32 }
define void @forf_proc_dup(%struct.forf_env* %0) {
%2 = tail call i64 @forf_pop_num(%struct.forf_env* %0)
%3 = tail call i32 @forf_push_num(%struct.forf_env* %0, i64 %2)
%4 = tail call i32 @forf_push_num(%struct.forf_env* %0, i64 %2)
ret void
}
/* Variables and functions */
int exp(double);
int fabs(double);
double func(double x, double y) {
  return fabs(y + y * y) / ((1. + exp(x)) * (1. + y * y));
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <exp@plt>
movsd  -0x18(%rbp),%xmm0
cvtsi2sd %eax,%xmm2
movsd  0xe8e(%rip),%xmm1
addsd  %xmm2,%xmm1
movsd  -0x10(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm3
mulsd  %xmm3,%xmm2
movsd  0xe74(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
sub    $0x18,%rsp
movsd  %xmm0,(%rsp)
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1040 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0xe96(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0x10(%rsp),%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm2
movsd  0x8(%rsp),%xmm0
divsd  %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @func(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double, double* %4
%7 = load double, double* %4
%8 = call double @llvm.fmuladd.f64(double %6, double %7, double %5)
%9 = call i32 @fabs(double %8)
%10 = sitofp i32 %9 to double
%11 = load double, double* %3
%12 = call i32 @exp(double %11)
%13 = sitofp i32 %12 to double
%14 = fadd double 1.000000e+00, %13
%15 = load double, double* %4
%16 = load double, double* %4
%17 = call double @llvm.fmuladd.f64(double %15, double %16, double 1.000000e+00)
%18 = fmul double %14, %17
%19 = fdiv double %10, %18
ret double %19
}

LLVM IR (-O2):
define double @func(double %0, double %1) {
%3 = tail call double @llvm.fmuladd.f64(double %1, double %1, double %1)
%4 = tail call i32 @fabs(double %3)
%5 = sitofp i32 %4 to double
%6 = tail call i32 @exp(double %0)
%7 = sitofp i32 %6 to double
%8 = fadd double %7, 1.000000e+00
%9 = tail call double @llvm.fmuladd.f64(double %1, double %1, double 1.000000e+00)
%10 = fmul double %9, %8
%11 = fdiv double %5, %10
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ cli();
void irq_disable(void) { cli(); }


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

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

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

LLVM IR (-O2):
define void @irq_disable() {
%1 = tail call i32 (...) @cli()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Print(char);
int /*<<< orphan*/ Right();
int write_to_tape(char *string) {
  int idx;
  char *inputc;
  for (inputc = string, idx = 0; *inputc; inputc++, idx++) {
    Print(*inputc);
    Right();
  }
  return idx;
}


x86 assembly (clang, -O0):
<write_to_tape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1175 <write_to_tape+0x55>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1040 <Print@plt>
mov    $0x0,%al
call   1030 <Right@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113b <write_to_tape+0x1b>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_to_tape>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     114f <write_to_tape+0x2f>
mov    %rdi,%r14
xor    %ebx,%ebx
nop
movsbl %al,%edi
call   1040 <Print@plt>
xor    %eax,%eax
call   1030 <Right@plt>
movzbl 0x1(%r14,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <write_to_tape+0x10>
jmp    1151 <write_to_tape+0x31>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @write_to_tape(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %10, %4 ], [ %0, %1 ]
%7 = phi i32 [ %11, %4 ], [ 0, %1 ]
%8 = tail call i32 @Print(i8 signext %5)
%9 = tail call i32 (...) @Right()
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = add nuw nsw i32 %7, 1
%12 = load i8, i8* %10
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 0, %1 ], [ %11, %4 ]
ret i32 %15
}
/* Variables and functions */
double tan(double);
double test_func_2(double x) { return x / 2.0 - tan(x); }


x86 assembly (clang, -O0):
<test_func_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <tan@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_func_2>:
push   %rax
movsd  0xee7(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
call   1030 <tan@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @test_func_2(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double %3, 2.000000e+00
%5 = load double, double* %2
%6 = call double @tan(double %5)
%7 = fsub double %4, %6
ret double %7
}

LLVM IR (-O2):
define double @test_func_2(double %0) {
%2 = fmul double %0, 5.000000e-01
%3 = tail call double @tan(double %0)
%4 = fsub double %2, %3
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ fwrite(char const *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int strlen(char const *);
void log_stderr(const char *message, void *data __attribute__((unused))) {
  fwrite(message, strlen(message), 1, stderr);
  fwrite("\n", sizeof("\n") - 1, 1, stderr);
}


x86 assembly (clang, -O0):
<log_stderr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
mov    0x2e92(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%edx
call   1040 <fwrite@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%ecx
lea    0xe96(%rip),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1040 <fwrite@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_stderr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    0x2ead(%rip),%r14
mov    (%r14),%ecx
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x1,%edx
call   1040 <fwrite@plt>
mov    (%r14),%ecx
lea    0xeb1(%rip),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fwrite@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
define void @log_stderr(i8* %0, i8* nocapture readnone %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 @fwrite(i8* %0, i32 %3, i32 1, i32 %4)
%6 = load i32, i32* @stderr
%7 = tail call i32 @fwrite(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1, i32 1, i32 %6)
ret void
}
int security_shm_alloc(struct shmid_kernel *shp) { return 0; }


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

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

LLVM IR (-O0):
%struct.shmid_kernel = type opaque
define i32 @security_shm_alloc(%struct.shmid_kernel* %0) {
%2 = alloca %struct.shmid_kernel*
store %struct.shmid_kernel* %0, %struct.shmid_kernel** %2
ret i32 0
}

LLVM IR (-O2):
%struct.shmid_kernel = type opaque
define i32 @security_shm_alloc(%struct.shmid_kernel* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
double sqrt(int /*<<< orphan*/);
int /*<<< orphan*/ squaredNorm(int, double const *);
double norm(int dimensions, const double *v) {
  return sqrt(squaredNorm(dimensions, v));
}


x86 assembly (clang, -O0):
<norm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <squaredNorm@plt>
mov    %eax,%edi
call   1040 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define double @norm(i32 %0, double* %1) {
%3 = tail call i32 @squaredNorm(i32 %0, double* %1)
%4 = tail call double @sqrt(i32 %3)
ret double %4
}
/* Variables and functions */
scalar_t__ KIONIX_ACCEL_write_byte(int, int);
int KIONIX_ACCEL_tilt_timer(int tilt_timer) {
  int status;
  if (KIONIX_ACCEL_write_byte(0x28, tilt_timer) == 0) {
    status = 0;
  } else
    status = 1;
  return status;
}


x86 assembly (clang, -O0):
<KIONIX_ACCEL_tilt_timer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x28,%edi
call   1030 <KIONIX_ACCEL_write_byte@plt>
cmp    $0x0,%rax
jne    113e <KIONIX_ACCEL_tilt_timer+0x2e>
movl   $0x0,-0x8(%rbp)
jmp    1145 <KIONIX_ACCEL_tilt_timer+0x35>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<KIONIX_ACCEL_tilt_timer>:
push   %rax
mov    %edi,%esi
mov    $0x28,%edi
call   1030 <KIONIX_ACCEL_write_byte@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @KIONIX_ACCEL_tilt_timer(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 @KIONIX_ACCEL_write_byte(i32 40, i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %3
br label %9
8: ; preds = %1
store i32 1, i32* %3
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @KIONIX_ACCEL_tilt_timer(i32 %0) {
%2 = tail call i64 @KIONIX_ACCEL_write_byte(i32 40, i32 %0)
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
char *test_func_00(char *p, int *x) {
  int r = 0;
  r += *p++;
  r += *p++;
  *x = r;
  return p;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
movsbl (%rdi),%ecx
movsbl 0x1(%rdi),%edx
lea    0x2(%rdi),%rax
add    %ecx,%edx
mov    %edx,(%rsi)
ret

LLVM IR (-O0):
define i8* @test_func_00(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
store i32 0, i32* %5
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %3
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
%10 = load i32, i32* %5
%11 = add nsw i32 %10, %9
store i32 %11, i32* %5
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %3
%14 = load i8, i8* %12
%15 = sext i8 %14 to i32
%16 = load i32, i32* %5
%17 = add nsw i32 %16, %15
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = load i32*, i32** %4
store i32 %18, i32* %19
%20 = load i8*, i8** %3
ret i8* %20
}

LLVM IR (-O2):
define i8* @test_func_00(i8* %0, i32* nocapture writeonly %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %0
%5 = sext i8 %4 to i32
%6 = getelementptr inbounds i8, i8* %0, i64 2
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
%9 = add nsw i32 %8, %5
store i32 %9, i32* %1
ret i8* %6
}
int compare(const void *a, const void *b) {
  double diff = *(double *)a - *(double *)b;
  if (diff < 0) {
    return 1;
  } else if (diff > 0) {
    return -1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    113b <compare+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1160 <compare+0x60>
movsd  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1159 <compare+0x59>
movl   $0xffffffff,-0x4(%rbp)
jmp    1160 <compare+0x60>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare>:
movsd  (%rdi),%xmm0
subsd  (%rsi),%xmm0
xorpd  %xmm1,%xmm1
xor    %ecx,%ecx
ucomisd %xmm1,%xmm0
seta   %cl
neg    %ecx
ucomisd %xmm0,%xmm1
mov    $0x1,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @compare(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = bitcast i8* %7 to double*
%9 = load double, double* %8
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to double*
%12 = load double, double* %11
%13 = fsub double %9, %12
store double %13, double* %6
%14 = load double, double* %6
%15 = fcmp olt double %14, 0.000000e+00
br i1 %15, label %16, label %17
16: ; preds = %2
store i32 1, i32* %3
br label %22
17: ; preds = %2
%18 = load double, double* %6
%19 = fcmp ogt double %18, 0.000000e+00
br i1 %19, label %20, label %21
20: ; preds = %17
store i32 -1, i32* %3
br label %22
21: ; preds = %17
store i32 0, i32* %3
br label %22
22: ; preds = %21, %20, %16
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fsub double %4, %6
%8 = fcmp olt double %7, 0.000000e+00
%9 = fcmp ogt double %7, 0.000000e+00
%10 = sext i1 %9 to i32
%11 = select i1 %8, i32 1, i32 %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ _IO(char, int);
int /*<<< orphan*/ close(int);
int ioctl(int, int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/);
int main(void) {
  int state = -1;
  int dev = open("/dev/r1Pmu", O_RDONLY);
  state = ioctl(dev, _IO('A', 2));
  close(dev);
  return state;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    0x2e8b(%rip),%rax
mov    (%rax),%esi
lea    0xe9a(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x41,%edi
mov    $0x2,%esi
call   1030 <_IO@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%esi
call   1040 <ioctl@plt>
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <close@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    0x2e9e(%rip),%rax
mov    (%rax),%esi
lea    0xead(%rip),%rdi
call   1060 <open@plt>
mov    %eax,%ebx
mov    $0x41,%edi
mov    $0x2,%esi
call   1030 <_IO@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <ioctl@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1050 <close@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"/dev/r1Pmu\00"
@O_RDONLY = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %2
%4 = load i32, i32* @O_RDONLY
%5 = call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @_IO(i8 signext 65, i32 2)
%8 = call i32 @ioctl(i32 %6, i32 %7)
store i32 %8, i32* %2
%9 = load i32, i32* %3
%10 = call i32 @close(i32 %9)
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@.str = [11 x i8] c"/dev/r1Pmu\00"
@O_RDONLY = global i32 0
define i32 @main() {
%1 = load i32, i32* @O_RDONLY
%2 = tail call i32 @open(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @_IO(i8 signext 65, i32 2)
%4 = tail call i32 @ioctl(i32 %2, i32 %3)
%5 = tail call i32 @close(i32 %2)
ret i32 %4
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char *);
int strlen(char const *);
int xdg_mime_is_super_type(const char *mime) {
  int length;
  const char *type;
  length = strlen(mime);
  type = &(mime[length - 2]);
  if (strcmp(type, "/*") == 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<xdg_mime_is_super_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1172 <xdg_mime_is_super_type+0x52>
movl   $0x1,-0x4(%rbp)
jmp    1179 <xdg_mime_is_super_type+0x59>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdg_mime_is_super_type>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
lea    (%rax,%rbx,1),%rdi
add    $0xfffffffffffffffe,%rdi
lea    0xec6(%rip),%rsi
call   1040 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"/*\00"
define i32 @xdg_mime_is_super_type(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %4
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %8, i64 %11
store i8* %12, i8** %5
%13 = load i8*, i8** %5
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %1
store i32 1, i32* %2
br label %18
17: ; preds = %1
store i32 0, i32* %2
br label %18
18: ; preds = %17, %16
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@.str = [3 x i8] c"/*\00"
define i32 @xdg_mime_is_super_type(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, -2
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}
void gdk_cursor_ref() {}


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

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

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

LLVM IR (-O2):
define void @gdk_cursor_ref() {
ret void
}
/* Variables and functions */
int rand();
int roll_dice() { return (rand() % (6 + 6 - 1)) + 2; }


x86 assembly (clang, -O0):
<roll_dice>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0xb,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<roll_dice>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,2),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @roll_dice() {
%1 = call i32 (...) @rand()
%2 = srem i32 %1, 11
%3 = add nsw i32 %2, 2
ret i32 %3
}

LLVM IR (-O2):
define i32 @roll_dice() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 11
%3 = add nsw i32 %2, 2
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
int /*<<< orphan*/ _exit(int);
int chown(const char *path, uid_t owner, gid_t group) {
  _exit(-1);
  return -1;
}


x86 assembly (clang, -O0):
<chown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<chown>:
push   %rax
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define i32 @chown(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = call i32 @_exit(i32 -1)
unreachable
}

LLVM IR (-O2):
define i32 @chown(i8* nocapture readnone %0, i32 %1, i32 %2) {
%4 = tail call i32 @_exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ commonFunction();
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("Program started\n");
  commonFunction();
  printf("Program exited\n");
  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)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <commonFunction@plt>
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [17 x i8] c"Program started\0A\00"
@.str.1 = [16 x i8] c"Program exited\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 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @commonFunction()
%8 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [16 x i8] c"Program started\00"
@str.2 = [15 x i8] c"Program exited\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @commonFunction()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ enablePin(int, int, int);
int /*<<< orphan*/ setPin(int, int /*<<< orphan*/);
int /*<<< orphan*/ systickEnable(int);
void blink(void) {
  enablePin(1, 0, 0x80);
  enablePin(1, 1, 0x80);
  setPin(1, 0);
  systickEnable(8000000 - 1);
}


x86 assembly (clang, -O0):
<blink>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
xor    %esi,%esi
mov    $0x80,%edx
call   1030 <enablePin@plt>
mov    $0x1,%esi
mov    $0x80,%edx
mov    %esi,%edi
call   1030 <enablePin@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <setPin@plt>
mov    $0x7a11ff,%edi
call   1040 <systickEnable@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<blink>:
push   %rax
mov    $0x1,%edi
xor    %esi,%esi
mov    $0x80,%edx
call   1030 <enablePin@plt>
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x80,%edx
call   1030 <enablePin@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <setPin@plt>
mov    $0x7a11ff,%edi
pop    %rax
jmp    1040 <systickEnable@plt>

LLVM IR (-O0):
define void @blink() {
%1 = call i32 @enablePin(i32 1, i32 0, i32 128)
%2 = call i32 @enablePin(i32 1, i32 1, i32 128)
%3 = call i32 @setPin(i32 1, i32 0)
%4 = call i32 @systickEnable(i32 7999999)
ret void
}

LLVM IR (-O2):
define void @blink() {
%1 = tail call i32 @enablePin(i32 1, i32 0, i32 128)
%2 = tail call i32 @enablePin(i32 1, i32 1, i32 128)
%3 = tail call i32 @setPin(i32 1, i32 0)
%4 = tail call i32 @systickEnable(i32 7999999)
ret void
}
hash(s) register char *s;
{
  register int h;
  h = 0;
  while (*s)
    h = h * 5 + *s++;
  return (h & 0xff);
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     113c <hash+0x3c>
imul   $0x5,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <hash+0xf>
mov    -0xc(%rbp),%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%al
test   %al,%al
je     1127 <hash+0x27>
add    $0x1,%rdi
xor    %ecx,%ecx
nopl   0x0(%rax)
lea    (%rcx,%rcx,4),%edx
movzbl %al,%ecx
add    %edx,%ecx
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <hash+0x10>
movzbl %cl,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = mul i32 %6, 5
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = zext i8 %5 to i32
%11 = add i32 %8, %10
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = and i32 %11, 255
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void platform_terminal_init(void) {
  puts("\x1b[2J");
  puts("\x1b[?25l");
}


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[2J\00"
@.str.1 = [7 x i8] c"\1B[?25l\00"
define void @platform_terminal_init() {
%1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[2J\00"
@.str.1 = [7 x i8] c"\1B[?25l\00"
define void @platform_terminal_init() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ GetCurrentDirectory(int, char *);
char *getwd(char *dir) {
  if (GetCurrentDirectory(260, dir) > 0)
    return dir;
  return NULL;
}


x86 assembly (clang, -O0):
<getwd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    $0x104,%edi
call   1030 <GetCurrentDirectory@plt>
cmp    $0x0,%rax
jle    1141 <getwd+0x31>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1149 <getwd+0x39>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getwd>:
push   %rbx
mov    %rdi,%rbx
mov    $0x104,%edi
mov    %rbx,%rsi
call   1030 <GetCurrentDirectory@plt>
xor    %ecx,%ecx
test   %rax,%rax
cmovg  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @getwd(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @GetCurrentDirectory(i32 260, i8* %4)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i8*, i8** %3
store i8* %8, i8** %2
br label %10
9: ; preds = %1
store i8* null, i8** %2
br label %10
10: ; preds = %9, %7
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
define i8* @getwd(i8* %0) {
%2 = tail call i64 @GetCurrentDirectory(i32 260, i8* %0)
%3 = icmp sgt i64 %2, 0
%4 = select i1 %3, i8* %0, i8* null
ret i8* %4
}