xunge/DecIR huggingface dataset:
double fmod_one(double x) {
  double res;
  res = x - ((long)(x));
  if (res < 0.0)
    return res + 1.0;
  return res;
}


x86 assembly (clang, -O0):
<fmod_one>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvttsd2si -0x10(%rbp),%rax
cvtsi2sd %rax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1147 <fmod_one+0x47>
movsd  0xec8(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1151 <fmod_one+0x51>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmod_one>:
cvttsd2si %xmm0,%rax
cvtsi2sd %rax,%xmm1
subsd  %xmm1,%xmm0
movsd  0xeea(%rip),%xmm2
addsd  %xmm0,%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @fmod_one(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %3
%5 = load double, double* %3
%6 = load double, double* %3
%7 = fptosi double %6 to i64
%8 = sitofp i64 %7 to double
%9 = fsub double %5, %8
store double %9, double* %4
%10 = load double, double* %4
%11 = fcmp olt double %10, 0.000000e+00
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = load double, double* %4
%14 = fadd double %13, 1.000000e+00
store double %14, double* %2
br label %17
15: ; preds = %1
%16 = load double, double* %4
store double %16, double* %2
br label %17
17: ; preds = %15, %12
%18 = load double, double* %2
ret double %18
}

LLVM IR (-O2):
define double @fmod_one(double %0) {
%2 = fptosi double %0 to i64
%3 = sitofp i64 %2 to double
%4 = fsub double %0, %3
%5 = fcmp olt double %4, 0.000000e+00
%6 = fadd double %4, 1.000000e+00
%7 = select i1 %5, double %6, double %4
ret double %7
}
int tiscmp(obj1, obj2) const void *obj1, *obj2;
{ return (((*((int *)obj1)) < (*((int *)obj2))) ? (-1) : 1); }


x86 assembly (clang, -O0):
<tiscmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    $0x1,%eax
mov    $0xffffffff,%ecx
cmp    %esi,%edx
cmovl  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tiscmp>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setge  %cl
lea    (%rcx,%rcx,1),%eax
add    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @tiscmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp slt i32 %4, %6
%8 = select i1 %7, i32 -1, i32 1
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ __iar_program_start();
void ResetISR(void) {
  void SystemInit(void);
  SystemInit();
  __iar_program_start();
}


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

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

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

LLVM IR (-O2):
define void @ResetISR() {
tail call void @SystemInit()
%1 = tail call i32 (...) @__iar_program_start()
ret void
}
unsigned short __readw(void *addr) { return *(volatile unsigned short *)addr; }


x86 assembly (clang, -O0):
<__readw>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__readw>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define zeroext i16 @__readw(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i16*
%5 = load volatile i16, i16* %4
ret i16 %5
}

LLVM IR (-O2):
define zeroext i16 @__readw(i8* %0) {
%2 = bitcast i8* %0 to i16*
%3 = load volatile i16, i16* %2
ret i16 %3
}
int get_core_id(void) {
  return 0;
  int result;
  __asm__ __volatile__("mov $1, %%eax\n"
                       "cpuid\n"
                       : "=b"(result)
                       :
                       : "eax", "ecx", "edx");
  return (result >> 24) % 8;
}


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

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

LLVM IR (-O0):
define i32 @get_core_id() {
%1 = alloca i32
ret i32 0
}

LLVM IR (-O2):
define i32 @get_core_id() {
ret i32 0
}
jump(label) int label;
{
  ot("lbra\t");
  printlabel(label);
  nl();
}


x86 assembly (clang, -O0):
<jump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1040 <ot@plt>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1050 <printlabel@plt>
mov    $0x0,%al
call   1030 <nl@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jump>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1040 <ot@plt>
mov    %ebx,%edi
xor    %eax,%eax
call   1050 <printlabel@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <nl@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"lbra\09\00"
define i32 @jump(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @ot to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %3
%6 = call i32 (i32, ...) bitcast (i32 (...)* @printlabel to i32 (i32, ...)*)(i32 %5)
%7 = call i32 (...) @nl()
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
@.str = [6 x i8] c"lbra\09\00"
define i32 @jump(i32 %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @ot to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @printlabel to i32 (i32, ...)*)(i32 %0)
%4 = tail call i32 (...) @nl()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
scalar_t__ pthread_create;
int main() {
  if (pthread_create)
    printf("that is multi-thread version.\n");
  else
    printf("that is sigle thread version.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ec2(%rip),%rax
cmpq   $0x0,(%rax)
je     1141 <main+0x31>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
jmp    114d <main+0x3d>
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ed0(%rip),%rax
cmpq   $0x0,(%rax)
lea    0xedd(%rip),%rax
lea    0xef4(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@pthread_create = global i64 0
@.str = [31 x i8] c"that is multi-thread version.\0A\00"
@.str.1 = [31 x i8] c"that is sigle thread version.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i64, i64* @pthread_create
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %4
ret i32 0
}

LLVM IR (-O2):
@pthread_create = global i64 0
@str = [30 x i8] c"that is sigle thread version.\00"
@str.2 = [30 x i8] c"that is multi-thread version.\00"
define i32 @main() {
%1 = load i64, i64* @pthread_create
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @str.2, i64 0, i64 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) %3)
ret i32 0
}
/* Variables and functions */
int rom_present(char *);
int xtide_acculogic_available(void) {
  return (rom_present(L"roms/hdd/xtide/SIDE1V12.BIN"));
}


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

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

LLVM IR (-O0):
@.str = [28 x i32] [i32 114, i32 111, i32 109, i32 115, i32 47, i32 104, i32 100, i32 100, i32 47, i32 120, i32 116, i32 105, i32 100, i32 101, i32 47, i32 83, i32 73, i32 68, i32 69, i32 49, i32 86, i32 49, i32 50, i32 46, i32 66, i32 73, i32 78, i32 0]
define i32 @xtide_acculogic_available() {
%1 = call i32 @rom_present(i8* bitcast ([28 x i32]* @.str to i8*))
ret i32 %1
}

LLVM IR (-O2):
@.str = [28 x i32] [i32 114, i32 111, i32 109, i32 115, i32 47, i32 104, i32 100, i32 100, i32 47, i32 120, i32 116, i32 105, i32 100, i32 101, i32 47, i32 83, i32 73, i32 68, i32 69, i32 49, i32 86, i32 49, i32 50, i32 46, i32 66, i32 73, i32 78, i32 0]
define i32 @xtide_acculogic_available() {
%1 = tail call i32 @rom_present(i8* bitcast ([28 x i32]* @.str to i8*))
ret i32 %1
}
int _IMS_fprintf() {}


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

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

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

LLVM IR (-O2):
define i32 @_IMS_fprintf() {
ret i32 undef
}
long KILL(pid, sig)
long *pid, *sig;
{ return ((long)kill(*pid, *sig)); }


x86 assembly (clang, -O0):
<KILL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    $0x0,%al
call   1030 <kill@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<KILL>:
push   %rax
mov    (%rdi),%rdi
mov    (%rsi),%rsi
xor    %eax,%eax
call   1030 <kill@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i64 @KILL(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 = load i64, i64* %5
%7 = load i64*, i64** %4
%8 = load i64, i64* %7
%9 = call i32 (i64, i64, ...) bitcast (i32 (...)* @kill to i32 (i64, i64, ...)*)(i64 %6, i64 %8)
%10 = sext i32 %9 to i64
ret i64 %10
}

LLVM IR (-O2):
define i64 @KILL(i64* nocapture %0, i64* nocapture %1) {
%3 = load i64, i64* %0
%4 = load i64, i64* %1
%5 = tail call i32 (i64, i64, ...) bitcast (i32 (...)* @kill to i32 (i64, i64, ...)*)(i64 %3, i64 %4)
%6 = sext i32 %5 to i64
ret i64 %6
}
int hash(int id) { return 21 - (id / 2); }


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    $0x15,%eax
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    %edi,%ecx
shr    $0x1f,%ecx
add    %edi,%ecx
sar    %ecx
mov    $0x15,%eax
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @hash(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sdiv i32 %3, 2
%5 = sub nsw i32 21, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @hash(i32 %0) {
%2 = sdiv i32 %0, -2
%3 = add nsw i32 %2, 21
ret i32 %3
}
/* Type definitions */
struct aiocb64 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int aio_error64(const struct aiocb64 *cb) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<aio_error64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ed9(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec0(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<aio_error64>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.aiocb64 = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @aio_error64(%struct.aiocb64* %0) {
%2 = alloca %struct.aiocb64*
store %struct.aiocb64* %0, %struct.aiocb64** %2
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.aiocb64 = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @aio_error64(%struct.aiocb64* nocapture readnone %0) {
%2 = load i32, i32* @ENOSYS
store i32 %2, i32* @errno
ret i32 -1
}
/* Type definitions */
struct tree {
  int dummy;
};

/* Variables and functions */
int parse_tree_gently(struct tree *, int /*<<< orphan*/);
int parse_tree(struct tree *tree) { return parse_tree_gently(tree, 0); }


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

x86 assembly (clang, -O2):
<parse_tree>:
xor    %esi,%esi
jmp    1030 <parse_tree_gently@plt>

LLVM IR (-O0):
%struct.tree = type { i32 }
define i32 @parse_tree(%struct.tree* %0) {
%2 = alloca %struct.tree*
store %struct.tree* %0, %struct.tree** %2
%3 = load %struct.tree*, %struct.tree** %2
%4 = call i32 @parse_tree_gently(%struct.tree* %3, i32 0)
ret i32 %4
}

LLVM IR (-O2):
%struct.tree = type { i32 }
define i32 @parse_tree(%struct.tree* %0) {
%2 = tail call i32 @parse_tree_gently(%struct.tree* %0, i32 0)
ret i32 %2
}
/* Type definitions */
struct memorycontainer {
  int dummy;
};

/* Variables and functions */
struct memorycontainer *createExpression(int, struct memorycontainer *,
                                         struct memorycontainer *);
struct memorycontainer *
createNeqExpression(struct memorycontainer *expression1,
                    struct memorycontainer *expression2) {
  return createExpression(0x0006, expression1, expression2);
}


x86 assembly (clang, -O0):
<createNeqExpression>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x6,%edi
call   1030 <createExpression@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createNeqExpression>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x6,%edi
jmp    1030 <createExpression@plt>

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

LLVM IR (-O2):
%struct.memorycontainer = type { i32 }
define %struct.memorycontainer* @createNeqExpression(%struct.memorycontainer* %0, %struct.memorycontainer* %1) {
%3 = tail call %struct.memorycontainer* @createExpression(i32 6, %struct.memorycontainer* %0, %struct.memorycontainer* %1)
ret %struct.memorycontainer* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ eeprom_read_dword(int /*<<< orphan*/ *);
uint32_t eeconfig_read_kb(void) { return eeprom_read_dword((uint32_t *)15); }


x86 assembly (clang, -O0):
<eeconfig_read_kb>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf,%edi
call   1030 <eeprom_read_dword@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<eeconfig_read_kb>:
mov    $0xf,%edi
jmp    1030 <eeprom_read_dword@plt>

LLVM IR (-O0):
define i32 @eeconfig_read_kb() {
%1 = call i32 @eeprom_read_dword(i32* inttoptr (i64 15 to i32*))
ret i32 %1
}

LLVM IR (-O2):
define i32 @eeconfig_read_kb() {
%1 = tail call i32 @eeprom_read_dword(i32* inttoptr (i64 15 to i32*))
ret i32 %1
}
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  long tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
long u_currenttime() {
  struct timeval t;
  gettimeofday(&t, (struct timezone *)0);
  return (t.tv_sec);
}


x86 assembly (clang, -O0):
<u_currenttime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<u_currenttime>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i64 }
%struct.timezone = type { i32 }
define i64 @u_currenttime() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i64, i64* %3
ret i64 %4
}

LLVM IR (-O2):
%struct.timeval = type { i64 }
%struct.timezone = type { i32 }
define i64 @u_currenttime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i64, i64* %4
ret i64 %5
}
void StoreRelease(void *volatile *addr, void *v) {
  WriteFence();
  *addr = v;
}


x86 assembly (clang, -O0):
<StoreRelease>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <WriteFence@plt>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StoreRelease>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <WriteFence@plt>
mov    %r14,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @StoreRelease(i8** %0, i8* %1) {
%3 = tail call i32 (...) @WriteFence()
store volatile i8* %1, i8** %0
ret void
}
void rop3_203_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = *D & S;
  stk2 = T | stk3;
  stk1 = S ^ stk2;
  stk1 = ~stk1;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_203_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xd(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xd(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_203_1_0>:
mov    (%rdi),%al
and    %sil,%al
or     %esi,%edx
not    %dl
or     %al,%dl
mov    %dl,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_203_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8*, i8** %4
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = load i8, i8* %5
%14 = zext i8 %13 to i32
%15 = and i32 %12, %14
%16 = trunc i32 %15 to i8
store i8 %16, i8* %9
%17 = load i8, i8* %6
%18 = zext i8 %17 to i32
%19 = load i8, i8* %9
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
%22 = trunc i32 %21 to i8
store i8 %22, i8* %8
%23 = load i8, i8* %5
%24 = zext i8 %23 to i32
%25 = load i8, i8* %8
%26 = zext i8 %25 to i32
%27 = xor i32 %24, %26
%28 = trunc i32 %27 to i8
store i8 %28, i8* %7
%29 = load i8, i8* %7
%30 = zext i8 %29 to i32
%31 = xor i32 %30, -1
%32 = trunc i32 %31 to i8
store i8 %32, i8* %7
%33 = load i8, i8* %7
%34 = zext i8 %33 to i32
%35 = load i8, i8* %5
%36 = zext i8 %35 to i32
%37 = xor i32 %36, -1
%38 = and i32 %34, %37
%39 = load i8*, i8** %4
%40 = load i8, i8* %39
%41 = zext i8 %40 to i32
%42 = load i8, i8* %5
%43 = zext i8 %42 to i32
%44 = and i32 %41, %43
%45 = or i32 %38, %44
%46 = trunc i32 %45 to i8
%47 = load i8*, i8** %4
store i8 %46, i8* %47
ret void
}

LLVM IR (-O2):
define void @rop3_203_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = and i8 %4, %1
%6 = or i8 %2, %1
%7 = xor i8 %6, -1
%8 = or i8 %5, %7
store i8 %8, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ verTriangulo();
int main(void) { verTriangulo(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @verTriangulo()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @verTriangulo()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ FLEXCOMM9_DriverIRQHandler();
__attribute__((weak)) void FLEXCOMM9_IRQHandler(void) {
  FLEXCOMM9_DriverIRQHandler();
}


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

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

LLVM IR (-O0):
define weak void @FLEXCOMM9_IRQHandler() {
%1 = call i32 (...) @FLEXCOMM9_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @FLEXCOMM9_IRQHandler() {
%1 = tail call i32 (...) @FLEXCOMM9_DriverIRQHandler()
ret void
}
/* Type definitions */
struct katcl_parse {
  int dummy;
};

/* Variables and functions */
struct katcl_parse *turnaround_extra_parse_katcl(struct katcl_parse *, int,
                                                 int /*<<< orphan*/ *);
struct katcl_parse *turnaround_parse_katcl(struct katcl_parse *p, int code) {
  return turnaround_extra_parse_katcl(p, code, NULL);
}


x86 assembly (clang, -O0):
<turnaround_parse_katcl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <turnaround_extra_parse_katcl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<turnaround_parse_katcl>:
xor    %edx,%edx
jmp    1030 <turnaround_extra_parse_katcl@plt>

LLVM IR (-O0):
%struct.katcl_parse = type { i32 }
define %struct.katcl_parse* @turnaround_parse_katcl(%struct.katcl_parse* %0, i32 %1) {
%3 = alloca %struct.katcl_parse*
%4 = alloca i32
store %struct.katcl_parse* %0, %struct.katcl_parse** %3
store i32 %1, i32* %4
%5 = load %struct.katcl_parse*, %struct.katcl_parse** %3
%6 = load i32, i32* %4
%7 = call %struct.katcl_parse* @turnaround_extra_parse_katcl(%struct.katcl_parse* %5, i32 %6, i32* null)
ret %struct.katcl_parse* %7
}

LLVM IR (-O2):
%struct.katcl_parse = type { i32 }
define %struct.katcl_parse* @turnaround_parse_katcl(%struct.katcl_parse* %0, i32 %1) {
%3 = tail call %struct.katcl_parse* @turnaround_extra_parse_katcl(%struct.katcl_parse* %0, i32 %1, i32* null)
ret %struct.katcl_parse* %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ stderr;
void int_ok(int got, int expected) {
  if (got == expected)
    return;
  fprintf(stderr, "Got %d, expected %d\n", got, expected);
  exit(1);
}


x86 assembly (clang, -O0):
<int_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1140 <int_ok+0x20>
add    $0x10,%rsp
pop    %rbp
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xeaa(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<int_ok>:
cmp    %esi,%edi
jne    1125 <int_ok+0x5>
ret
push   %rax
mov    %esi,%ecx
mov    %edi,%edx
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"Got %d, expected %d\0A\00"
define void @int_ok(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 = icmp eq i32 %5, %6
br i1 %7, label %8, label %9
8: ; preds = %2
ret void
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12)
%14 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"Got %d, expected %d\0A\00"
define void @int_ok(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
br i1 %3, label %4, label %5
4: ; preds = %2
ret void
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%8 = tail call i32 @exit(i32 1)
unreachable
}
void break_here() {}


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

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

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

LLVM IR (-O2):
define void @break_here() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void display_write_buffer(uint8_t x_rect, uint8_t y_rect) {}


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

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

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

LLVM IR (-O2):
define void @display_write_buffer(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int entry1(int /*<<< orphan*/);
int entry2(int);
int entry3(int);
int main() {
  if (entry1(0) != 3)
    abort();
  if (entry2(89) != 91)
    abort();
  if (entry3(100) != 101)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1050 <entry1@plt>
cmp    $0x3,%eax
je     1166 <main+0x26>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x59,%edi
call   1060 <entry2@plt>
cmp    $0x5b,%eax
je     1180 <main+0x40>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x64,%edi
call   1040 <entry3@plt>
cmp    $0x65,%eax
je     119a <main+0x5a>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <entry1@plt>
cmp    $0x3,%eax
jne    116f <main+0x2f>
mov    $0x59,%edi
call   1060 <entry2@plt>
cmp    $0x5b,%eax
jne    116f <main+0x2f>
mov    $0x64,%edi
call   1040 <entry3@plt>
cmp    $0x65,%eax
jne    116f <main+0x2f>
xor    %eax,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @entry1(i32 0)
%3 = icmp ne i32 %2, 3
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @entry2(i32 89)
%8 = icmp ne i32 %7, 91
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %6
%12 = call i32 @entry3(i32 100)
%13 = icmp ne i32 %12, 101
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @entry1(i32 0)
%2 = icmp eq i32 %1, 3
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @entry2(i32 89)
%7 = icmp eq i32 %6, 91
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %5
%11 = tail call i32 @entry3(i32 100)
%12 = icmp eq i32 %11, 101
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 (...) @abort()
unreachable
15: ; preds = %10
ret i32 0
}
/* Variables and functions */
char *malloc(int);
int rand();
char *realloc(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
char *fn65() {
  char *result;
  result = malloc(20 + rand() % 20);
  result = realloc(result, 30 + rand() % 20);
  strcpy((char *)result, "fn65");
  return result;
}


x86 assembly (clang, -O0):
<fn65>:
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):
<fn65>:
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"fn65\00"
define i8* @fn65() {
%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"fn65\00"
define i8* @fn65() {
%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
}
/* Variables and functions */
int _ctype_lookup(int);
int isprint(int c) {
  return _ctype_lookup(c) & (0x10 | 0x01 | 0x02 | 0x04 | 0x80);
}


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

x86 assembly (clang, -O2):
<isprint>:
push   %rax
call   1030 <_ctype_lookup@plt>
and    $0x97,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @isprint(i32 %0) {
%2 = tail call i32 @_ctype_lookup(i32 %0)
%3 = and i32 %2, 151
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ *stdout;
void helpAndExit(int status, const char *progname) {
  FILE *stream = stderr;
  if (status == EXIT_SUCCESS)
    stream = stdout;
  fprintf(stream, "Usage: %s [lib-path] [func-name]\n", progname);
  exit(status);
}


x86 assembly (clang, -O0):
<helpAndExit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%eax
jne    115d <helpAndExit+0x3d>
mov    0x2e82(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe94(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<helpAndExit>:
push   %rbx
mov    %rsi,%rdx
mov    %edi,%ebx
mov    0x2ea3(%rip),%rax
cmp    %edi,(%rax)
jne    113a <helpAndExit+0x1a>
mov    0x2ea0(%rip),%rax
jmp    1141 <helpAndExit+0x21>
mov    0x2e9f(%rip),%rax
mov    (%rax),%rdi
lea    0xeb5(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32* null
@EXIT_SUCCESS = global i32 0
@stdout = global i32* null
@.str = [34 x i8] c"Usage: %s [lib-path] [func-name]\0A\00"
define void @helpAndExit(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32*, i32** @stderr
store i32* %6, i32** %5
%7 = load i32, i32* %3
%8 = load i32, i32* @EXIT_SUCCESS
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i32*, i32** @stdout
store i32* %11, i32** %5
br label %12
12: ; preds = %10, %2
%13 = load i32*, i32** %5
%14 = load i8*, i8** %4
%15 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* %3
%17 = call i32 @exit(i32 %16)
unreachable
}

LLVM IR (-O2):
@stderr = global i32* null
@EXIT_SUCCESS = global i32 0
@stdout = global i32* null
@.str = [34 x i8] c"Usage: %s [lib-path] [func-name]\0A\00"
define void @helpAndExit(i32 %0, i8* %1) {
%3 = load i32, i32* @EXIT_SUCCESS
%4 = icmp eq i32 %3, %0
%5 = load i32*, i32** @stdout
%6 = load i32*, i32** @stderr
%7 = select i1 %4, i32* %5, i32* %6
%8 = tail call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %1)
%9 = tail call i32 @exit(i32 %0)
unreachable
}
int test_imm_CFuint16_mem(unsigned short *val) {
  return ((*val) & (0xCF << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_CFuint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, 207
%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_CFuint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 207
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ b(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc) {
  printf("a(%d)\n", argc);
  b(argc * 3);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
lea    (%rbx,%rbx,2),%edi
call   1030 <b@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"a(%d)\0A\00"
define i32 @main(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = mul nsw i32 %0, 3
%4 = tail call i32 @b(i32 %3)
ret i32 0
}
float futrts_lerp32(float v0, float v1, float t) { return v0 + (v1 - v0) * t; }


x86 assembly (clang, -O0):
<futrts_lerp32>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<futrts_lerp32>:
subss  %xmm0,%xmm1
mulss  %xmm2,%xmm1
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @futrts_lerp32(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = load float, float* %4
%10 = fsub float %8, %9
%11 = load float, float* %6
%12 = call float @llvm.fmuladd.f32(float %10, float %11, float %7)
ret float %12
}

LLVM IR (-O2):
define float @futrts_lerp32(float %0, float %1, float %2) {
%4 = fsub float %1, %0
%5 = tail call float @llvm.fmuladd.f32(float %4, float %2, float %0)
ret float %5
}
void BN_num_bits(void) {}


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

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

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

LLVM IR (-O2):
define void @BN_num_bits() {
ret void
}
void test_invalid_clause() {
  int i;
#pragma omp target teams distribute parallel for foo bar
  for (i = 0; i < 16; ++i)
    ;
}


x86 assembly (clang, -O0):
<test_invalid_clause>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x10,-0x4(%rbp)
jge    1128 <test_invalid_clause+0x28>
jmp    111a <test_invalid_clause+0x1a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <test_invalid_clause+0xb>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @test_invalid_clause() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ wcslen(int /*<<< orphan*/ *);
void uninivar_wcslen(void) {
  wchar_t *s;
  (void)wcslen(s);
}


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

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

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

LLVM IR (-O2):
define void @uninivar_wcslen() {
ret void
}
void f1() {
  static int a __attribute__((used));
  int b __attribute__((used));
}


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

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

LLVM IR (-O0):
@f1.a = internal global i32 0
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32* @f1.a to i8*)], section "llvm.metadata"
define void @f1() {
%1 = alloca i32
ret void
}

LLVM IR (-O2):
@f1.a = internal global i32 0
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32* @f1.a to i8*)], section "llvm.metadata"
define void @f1() {
ret void
}
/* Variables and functions */
void tbtt_tasklet(unsigned long data) {}


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

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

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

LLVM IR (-O2):
define void @tbtt_tasklet(i64 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fwrite(char *, size_t, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
void write_buff_out(char *buff, size_t length, FILE *fd) {
  if (fwrite(buff, length, 1, fd) < 1) {
    perror("error writing buffer to output file");
    fclose(fd);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<write_buff_out>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    $0x1,%edx
call   1060 <fwrite@plt>
cmp    $0x1,%eax
jge    1192 <write_buff_out+0x52>
lea    0xe86(%rip),%rdi
call   1040 <perror@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_buff_out>:
push   %rbx
mov    %rdx,%rbx
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fwrite@plt>
test   %eax,%eax
jle    1157 <write_buff_out+0x17>
pop    %rbx
ret
lea    0xea2(%rip),%rdi
call   1040 <perror@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"error writing buffer to output file\00"
define void @write_buff_out(i8* %0, i64 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = load i32*, i32** %6
%10 = call i32 @fwrite(i8* %7, i64 %8, i32 1, i32* %9)
%11 = icmp slt i32 %10, 1
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%14 = load i32*, i32** %6
%15 = call i32 @fclose(i32* %14)
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"error writing buffer to output file\00"
define void @write_buff_out(i8* nocapture %0, i64 %1, i32* nocapture %2) {
%4 = tail call i32 @fwrite(i8* %0, i64 %1, i32 1, i32* %2)
%5 = icmp slt i32 %4, 1
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @fclose(i32* %2)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LexIsKeyword(int, int);
int LexIsVariable(int idx1, int idx2) { return !LexIsKeyword(idx1, idx2); }


x86 assembly (clang, -O0):
<LexIsVariable>:
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 <LexIsKeyword@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LexIsVariable>:
push   %rax
call   1030 <LexIsKeyword@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @LexIsVariable(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 @LexIsKeyword(i32 %5, i32 %6)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @LexIsVariable(i32 %0, i32 %1) {
%3 = tail call i32 @LexIsKeyword(i32 %0, i32 %1)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
unsigned setbits(unsigned x, int p, int n, unsigned y) {
  x = (x >> (p + 1 - n)) & ~(~0 << n);
  y = y >> n;
  y = y << n;
  x = x | y;
  return x;
}


x86 assembly (clang, -O0):
<setbits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
sub    -0xc(%rbp),%ecx
shr    %cl,%eax
mov    -0xc(%rbp),%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
shr    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<setbits>:
mov    %ecx,%eax
sub    %edx,%esi
lea    0x1(%rsi),%ecx
shr    %cl,%edi
xor    %edi,%eax
mov    %edx,%ecx
shr    %cl,%eax
shl    %cl,%eax
xor    %edi,%eax
ret

LLVM IR (-O0):
define i32 @setbits(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = add nsw i32 %10, 1
%12 = load i32, i32* %7
%13 = sub nsw i32 %11, %12
%14 = lshr i32 %9, %13
%15 = load i32, i32* %7
%16 = shl i32 -1, %15
%17 = xor i32 %16, -1
%18 = and i32 %14, %17
store i32 %18, i32* %5
%19 = load i32, i32* %8
%20 = load i32, i32* %7
%21 = lshr i32 %19, %20
store i32 %21, i32* %8
%22 = load i32, i32* %8
%23 = load i32, i32* %7
%24 = shl i32 %22, %23
store i32 %24, i32* %8
%25 = load i32, i32* %5
%26 = load i32, i32* %8
%27 = or i32 %25, %26
store i32 %27, i32* %5
%28 = load i32, i32* %5
ret i32 %28
}

LLVM IR (-O2):
define i32 @setbits(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = add nsw i32 %1, 1
%6 = sub i32 %5, %2
%7 = lshr i32 %0, %6
%8 = shl nsw i32 -1, %2
%9 = xor i32 %8, -1
%10 = and i32 %7, %9
%11 = and i32 %8, %3
%12 = or i32 %10, %11
ret i32 %12
}
/* Variables and functions */
int cos(double);
double c(double orig_price) { return 12.00 + 9 * cos(orig_price); }


x86 assembly (clang, -O0):
<c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <cos@plt>
imul   $0x9,%eax,%eax
cvtsi2sd %eax,%xmm1
movsd  0xeca(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c>:
push   %rax
call   1030 <cos@plt>
lea    (%rax,%rax,8),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0xed8(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @c(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @cos(double %3)
%5 = mul nsw i32 9, %4
%6 = sitofp i32 %5 to double
%7 = fadd double 1.200000e+01, %6
ret double %7
}

LLVM IR (-O2):
define double @c(double %0) {
%2 = tail call i32 @cos(double %0)
%3 = mul nsw i32 %2, 9
%4 = sitofp i32 %3 to double
%5 = fadd double %4, 1.200000e+01
ret double %5
}