xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ yield();
__attribute__((no)) void worker(long count) {
  long i;
  for (i = 0; i != count; ++i)
    yield();
}


x86 assembly (clang, -O0):
<worker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
je     114a <worker+0x3a>
mov    $0x0,%al
call   1030 <yield@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <worker+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<worker>:
push   %rbx
test   %rdi,%rdi
je     112d <worker+0x1d>
mov    %rdi,%rbx
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <yield@plt>
add    $0xffffffffffffffff,%rbx
jne    1120 <worker+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @worker(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 (...) @yield()
%6 = add nuw nsw i64 %4, 1
%7 = icmp eq i64 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
int foo() {
  const int a[8] = {0, 1, 2, 3, 4, 5, 6, 7};
  int i, sum;
  sum = 0;
  for (i = 0; i < sizeof(a) / sizeof(*a); i++)
    sum += a[i];
  return sum;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    0xef5(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xef2(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeef(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeec(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    $0x8,%rax
jae    1168 <foo+0x68>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%eax
add    -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113e <foo+0x3e>
mov    -0x28(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.foo.a = [8 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7]
define i32 @foo() {
%1 = alloca [8 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [8 x i32]* %1 to i8*
store i32 0, i32* %3
store i32 0, i32* %2
br label %5
5: ; preds = %16, %0
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = icmp ult i64 %7, 8
br i1 %8, label %9, label %19
9: ; preds = %5
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = load i32, i32* %3
%15 = add nsw i32 %14, %13
store i32 %15, i32* %3
br label %16
16: ; preds = %9
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %5
19: ; preds = %5
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @foo() {
ret i32 28
}
/* Variables and functions */
int /*<<< orphan*/ mqc_File_Name_list(char *, char *, int);
int /*<<< orphan*/ mqc_Global_init();
void mqc_create_File_Name_lists(char *FileName, char *Program, int iout) {
  static int mqc_first_call = 0;
  if (mqc_first_call == 0) {
    mqc_Global_init();
    mqc_first_call = 1;
  }
  mqc_File_Name_list(FileName, Program, iout);
}


x86 assembly (clang, -O0):
<mqc_create_File_Name_lists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,0x2efa(%rip)
jne    1151 <mqc_create_File_Name_lists+0x31>
mov    $0x0,%al
call   1040 <mqc_Global_init@plt>
movl   $0x1,0x2ee3(%rip)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <mqc_File_Name_list@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mqc_create_File_Name_lists>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
cmpb   $0x0,0x2f00(%rip)
jne    1144 <mqc_create_File_Name_lists+0x24>
xor    %eax,%eax
call   1040 <mqc_Global_init@plt>
movb   $0x1,0x2ef0(%rip)
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <mqc_File_Name_list@plt>

LLVM IR (-O0):
@mqc_create_File_Name_lists.mqc_first_call = internal global i32 0
define void @mqc_create_File_Name_lists(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* @mqc_create_File_Name_lists.mqc_first_call
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 (...) @mqc_Global_init()
store i32 1, i32* @mqc_create_File_Name_lists.mqc_first_call
br label %11
11: ; preds = %9, %3
%12 = load i8*, i8** %4
%13 = load i8*, i8** %5
%14 = load i32, i32* %6
%15 = call i32 @mqc_File_Name_list(i8* %12, i8* %13, i32 %14)
ret void
}

LLVM IR (-O2):
@mqc_create_File_Name_lists.mqc_first_call = internal unnamed_addr global i1 false
define void @mqc_create_File_Name_lists(i8* %0, i8* %1, i32 %2) {
%4 = load i1, i1* @mqc_create_File_Name_lists.mqc_first_call
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 (...) @mqc_Global_init()
store i1 true, i1* @mqc_create_File_Name_lists.mqc_first_call
br label %7
7: ; preds = %5, %3
%8 = tail call i32 @mqc_File_Name_list(i8* %0, i8* %1, i32 %2)
ret void
}
void flush_icache_range(unsigned long start, unsigned long stop) {
  __builtin___clear_cache((char *)start, (char *)stop);
}


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

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

LLVM IR (-O0):
define void @flush_icache_range(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = inttoptr i64 %5 to i8*
%7 = load i64, i64* %4
%8 = inttoptr i64 %7 to i8*
ret void
}

LLVM IR (-O2):
define void @flush_icache_range(i64 %0, i64 %1) {
%3 = inttoptr i64 %0 to i8*
%4 = inttoptr i64 %1 to i8*
tail call void @llvm.clear_cache(i8* %3, i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dlclose(void *);
void ATP_sharedLibUnload(void *p_lib) { dlclose(p_lib); }


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

x86 assembly (clang, -O2):
<ATP_sharedLibUnload>:
jmp    1030 <dlclose@plt>

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

LLVM IR (-O2):
define void @ATP_sharedLibUnload(i8* %0) {
%2 = tail call i32 @dlclose(i8* %0)
ret void
}
int main() {
  int a = 5;
  return --a;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 4
}
void restore_processor_state(void) { return; }


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

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

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

LLVM IR (-O2):
define void @restore_processor_state() {
ret void
}
float div(float left, float right) { return left / right; }


x86 assembly (clang, -O0):
<div>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<div>:
divss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @div(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fdiv float %5, %6
ret float %7
}

LLVM IR (-O2):
define float @div(float %0, float %1) {
%3 = fdiv float %0, %1
ret float %3
}
int test_imm_0Aint16_mem(short *val) {
  return ((*val) & (-0x0A << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_0Aint16_mem>:
movzwl (%rdi),%eax
test   $0xfff6,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_0Aint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -10
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int test_imm_1Eint8_reg(signed char val) {
  return ((val) & (0x1E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_1Eint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0x1e,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_1Eint8_reg>:
test   $0x1e,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_1Eint8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 30
%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_1Eint8_reg(i8 signext %0) {
%2 = and i8 %0, 30
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int new_system_id(void) {
  static int system_id = 0;
  return system_id++;
}


x86 assembly (clang, -O0):
<new_system_id>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1a(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2f0f(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<new_system_id>:
mov    0x2f1e(%rip),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x2f15(%rip)
ret

LLVM IR (-O0):
@new_system_id.system_id = internal global i32 0
define i32 @new_system_id() {
%1 = load i32, i32* @new_system_id.system_id
%2 = add nsw i32 %1, 1
store i32 %2, i32* @new_system_id.system_id
ret i32 %1
}

LLVM IR (-O2):
@new_system_id.system_id = internal unnamed_addr global i32 0
define i32 @new_system_id() {
%1 = load i32, i32* @new_system_id.system_id
%2 = add nsw i32 %1, 1
store i32 %2, i32* @new_system_id.system_id
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
typedef int /*<<< orphan*/ linebuf;

/* Variables and functions */
int /*<<< orphan*/ kputs(char *);
int /*<<< orphan*/ vsnprintf(char *, int, char const *, int /*<<< orphan*/);
void kvprintf(const char *format, va_list vl) {
  char linebuf[256];
  vsnprintf(linebuf, sizeof(linebuf), format, vl);
  kputs(linebuf);
}


x86 assembly (clang, -O0):
<kvprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    $0x100,%esi
call   1030 <vsnprintf@plt>
lea    -0x110(%rbp),%rdi
call   1040 <kputs@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kvprintf>:
push   %rbx
sub    $0x100,%rsp
mov    %esi,%ecx
mov    %rdi,%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1030 <vsnprintf@plt>
mov    %rbx,%rdi
call   1040 <kputs@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @kvprintf(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [256 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = call i32 @vsnprintf(i8* %6, i32 256, i8* %7, i32 %8)
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%11 = call i32 @kputs(i8* %10)
ret void
}

LLVM IR (-O2):
define void @kvprintf(i8* nocapture %0, i32 %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i32 @vsnprintf(i8* %4, i32 256, i8* %0, i32 %1)
%6 = call i32 @kputs(i8* %4)
ret void
}
void cmd_end() {
  kprint("Stopping the CPU. Bye!\n");
  asm volatile("hlt");
}


x86 assembly (clang, -O0):
<cmd_end>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <kprint@plt>
hlt
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [24 x i8] c"Stopping the CPU. Bye!\0A\00"
define void @cmd_end() {
%1 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Stopping the CPU. Bye!\0A\00"
define void @cmd_end() {
%1 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
tail call void asm sideeffect "hlt", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *tu__dirname(char const *);
int /*<<< orphan*/ tu_mkpath(char *, int /*<<< orphan*/);
void tu_mkpath_for(const char *path, mode_t mode) {
  char *dir = tu__dirname(path);
  tu_mkpath(dir, mode);
  free(dir);
}


x86 assembly (clang, -O0):
<tu_mkpath_for>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <tu__dirname@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <tu_mkpath@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tu_mkpath_for>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
call   1050 <tu__dirname@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %ebp,%esi
call   1040 <tu_mkpath@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @tu_mkpath_for(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = call i8* @tu__dirname(i8* %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = load i32, i32* %4
%10 = call i32 @tu_mkpath(i8* %8, i32 %9)
%11 = load i8*, i8** %5
%12 = call i32 @free(i8* %11)
ret void
}

LLVM IR (-O2):
define void @tu_mkpath_for(i8* %0, i32 %1) {
%3 = tail call i8* @tu__dirname(i8* %0)
%4 = tail call i32 @tu_mkpath(i8* %3, i32 %1)
%5 = tail call i32 @free(i8* %3)
ret void
}
/* Variables and functions */
int wip_cm_calc_divi(float);
int wip_cm_calc_divf(float div) {
  int divi = wip_cm_calc_divi(div);
  int divf = (int)((div - divi) * 1024);
  return divf;
}


x86 assembly (clang, -O0):
<wip_cm_calc_divf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <wip_cm_calc_divi@plt>
mov    %eax,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  0xec0(%rip),%xmm1
mulss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wip_cm_calc_divf>:
push   %rax
movss  %xmm0,0x4(%rsp)
call   1030 <wip_cm_calc_divi@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0x4(%rsp),%xmm1
subss  %xmm0,%xmm1
mulss  0xecb(%rip),%xmm1
cvttss2si %xmm1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @wip_cm_calc_divf(float %0) {
%2 = alloca float
%3 = alloca i32
%4 = alloca i32
store float %0, float* %2
%5 = load float, float* %2
%6 = call i32 @wip_cm_calc_divi(float %5)
store i32 %6, i32* %3
%7 = load float, float* %2
%8 = load i32, i32* %3
%9 = sitofp i32 %8 to float
%10 = fsub float %7, %9
%11 = fmul float %10, 1.024000e+03
%12 = fptosi float %11 to i32
store i32 %12, i32* %4
%13 = load i32, i32* %4
ret i32 %13
}

LLVM IR (-O2):
define i32 @wip_cm_calc_divf(float %0) {
%2 = tail call i32 @wip_cm_calc_divi(float %0)
%3 = sitofp i32 %2 to float
%4 = fsub float %0, %3
%5 = fmul float %4, 1.024000e+03
%6 = fptosi float %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ fdecrypt(char *, char *);
int main(int argc, char *argv[]) {
  fdecrypt("enced.enc", "unenced.txt");
  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    0xed3(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1030 <fdecrypt@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [10 x i8] c"enced.enc\00"
@.str.1 = [12 x i8] c"unenced.txt\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 @fdecrypt(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"enced.enc\00"
@.str.1 = [12 x i8] c"unenced.txt\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @fdecrypt(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
__attribute__((noipa)) void *return_vla_index_cst(int n) {
  char a[n];
  char *p = &a[3];
  sink(p);
  return p;
}


x86 assembly (clang, -O0):
<return_vla_index_cst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
mov    %rcx,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,%rsp
mov    %rcx,-0x18(%rbp)
add    $0x3,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1030 <sink@plt>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<return_vla_index_cst>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
push   %rax
mov    %edi,%eax
mov    %rsp,%rcx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rcx,%rdx
sub    %rax,%rdx
mov    %rdx,%rsp
neg    %rax
lea    (%rcx,%rax,1),%rbx
add    $0x3,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <sink@plt>
mov    %rbx,%rax
lea    -0x8(%rbp),%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i8* @return_vla_index_cst(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %3
%9 = alloca i8, i64 %7
store i64 %7, i64* %4
%10 = getelementptr inbounds i8, i8* %9, i64 3
store i8* %10, i8** %5
%11 = load i8*, i8** %5
%12 = call i32 (i8*, ...) bitcast (i32 (...)* @sink to i32 (i8*, ...)*)(i8* %11)
%13 = load i8*, i8** %5
%14 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
define i8* @return_vla_index_cst(i32 %0) {
%2 = zext i32 %0 to i64
%3 = alloca i8, i64 %2
%4 = getelementptr inbounds i8, i8* %3, i64 3
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @sink to i32 (i8*, ...)*)(i8* %4)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stop();
void terminate_interrupt(int sig) {
  stop();
  printf("%d\n", sig);
  exit(sig);
}


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

x86 assembly (clang, -O2):
<terminate_interrupt>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <stop@plt>
lea    0xebf(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @terminate_interrupt(i32 %0) {
%2 = tail call i32 (...) @stop()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = tail call i32 @exit(i32 %0)
unreachable
}
/* Variables and functions */
int o_shutdown(int, int);
int f_shutdown(int fd, int how) { return o_shutdown(fd, how); }


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

x86 assembly (clang, -O2):
<f_shutdown>:
jmp    1030 <o_shutdown@plt>

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

LLVM IR (-O2):
define i32 @f_shutdown(i32 %0, i32 %1) {
%3 = tail call i32 @o_shutdown(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
scalar_t__ __builtin_scalbf(float, float);
int /*<<< orphan*/ link_failure_builtin_scalbf();
void test_builtin_scalbf(float f1, float f2) {
  if (__builtin_scalbf(f1, f2) != __builtin_scalbf(f1, f2))
    link_failure_builtin_scalbf();
}


x86 assembly (clang, -O0):
<test_builtin_scalbf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1040 <__builtin_scalbf@plt>
mov    %rax,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1040 <__builtin_scalbf@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     116b <test_builtin_scalbf+0x4b>
mov    $0x0,%al
call   1030 <link_failure_builtin_scalbf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_builtin_scalbf>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
call   1040 <__builtin_scalbf@plt>
mov    %rax,%rbx
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1040 <__builtin_scalbf@plt>
cmp    %rax,%rbx
jne    1155 <test_builtin_scalbf+0x35>
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1030 <link_failure_builtin_scalbf@plt>

LLVM IR (-O0):
define void @test_builtin_scalbf(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = call i64 @__builtin_scalbf(float %5, float %6)
%8 = load float, float* %3
%9 = load float, float* %4
%10 = call i64 @__builtin_scalbf(float %8, float %9)
%11 = icmp ne i64 %7, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (...) @link_failure_builtin_scalbf()
br label %14
14: ; preds = %12, %2
ret void
}

LLVM IR (-O2):
define void @test_builtin_scalbf(float %0, float %1) {
%3 = tail call i64 @__builtin_scalbf(float %0, float %1)
%4 = tail call i64 @__builtin_scalbf(float %0, float %1)
%5 = icmp eq i64 %3, %4
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 (...) @link_failure_builtin_scalbf()
br label %8
8: ; preds = %6, %2
ret void
}
int test_imm_41int64_highword_reg(long long val) {
  return ((val >> 32) & (0x41 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_41int64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x20,%rdx
and    $0x41,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_41int64_highword_reg>:
movabs $0x4100000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_41int64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 32
%5 = and i64 %4, 65
%6 = icmp ne i64 %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_41int64_highword_reg(i64 %0) {
%2 = and i64 %0, 279172874240
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int default_key_comparator(void *a, void *b) {
  return a == b ? 0 : (a < b ? -1 : 1);
}


x86 assembly (clang, -O0):
<default_key_comparator>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1124 <default_key_comparator+0x24>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    113f <default_key_comparator+0x3f>
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rsi
mov    $0x1,%eax
mov    $0xffffffff,%ecx
cmp    %rsi,%rdx
cmovb  %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<default_key_comparator>:
xor    %ecx,%ecx
xor    %eax,%eax
cmp    %rsi,%rdi
setae  %al
lea    -0x1(%rax,%rax,1),%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @default_key_comparator(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** %4
%7 = icmp eq i8* %5, %6
br i1 %7, label %8, label %9
8: ; preds = %2
br label %15
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = load i8*, i8** %4
%12 = icmp ult i8* %10, %11
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 -1, i32 1
br label %15
15: ; preds = %9, %8
%16 = phi i32 [ 0, %8 ], [ %14, %9 ]
ret i32 %16
}

LLVM IR (-O2):
define i32 @default_key_comparator(i8* readnone %0, i8* readnone %1) {
%3 = icmp eq i8* %0, %1
%4 = icmp ult i8* %0, %1
%5 = select i1 %4, i32 -1, i32 1
%6 = select i1 %3, i32 0, i32 %5
ret i32 %6
}
/* Variables and functions */
unsigned int foo(unsigned long long);
__attribute__((no, noclone)) unsigned int bar(unsigned long long *x) {
  return foo(*x);
}


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

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

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

LLVM IR (-O2):
define i32 @bar(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = tail call i32 @foo(i64 %2)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ ucontext_t;

/* Variables and functions */
int /*<<< orphan*/ getcontext(int /*<<< orphan*/ *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ setcontext(int /*<<< orphan*/ *);
int /*<<< orphan*/ sleep(int);
int main() {
  ucontext_t context;
  getcontext(&context);
  puts("Hello world");
  sleep(1);
  setcontext(&context);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1050 <getcontext@plt>
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
lea    -0x8(%rbp),%rdi
call   1040 <setcontext@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <getcontext@plt>
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
mov    %rbx,%rdi
call   1040 <setcontext@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"Hello world\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @getcontext(i32* %1)
%4 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @sleep(i32 1)
%6 = call i32 @setcontext(i32* %1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
struct prime_thread_ctx {
  int dummy;
};

/* Variables and functions */
int shuffle2_skip_to(struct prime_thread_ctx *__attribute__((unused)) pctx,
                     uint64_t __attribute__((unused)) target_num,
                     void *__attribute__((unused)) ctx) {
  return 0;
}


x86 assembly (clang, -O0):
<shuffle2_skip_to>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.prime_thread_ctx = type { i32 }
define i32 @shuffle2_skip_to(%struct.prime_thread_ctx* %0, i32 %1, i8* %2) {
%4 = alloca %struct.prime_thread_ctx*
%5 = alloca i32
%6 = alloca i8*
store %struct.prime_thread_ctx* %0, %struct.prime_thread_ctx** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
ret i32 0
}

LLVM IR (-O2):
%struct.prime_thread_ctx = type { i32 }
define i32 @shuffle2_skip_to(%struct.prime_thread_ctx* nocapture readnone %0, i32 %1, i8* nocapture readnone %2) {
ret i32 0
}
void test53() {
  int x;
  int y = (x);
}


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

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

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

LLVM IR (-O2):
define void @test53() {
ret void
}
/* Variables and functions */
unsigned long htonl(unsigned long);
unsigned long c_htonl(unsigned long val) { return htonl(val); }


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

x86 assembly (clang, -O2):
<c_htonl>:
jmp    1030 <htonl@plt>

LLVM IR (-O0):
define i64 @c_htonl(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @htonl(i64 %3)
ret i64 %4
}

LLVM IR (-O2):
define i64 @c_htonl(i64 %0) {
%2 = tail call i64 @htonl(i64 %0)
ret i64 %2
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EACCES;
int _stub(int /*<<< orphan*/);
int __wrap_stat(const char *file, struct stat *st) { return _stub(EACCES); }


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

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

LLVM IR (-O0):
%struct.stat = type { i32 }
@EACCES = global i32 0
define i32 @__wrap_stat(i8* %0, %struct.stat* %1) {
%3 = alloca i8*
%4 = alloca %struct.stat*
store i8* %0, i8** %3
store %struct.stat* %1, %struct.stat** %4
%5 = load i32, i32* @EACCES
%6 = call i32 @_stub(i32 %5)
ret i32 %6
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@EACCES = global i32 0
define i32 @__wrap_stat(i8* nocapture readnone %0, %struct.stat* nocapture readnone %1) {
%3 = load i32, i32* @EACCES
%4 = tail call i32 @_stub(i32 %3)
ret i32 %4
}
/* Variables and functions */
scalar_t__ COND_EQ();
int /*<<< orphan*/ EA_AY_IX_8();
int /*<<< orphan*/ m68ki_write_8(int /*<<< orphan*/, int);
void m68k_op_seq_8_ix(void) {
  m68ki_write_8(EA_AY_IX_8(), COND_EQ() ? 0xff : 0);
}


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

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

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

LLVM IR (-O2):
define void @m68k_op_seq_8_ix() {
%1 = tail call i32 (...) @EA_AY_IX_8()
%2 = tail call i64 (...) @COND_EQ()
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 0, i32 255
%5 = tail call i32 @m68ki_write_8(i32 %1, i32 %4)
ret void
}
int main(int argc, const char *argv[]) {
  struct my_struct {
    int a;
    double b[2];
  };
  struct my_struct array[2] = {{1, {3.5, 3.6}}, {2, {4.5, 4.6}}};
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x30,%edx
call   1030 <memset@plt>
movl   $0x1,-0x40(%rbp)
movsd  0xed3(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xebe(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x2,-0x28(%rbp)
movsd  0xea2(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe8d(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.my_struct = type { i32, [2 x double] }
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x %struct.my_struct]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [2 x %struct.my_struct]* %6 to i8*
%8 = bitcast i8* %7 to [2 x %struct.my_struct]*
%9 = getelementptr inbounds [2 x %struct.my_struct], [2 x %struct.my_struct]* %8, i32 0, i32 0
%10 = getelementptr inbounds %struct.my_struct, %struct.my_struct* %9, i32 0, i32 0
store i32 1, i32* %10
%11 = getelementptr inbounds %struct.my_struct, %struct.my_struct* %9, i32 0, i32 1
%12 = getelementptr inbounds [2 x double], [2 x double]* %11, i32 0, i32 0
store double 3.500000e+00, double* %12
%13 = getelementptr inbounds [2 x double], [2 x double]* %11, i32 0, i32 1
store double 3.600000e+00, double* %13
%14 = getelementptr inbounds [2 x %struct.my_struct], [2 x %struct.my_struct]* %8, i32 0, i32 1
%15 = getelementptr inbounds %struct.my_struct, %struct.my_struct* %14, i32 0, i32 0
store i32 2, i32* %15
%16 = getelementptr inbounds %struct.my_struct, %struct.my_struct* %14, i32 0, i32 1
%17 = getelementptr inbounds [2 x double], [2 x double]* %16, i32 0, i32 0
store double 4.500000e+00, double* %17
%18 = getelementptr inbounds [2 x double], [2 x double]* %16, i32 0, i32 1
store double 4.600000e+00, double* %18
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ doit(char *);
int main(int argc, char **argv) {
  doit("http://127.0.0.1:8000/test.txt");
  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    0xed3(%rip),%rdi
call   1030 <doit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [31 x i8] c"http://127.0.0.1:8000/test.txt\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 @doit(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"http://127.0.0.1:8000/test.txt\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @doit(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int j = 0;
  int sum = 0;
  for (j = 0; j <= 100; j++) {
    if (j % 2 == 0) {
      sum = sum + j;
    }
  }
  printf("Sum is %d\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     116e <main+0x5e>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    115b <main+0x4b>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1160 <main+0x50>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1134 <main+0x24>
mov    -0xc(%rbp),%esi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [11 x i8] c"Sum is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %2
br label %4
4: ; preds = %16, %0
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 100
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = load i32, i32* %2
%9 = srem i32 %8, 2
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = add nsw i32 %12, %13
store i32 %14, i32* %3
br label %15
15: ; preds = %11, %7
br label %16
16: ; preds = %15
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %4
19: ; preds = %4
%20 = load i32, i32* %3
%21 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"Sum is %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 2550)
ret i32 0
}
/* Variables and functions */
char *strchr(char *, int);
int chrpos(char *s, int c) {
  char *p = strchr(s, c);
  return p ? p - s : -1;
}


x86 assembly (clang, -O0):
<chrpos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     114e <chrpos+0x3e>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    115e <chrpos+0x4e>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    115e <chrpos+0x4e>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chrpos>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strchr@plt>
mov    %eax,%ecx
sub    %ebx,%ecx
cmp    $0x1,%rax
sbb    %eax,%eax
or     %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @chrpos(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i8* @strchr(i8* %6, i32 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i8*, i8** %5
%13 = load i8*, i8** %3
%14 = ptrtoint i8* %12 to i64
%15 = ptrtoint i8* %13 to i64
%16 = sub i64 %14, %15
br label %18
17: ; preds = %2
br label %18
18: ; preds = %17, %11
%19 = phi i64 [ %16, %11 ], [ -1, %17 ]
%20 = trunc i64 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @chrpos(i8* %0, i32 %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 %1)
%4 = icmp eq i8* %3, null
%5 = ptrtoint i8* %3 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = trunc i64 %7 to i32
%9 = select i1 %4, i32 -1, i32 %8
ret i32 %9
}
/* Variables and functions */
float sqrt(float);
void zsqrtxxx(float num) { num = sqrt(num); }


x86 assembly (clang, -O0):
<zsqrtxxx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sqrt@plt>
movss  %xmm0,-0x4(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zsqrtxxx>:
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
ja     1119 <zsqrtxxx+0x9>
ret
ucomiss %xmm1,%xmm0
jae    1118 <zsqrtxxx+0x8>
jmp    1030 <sqrt@plt>

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

LLVM IR (-O2):
define void @zsqrtxxx(float %0) {
%2 = fcmp olt float %0, 0.000000e+00
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call float @sqrt(float %0)
br label %5
5: ; preds = %1, %3
ret void
}
int calc_map_wh(int size, int MapN) {
  int r = ((size + MapN - 1) / MapN + 3);
  return (r);
}


x86 assembly (clang, -O0):
<calc_map_wh>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
sub    $0x1,%eax
cltd
idivl  -0x8(%rbp)
add    $0x3,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_map_wh>:
lea    (%rdi,%rsi,1),%eax
add    $0xffffffff,%eax
cltd
idiv   %esi
add    $0x3,%eax
ret

LLVM IR (-O0):
define i32 @calc_map_wh(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 = add nsw i32 %6, %7
%9 = sub nsw i32 %8, 1
%10 = load i32, i32* %4
%11 = sdiv i32 %9, %10
%12 = add nsw i32 %11, 3
store i32 %12, i32* %5
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
define i32 @calc_map_wh(i32 %0, i32 %1) {
%3 = add i32 %0, -1
%4 = add i32 %3, %1
%5 = sdiv i32 %4, %1
%6 = add nsw i32 %5, 3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void catch_sys(int sig) { printf("SYS\n"); }


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

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

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

LLVM IR (-O2):
@str = [4 x i8] c"SYS\00"
define void @catch_sys(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret void
}
void gtk_toolbar_get_tooltips() {}


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

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

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

LLVM IR (-O2):
define void @gtk_toolbar_get_tooltips() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *program_name) {
  fprintf(stderr, "usage: %s source destination\n", program_name);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"usage: %s source destination\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"usage: %s source destination\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
void test_64bit_magic(int *int_ptr, float *float_ptr) {
  F_func(int_ptr, 0xFFFFFFFFFFFFFFFFULL);
  F_func(int_ptr, 0xFFFFFFFFULL);
  F_func(float_ptr, 0xFFFFFFFFFFFFFFFFULL);
  F_func(float_ptr, 0xFFFFFFFFULL);
}


x86 assembly (clang, -O0):
<test_64bit_magic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xffffffffffffffff,%rsi
mov    $0x0,%al
call   1030 <F_func@plt>
mov    -0x8(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x0,%al
call   1030 <F_func@plt>
mov    -0x10(%rbp),%rdi
mov    $0xffffffffffffffff,%rsi
mov    $0x0,%al
call   1030 <F_func@plt>
mov    -0x10(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x0,%al
call   1030 <F_func@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_64bit_magic>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0xffffffffffffffff,%rsi
xor    %eax,%eax
call   1030 <F_func@plt>
mov    $0xffffffff,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <F_func@plt>
mov    %r14,%rdi
mov    $0xffffffffffffffff,%rsi
xor    %eax,%eax
call   1030 <F_func@plt>
mov    $0xffffffff,%esi
mov    %r14,%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <F_func@plt>

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

LLVM IR (-O2):
define void @test_64bit_magic(i32* %0, float* %1) {
%3 = tail call i32 (i32*, i64, ...) bitcast (i32 (...)* @F_func to i32 (i32*, i64, ...)*)(i32* %0, i64 -1)
%4 = tail call i32 (i32*, i64, ...) bitcast (i32 (...)* @F_func to i32 (i32*, i64, ...)*)(i32* %0, i64 4294967295)
%5 = tail call i32 (float*, i64, ...) bitcast (i32 (...)* @F_func to i32 (float*, i64, ...)*)(float* %1, i64 -1)
%6 = tail call i32 (float*, i64, ...) bitcast (i32 (...)* @F_func to i32 (float*, i64, ...)*)(float* %1, i64 4294967295)
ret void
}
int kexit(int exitvalue) {}


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

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

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

LLVM IR (-O2):
define i32 @kexit(i32 %0) {
ret i32 undef
}