xunge/DecIR huggingface dataset:
/* Variables and functions */
float warp_cube(int);
float warp_ease_cubic(float t) {
  return (t < 0.5f) ? (warp_cube(t * 2) * 0.5f)
                    : (1 - warp_cube((1 - t) * 2) * 0.5f);
}


x86 assembly (clang, -O0):
<warp_ease_cubic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xedb(%rip),%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    115b <warp_ease_cubic+0x4b>
movss  0xed1(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
cvttss2si %xmm0,%edi
call   1030 <warp_cube@plt>
movss  0xeb3(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    11a7 <warp_ease_cubic+0x97>
movss  0xea1(%rip),%xmm0
subss  -0x4(%rbp),%xmm0
movss  0xe98(%rip),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1030 <warp_cube@plt>
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xe6e(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe66(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<warp_ease_cubic>:
push   %rax
movss  0xee7(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1135 <warp_ease_cubic+0x25>
addss  %xmm0,%xmm0
cvttss2si %xmm0,%edi
call   1030 <warp_cube@plt>
mulss  0xecd(%rip),%xmm0
pop    %rax
ret
movss  0xec7(%rip),%xmm1
subss  %xmm0,%xmm1
addss  %xmm1,%xmm1
cvttss2si %xmm1,%edi
call   1030 <warp_cube@plt>
mulss  0xeb2(%rip),%xmm0
addss  0xea6(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @warp_ease_cubic(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp olt float %3, 5.000000e-01
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load float, float* %2
%7 = fmul float %6, 2.000000e+00
%8 = fptosi float %7 to i32
%9 = call float @warp_cube(i32 %8)
%10 = fmul float %9, 5.000000e-01
br label %19
11: ; preds = %1
%12 = load float, float* %2
%13 = fsub float 1.000000e+00, %12
%14 = fmul float %13, 2.000000e+00
%15 = fptosi float %14 to i32
%16 = call float @warp_cube(i32 %15)
%17 = fneg float %16
%18 = call float @llvm.fmuladd.f32(float %17, float 5.000000e-01, float 1.000000e+00)
br label %19
19: ; preds = %11, %5
%20 = phi float [ %10, %5 ], [ %18, %11 ]
ret float %20
}

LLVM IR (-O2):
define float @warp_ease_cubic(float %0) {
%2 = fcmp olt float %0, 5.000000e-01
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = fmul float %0, 2.000000e+00
%5 = fptosi float %4 to i32
%6 = tail call float @warp_cube(i32 %5)
%7 = fmul float %6, 5.000000e-01
br label %15
8: ; preds = %1
%9 = fsub float 1.000000e+00, %0
%10 = fmul float %9, 2.000000e+00
%11 = fptosi float %10 to i32
%12 = tail call float @warp_cube(i32 %11)
%13 = fneg float %12
%14 = tail call float @llvm.fmuladd.f32(float %13, float 5.000000e-01, float 1.000000e+00)
br label %15
15: ; preds = %8, %3
%16 = phi float [ %7, %3 ], [ %14, %8 ]
ret float %16
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void fgPlatformRegisterDialDevice(const char *dial_device) {
  fprintf(stderr, "fgPlatformRegisterDialDevice: STUB\n");
}


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

x86 assembly (clang, -O2):
<fgPlatformRegisterDialDevice>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"fgPlatformRegisterDialDevice: STUB\0A\00"
define void @fgPlatformRegisterDialDevice(i8* nocapture readnone %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
ret void
}
void *rt_timer_create(void) {
  struct anon$69 *t;
  void *return_value_malloc$1;
  return_value_malloc$1 = malloc(40ul);
  t = (struct anon$69 *)return_value_malloc$1;
  memset((void *)t, 0, 40ul);
  return (void *)t;
}


x86 assembly (clang, -O0):
<rt_timer_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x28,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rt_timer_create>:
push   %rax
mov    $0x1,%edi
mov    $0x28,%esi
call   1030 <calloc@plt>
pop    %rcx
ret

LLVM IR (-O0):
%"struct.anon$69" = type opaque
define i8* @rt_timer_create() {
%1 = alloca %"struct.anon$69"*
%2 = alloca i8*
%3 = call i8* @malloc(i64 40)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to %"struct.anon$69"*
store %"struct.anon$69"* %5, %"struct.anon$69"** %1
%6 = load %"struct.anon$69"*, %"struct.anon$69"** %1
%7 = bitcast %"struct.anon$69"* %6 to i8*
%8 = load %"struct.anon$69"*, %"struct.anon$69"** %1
%9 = bitcast %"struct.anon$69"* %8 to i8*
ret i8* %9
}

LLVM IR (-O2):
define noalias i8* @rt_timer_create() {
%1 = call dereferenceable_or_null(40) i8* @calloc(i64 1, i64 40)
ret i8* %1
}
/* Variables and functions */
int rand();
unsigned int roll(unsigned int n) { return ((unsigned int)(rand() % 100) < n); }


x86 assembly (clang, -O0):
<roll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    -0x4(%rbp),%edx
setb   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roll>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
movslq %eax,%rcx
imul   $0x51eb851f,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rax
add    %edx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ecx
xor    %eax,%eax
cmp    %ebx,%ecx
setb   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @roll(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = srem i32 %3, 100
%5 = load i32, i32* %2
%6 = icmp ult i32 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @roll(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 100
%4 = icmp ult i32 %3, %0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int sum(int, int, int, int, int, int, int);
int main(int argc, char **argv) {
  int res = 0;
  res = sum(6, 1, 2, 3, 4, 5, 6);
  printf("%d\n", res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    $0x6,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    $0x4,%r8d
mov    $0x5,%r9d
movl   $0x6,(%rsp)
call   1040 <sum@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x6,(%rsp)
mov    $0x6,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    $0x4,%r8d
mov    $0x5,%r9d
call   1040 <sum@plt>
lea    0xeac(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @sum(i32 6, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ close(int);
int open_proc_rtas_file(char *, int /*<<< orphan*/);
int procfs_interface_exists() {
  int fd;
  int exists;
  fd = open_proc_rtas_file("get_sensor", O_RDWR);
  exists = (fd >= 0);
  if (exists)
    close(fd);
  return exists;
}


x86 assembly (clang, -O0):
<procfs_interface_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
lea    0xec8(%rip),%rdi
call   1030 <open_proc_rtas_file@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1161 <procfs_interface_exists+0x41>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<procfs_interface_exists>:
push   %rbx
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <open_proc_rtas_file@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1143 <procfs_interface_exists+0x23>
mov    %ebx,%edi
call   1040 <close@plt>
not    %ebx
shr    $0x1f,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"get_sensor\00"
@O_RDWR = global i32 0
define i32 @procfs_interface_exists() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @O_RDWR
%4 = call i32 @open_proc_rtas_file(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %3)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = icmp sge i32 %5, 0
%7 = zext i1 %6 to i32
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = load i32, i32* %1
%12 = call i32 @close(i32 %11)
br label %13
13: ; preds = %10, %0
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [11 x i8] c"get_sensor\00"
@O_RDWR = global i32 0
define i32 @procfs_interface_exists() {
%1 = load i32, i32* @O_RDWR
%2 = tail call i32 @open_proc_rtas_file(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = icmp sgt i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = tail call i32 @close(i32 %2)
br label %6
6: ; preds = %4, %0
%7 = xor i32 %2, -1
%8 = lshr i32 %7, 31
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ cpc_key_press(int);
int /*<<< orphan*/ cpc_key_unpress(int);
void Joy_Alpha_Fire2(int value) {
  if (value) {
    cpc_key_press(0x95);
  } else {
    cpc_key_unpress(0x95);
  };
}


x86 assembly (clang, -O0):
<Joy_Alpha_Fire2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1144 <Joy_Alpha_Fire2+0x24>
mov    $0x95,%edi
call   1030 <cpc_key_press@plt>
jmp    114e <Joy_Alpha_Fire2+0x2e>
mov    $0x95,%edi
call   1040 <cpc_key_unpress@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Joy_Alpha_Fire2>:
test   %edi,%edi
je     112e <Joy_Alpha_Fire2+0xe>
mov    $0x95,%edi
jmp    1030 <cpc_key_press@plt>
mov    $0x95,%edi
jmp    1040 <cpc_key_unpress@plt>

LLVM IR (-O0):
define void @Joy_Alpha_Fire2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @cpc_key_press(i32 149)
br label %9
7: ; preds = %1
%8 = call i32 @cpc_key_unpress(i32 149)
br label %9
9: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
define void @Joy_Alpha_Fire2(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @cpc_key_press(i32 149)
br label %7
5: ; preds = %1
%6 = tail call i32 @cpc_key_unpress(i32 149)
br label %7
7: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void finish() { exit(0); }


x86 assembly (clang, -O0):
<finish>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<finish>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @finish() {
%1 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @finish() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
char *today_playlist_fname();
char *today_new_playlist_fname() {
  char *pls_nm = NULL;
  pls_nm = today_playlist_fname();
  strcat(pls_nm, ".new");
  return pls_nm;
}


x86 assembly (clang, -O0):
<today_new_playlist_fname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <today_playlist_fname@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeba(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<today_new_playlist_fname>:
push   %rbx
xor    %eax,%eax
call   1030 <today_playlist_fname@plt>
mov    %rax,%rbx
lea    0xece(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcat@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c".new\00"
define i8* @today_new_playlist_fname() {
%1 = tail call i8* (...) @today_playlist_fname()
%2 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
/* Variables and functions */
float M_PI;
float sin(float);
float backEaseOutf(float p) {
  float f = (1 - p);
  return 1 - (f * f * f - f * sin(f * M_PI));
}


x86 assembly (clang, -O0):
<backEaseOutf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xedb(%rip),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
mov    0x2e8a(%rip),%rax
mulss  (%rax),%xmm0
call   1030 <sin@plt>
movss  -0x14(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0xc(%rbp),%xmm0
mulss  %xmm3,%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  0xe66(%rip),%xmm0
subss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<backEaseOutf>:
push   %rax
movss  0xee7(%rip),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,(%rsp)
movaps %xmm1,%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,0x4(%rsp)
mov    0x2eb2(%rip),%rax
movss  (%rax),%xmm0
mulss  %xmm1,%xmm0
call   1030 <sin@plt>
movss  (%rsp),%xmm2
mulss  %xmm2,%xmm0
movss  0x4(%rsp),%xmm1
mulss  %xmm2,%xmm1
subss  %xmm0,%xmm1
movss  0xe9e(%rip),%xmm0
subss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@M_PI = global float 0.000000e+00
define float @backEaseOutf(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = fsub float 1.000000e+00, %4
store float %5, float* %3
%6 = load float, float* %3
%7 = load float, float* %3
%8 = fmul float %6, %7
%9 = load float, float* %3
%10 = load float, float* %3
%11 = load float, float* %3
%12 = load float, float* @M_PI
%13 = fmul float %11, %12
%14 = call float @sin(float %13)
%15 = fmul float %10, %14
%16 = fneg float %15
%17 = call float @llvm.fmuladd.f32(float %8, float %9, float %16)
%18 = fsub float 1.000000e+00, %17
ret float %18
}

LLVM IR (-O2):
@M_PI = global float 0.000000e+00
define float @backEaseOutf(float %0) {
%2 = fsub float 1.000000e+00, %0
%3 = fmul float %2, %2
%4 = load float, float* @M_PI
%5 = fmul float %2, %4
%6 = tail call float @sin(float %5)
%7 = fneg float %2
%8 = fmul float %6, %7
%9 = tail call float @llvm.fmuladd.f32(float %3, float %2, float %8)
%10 = fsub float 1.000000e+00, %9
ret float %10
}
int dist_to_time(double dist) { return dist / 10; }


x86 assembly (clang, -O0):
<dist_to_time>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dist_to_time>:
divsd  0xef8(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @dist_to_time(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double %3, 1.000000e+01
%5 = fptosi double %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @dist_to_time(double %0) {
%2 = fdiv double %0, 1.000000e+01
%3 = fptosi double %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ hash(int);
void test(int M) {
  { hash(1); };
}


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

x86 assembly (clang, -O2):
<test>:
mov    $0x1,%edi
jmp    1030 <hash@plt>

LLVM IR (-O0):
define void @test(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @hash(i32 1)
ret void
}

LLVM IR (-O2):
define void @test(i32 %0) {
%2 = tail call i32 @hash(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ensure(void *);
void *check_ptr(void *ptr) {
  ensure(ptr);
  return ptr;
}


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

x86 assembly (clang, -O2):
<check_ptr>:
push   %rbx
mov    %rdi,%rbx
call   1030 <ensure@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @check_ptr(i8* returned %0) {
%2 = tail call i32 @ensure(i8* %0)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int pthread_self();
int /*<<< orphan*/ sleep(int);
void *thr_fn3(void *arg) {
  while (1) {
    printf("thread 3 writing, threadId: %u\n", pthread_self());
    sleep(1);
  }
}


x86 assembly (clang, -O0):
<thr_fn3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    113c <thr_fn3+0xc>

x86 assembly (clang, -O2):
<thr_fn3>:
push   %rbx
lea    0xec8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <pthread_self@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1140 <thr_fn3+0x10>

LLVM IR (-O0):
@.str = [32 x i8] c"thread 3 writing, threadId: %u\0A\00"
define i8* @thr_fn3(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %3
%4 = call i32 (...) @pthread_self()
%5 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @sleep(i32 1)
br label %3
}

LLVM IR (-O2):
@.str = [32 x i8] c"thread 3 writing, threadId: %u\0A\00"
define noalias i8* @thr_fn3(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 (...) @pthread_self()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @sleep(i32 1)
br label %2
}
/* Variables and functions */
size_t strlen(const char *str) {
  size_t i = 0;
  while (*str++ != '\0' && ++i)
    ;
  return i;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1146 <strlen+0x46>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1156 <strlen+0x56>
jmp    115b <strlen+0x5b>
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpb   $0x0,(%rdi,%rax,1)
je     111d <strlen+0x1d>
inc    %rax
jne    1110 <strlen+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %7, %1
%3 = phi i8* [ %0, %1 ], [ %8, %7 ]
%4 = phi i64 [ 0, %1 ], [ %9, %7 ]
%5 = load i8, i8* %3
%6 = icmp eq i8 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = getelementptr inbounds i8, i8* %3, i64 1
%9 = add i64 %4, 1
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %2
11: ; preds = %2, %7
%12 = phi i64 [ 0, %7 ], [ %4, %2 ]
ret i64 %12
}
int isodigit(int c) { return (c >= '0' && c <= '7') ? 1 : 0; }


x86 assembly (clang, -O0):
<isodigit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x30,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <isodigit+0x20>
cmpl   $0x37,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isodigit>:
and    $0xfffffff8,%edi
xor    %eax,%eax
cmp    $0x30,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @isodigit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 48
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 55
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 1, i32 0
ret i32 %11
}

LLVM IR (-O2):
define i32 @isodigit(i32 %0) {
%2 = and i32 %0, -8
%3 = icmp eq i32 %2, 48
%4 = zext i1 %3 to i32
ret i32 %4
}
void RTAvlGCPtrGet(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvlGCPtrGet() {
ret void
}
/* Variables and functions */
char *malloc(int);
int rand();
char *realloc(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
char *fn84() {
  char *result;
  result = malloc(20 + rand() % 20);
  result = realloc(result, 30 + rand() % 20);
  strcpy((char *)result, "fn84");
  return result;
}


x86 assembly (clang, -O0):
<fn84>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1e,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn84>:
push   %rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1e,%esi
mov    %rbx,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
lea    0xe4f(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"fn84\00"
define i8* @fn84() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 20
%4 = add nsw i32 20, %3
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 20
%9 = add nsw i32 30, %8
%10 = call i8* @realloc(i8* %6, i32 %9)
store i8* %10, i8** %1
%11 = load i8*, i8** %1
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %1
ret i8* %13
}

LLVM IR (-O2):
@.str = [5 x i8] c"fn84\00"
define i8* @fn84() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 20
%3 = add nsw i32 %2, 20
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 20
%7 = add nsw i32 %6, 30
%8 = tail call i8* @realloc(i8* %4, i32 %7)
%9 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %8
}
/* Type definitions */
struct timespec {
  int tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int atoi(char const *);
int /*<<< orphan*/ nanosleep(struct timespec *, int /*<<< orphan*/ *);
int main(int argc, const char *argv[]) {
  int iterations = atoi(argv[1]);
  int i;
  struct timespec tim;
  tim.tv_sec = 0;
  tim.tv_nsec = 1000;
  while (1) {
    i = iterations;
    while (i--)
      ;
    nanosleep(&tim, NULL);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x3e8,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x18(%rbp)
cmp    $0x0,%eax
je     1174 <main+0x54>
jmp    115b <main+0x3b>
lea    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <nanosleep@plt>
jmp    1155 <main+0x35>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
movl   $0x3e8,(%rsp)
mov    %rsp,%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <nanosleep@plt>
jmp    1130 <main+0x20>

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.timespec
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @atoi(i8* %11)
store i32 %12, i32* %6
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 1
store i64 0, i64* %13
%14 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 0
store i32 1000, i32* %14
br label %15
15: ; preds = %2, %22
%16 = load i32, i32* %6
store i32 %16, i32* %7
br label %17
17: ; preds = %21, %15
%18 = load i32, i32* %7
%19 = add nsw i32 %18, -1
store i32 %19, i32* %7
%20 = icmp ne i32 %18, 0
br i1 %20, label %21, label %22
21: ; preds = %17
br label %17
22: ; preds = %17
%23 = call i32 @nanosleep(%struct.timespec* %8, i32* null)
br label %15
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.timespec
%4 = bitcast %struct.timespec* %3 to i8*
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 1
store i64 0, i64* %5
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 0
store i32 1000, i32* %6
br label %7
7: ; preds = %7, %2
%8 = call i32 @nanosleep(%struct.timespec* %3, i32* null)
br label %7
}
extern unsigned int setIntersection(unsigned int set1, unsigned int set2) {
  unsigned int result;
  result = set1 & set2;
  return result;
}


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

x86 assembly (clang, -O2):
<setIntersection>:
mov    %edi,%eax
and    %esi,%eax
ret

LLVM IR (-O0):
define i32 @setIntersection(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 = and i32 %6, %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @setIntersection(i32 %0, i32 %1) {
%3 = and i32 %1, %0
ret i32 %3
}
double FtoC(double F) {
  double c = .55556 * (F - 32);
  return c;
}


x86 assembly (clang, -O0):
<FtoC>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  0xef2(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xede(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<FtoC>:
addsd  0xef8(%rip),%xmm0
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @FtoC(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fsub double %4, 3.200000e+01
%6 = fmul double 5.555600e-01, %5
store double %6, double* %3
%7 = load double, double* %3
ret double %7
}

LLVM IR (-O2):
define double @FtoC(double %0) {
%2 = fadd double %0, -3.200000e+01
%3 = fmul double %2, 5.555600e-01
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ stderr;
int _error(char const *progname, char const *message, int ret) {
  fprintf(stderr, "%s: ", progname);
  perror(message);
  return ret;
}


x86 assembly (clang, -O0):
<_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeb9(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <perror@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_error>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%rdx
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <perror@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [5 x i8] c"%s: \00"
define i32 @_error(i8* %0, i8* nocapture %1, i32 returned %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = tail call i32 @perror(i8* %1)
ret i32 %2
}
/* Variables and functions */
scalar_t__ EAGAIN;
scalar_t__ errno;
int connection_would_block() { return errno == EAGAIN; }


x86 assembly (clang, -O0):
<connection_would_block>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
mov    (%rax),%rax
mov    0x2ebb(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<connection_would_block>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%rcx
mov    0x2ebf(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%rcx
sete   %al
ret

LLVM IR (-O0):
@errno = global i64 0
@EAGAIN = global i64 0
define i32 @connection_would_block() {
%1 = load i64, i64* @errno
%2 = load i64, i64* @EAGAIN
%3 = icmp eq i64 %1, %2
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
@errno = global i64 0
@EAGAIN = global i64 0
define i32 @connection_would_block() {
%1 = load i64, i64* @errno
%2 = load i64, i64* @EAGAIN
%3 = icmp eq i64 %1, %2
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ scc_socket_send_modem_code(int, int, double);
void scc_socket_modem_connect(int port, double dcycs) {
  scc_socket_send_modem_code(port, 13, dcycs);
}


x86 assembly (clang, -O0):
<scc_socket_modem_connect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
movsd  -0x10(%rbp),%xmm0
mov    $0xd,%esi
call   1030 <scc_socket_send_modem_code@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scc_socket_modem_connect>:
mov    $0xd,%esi
jmp    1030 <scc_socket_send_modem_code@plt>

LLVM IR (-O0):
define void @scc_socket_modem_connect(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 @scc_socket_send_modem_code(i32 %5, i32 13, double %6)
ret void
}

LLVM IR (-O2):
define void @scc_socket_modem_connect(i32 %0, double %1) {
%3 = tail call i32 @scc_socket_send_modem_code(i32 %0, i32 13, double %1)
ret void
}
void isr_default_handler(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<isr_default_handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <isr_default_handler+0x9>
jmp    1109 <isr_default_handler+0x9>

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

LLVM IR (-O0):
define void @isr_default_handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @isr_default_handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
void injectSharedLibrary(long mallocaddr, long freeaddr, long dlopenaddr) {
  asm("push %rsi \n"
      "push %rdx");
  asm("push %r9 \n"
      "mov %rdi,%r9 \n"
      "mov %rcx,%rdi \n"
      "callq *%r9 \n"
      "pop %r9 \n"
      "int $3");
  asm("pop %rdx \n"
      "push %r9 \n"
      "mov %rdx,%r9 \n"
      "mov %rax,%rdi \n"
      "movabs $1,%rsi \n"
      "callq *%r9 \n"
      "pop %r9 \n"
      "int $3");
  asm("mov %rax,%rdi \n"
      "pop %rsi \n"
      "push %rbx \n"
      "mov %rsi,%rbx \n"
      "xor %rsi,%rsi \n"
      "int $3 \n"
      "callq *%rbx \n"
      "pop %rbx");
}


x86 assembly (clang, -O0):
<injectSharedLibrary>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
push   %rsi
push   %rdx
push   %r9
mov    %rdi,%r9
mov    %rcx,%rdi
call   *%r9
pop    %r9
int3
pop    %rdx
push   %r9
mov    %rdx,%r9
mov    %rax,%rdi
movabs $0x1,%rsi
call   *%r9
pop    %r9
int3
mov    %rax,%rdi
pop    %rsi
push   %rbx
mov    %rsi,%rbx
xor    %rsi,%rsi
int3
call   *%rbx
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<injectSharedLibrary>:
push   %rsi
push   %rdx
push   %r9
mov    %rdi,%r9
mov    %rcx,%rdi
call   *%r9
pop    %r9
int3
pop    %rdx
push   %r9
mov    %rdx,%r9
mov    %rax,%rdi
movabs $0x1,%rsi
call   *%r9
pop    %r9
int3
mov    %rax,%rdi
pop    %rsi
push   %rbx
mov    %rsi,%rbx
xor    %rsi,%rsi
int3
call   *%rbx
pop    %rbx
ret

LLVM IR (-O0):
define void @injectSharedLibrary(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
ret void
}

LLVM IR (-O2):
define void @injectSharedLibrary(i64 %0, i64 %1, i64 %2) {
tail call void asm sideeffect "push %rsi \0Apush %rdx", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "push %r9 \0Amov %rdi,%r9 \0Amov %rcx,%rdi \0Acallq *%r9 \0Apop %r9 \0Aint $$3", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "pop %rdx \0Apush %r9 \0Amov %rdx,%r9 \0Amov %rax,%rdi \0Amovabs $$1,%rsi \0Acallq *%r9 \0Apop %r9 \0Aint $$3", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "mov %rax,%rdi \0Apop %rsi \0Apush %rbx \0Amov %rsi,%rbx \0Axor %rsi,%rsi \0Aint $$3 \0Acallq *%rbx \0Apop %rbx", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_putchar(char);
int /*<<< orphan*/ ft_putstr(char *);
int main(int argc, char **argv) {
  int i;
  i = 0;
  while (++i < argc) {
    ft_putstr(argv[i]);
    ft_putchar('\n');
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmp    -0x8(%rbp),%eax
jge    116f <main+0x4f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <ft_putstr@plt>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%edi
jl     115c <main+0x3c>
mov    %rsi,%r14
mov    %edi,%r15d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14,%rbx,8),%rdi
call   1040 <ft_putstr@plt>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
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 0, i32* %6
br label %7
7: ; preds = %12, %2
%8 = load i32, i32* %6
%9 = add nsw i32 %8, 1
store i32 %9, i32* %6
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %20
12: ; preds = %7
%13 = load i8**, i8*** %5
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 @ft_putstr(i8* %17)
%19 = call i32 @ft_putchar(i8 signext 10)
br label %7
20: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 1, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @ft_putstr(i8* %9)
%11 = tail call i32 @ft_putchar(i8 signext 10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
typedef scalar_t__ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
scalar_t__ pthread_self();
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  pthread_t id;
  time_t t;
  time(&t);
  id = pthread_self();
  printf("%X\n", (unsigned int)id);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x1c(%rbp),%rdi
call   1040 <time@plt>
mov    $0x0,%al
call   1050 <pthread_self@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,%esi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%X\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @time(i32* %7)
%9 = call i64 (...) @pthread_self()
store i64 %9, i64* %6
%10 = load i64, i64* %6
%11 = trunc i64 %10 to i32
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%X\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @time(i32* %3)
%6 = call i64 (...) @pthread_self()
%7 = trunc i64 %6 to i32
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void my_memcpy(void *__restrict__ dst, const void *__restrict__ src,
               size_t size) {
  uint8_t *__restrict__ dst_u8 = (uint8_t *__restrict__)dst;
  const uint8_t *__restrict__ src_u8 = (const uint8_t *__restrict__)src;
  do {
    *dst_u8++ = *src_u8++;
  } while (--size);
}


x86 assembly (clang, -O0):
<my_memcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x28(%rbp)
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x20(%rbp)
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1120 <my_memcpy+0x20>
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_memcpy>:
push   %rax
shl    $0x2,%rdx
call   1030 <memcpy@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @my_memcpy(i8* noalias nocapture writeonly %0, i8* noalias nocapture %1, i64 %2) {
%4 = shl nuw i64 %2, 2
ret void
}
unsigned xrop3_204_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  return (S & (~S) & (~T)) | (D & S) | (D & T);
}


x86 assembly (clang, -O0):
<xrop3_204_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0x10(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_204_1_1>:
mov    %edi,%eax
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_204_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = shl i32 %9, 8
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = or i32 %10, %12
store i32 %13, i32* %6
%14 = load i8, i8* %4
%15 = zext i8 %14 to i32
%16 = shl i32 %15, 8
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = or i32 %16, %18
store i32 %19, i32* %7
%20 = load i32, i32* %6
%21 = load i32, i32* %6
%22 = xor i32 %21, -1
%23 = and i32 %20, %22
%24 = load i32, i32* %7
%25 = xor i32 %24, -1
%26 = and i32 %23, %25
%27 = load i32, i32* %5
%28 = load i32, i32* %6
%29 = and i32 %27, %28
%30 = or i32 %26, %29
%31 = load i32, i32* %5
%32 = load i32, i32* %7
%33 = and i32 %31, %32
%34 = or i32 %30, %33
ret i32 %34
}

LLVM IR (-O2):
define i32 @xrop3_204_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = or i8 %1, %0
%4 = zext i8 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void zero_payload(void *payload, void *opaque) {
  size_t len = *(size_t *)opaque;
  memset(payload, 0, len);
}


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

x86 assembly (clang, -O2):
<zero_payload>:
mov    (%rsi),%rdx
xor    %esi,%esi
jmp    1030 <memset@plt>

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

LLVM IR (-O2):
define void @zero_payload(i8* %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i64*
%4 = load i64, i64* %3
%5 = tail call i32 @memset(i8* %0, i32 0, i64 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void ICMPv4head(int osvers, int osrel, int ossub) {
  printf("ierr/s isq/s ird/s idu/s ite/s "
         "oerr/s osq/s ord/s odu/s ote/s_icmpv4_");
}


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

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

LLVM IR (-O0):
@.str = [70 x i8] c"ierr/s isq/s ird/s idu/s ite/s oerr/s osq/s ord/s odu/s ote/s_icmpv4_\00"
define void @ICMPv4head(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [70 x i8] c"ierr/s isq/s ird/s idu/s ite/s oerr/s osq/s ord/s odu/s ote/s_icmpv4_\00"
define void @ICMPv4head(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
ret void
}
int test_imm_E4int32_mem(int *val) {
  return ((*val) & (0xE4 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_E4int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 228
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}