xunge/DecIR huggingface dataset:
/* Type definitions */
typedef float uint32_t;

/* Variables and functions */
float dds_phase_to_radians(uint32_t phase) {
  return phase * 2.0f * 3.1415926f / (65536.0f * 65536.0f);
}


x86 assembly (clang, -O0):
<dds_phase_to_radians>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xef7(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  0xee6(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xed6(%rip),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dds_phase_to_radians>:
addss  %xmm0,%xmm0
mulss  0xef4(%rip),%xmm0
mulss  0xef0(%rip),%xmm0
ret

LLVM IR (-O0):
define float @dds_phase_to_radians(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fmul float %3, 2.000000e+00
%5 = fmul float %4, 0x400921FB40000000
%6 = fdiv float %5, 0x41F0000000000000
ret float %6
}

LLVM IR (-O2):
define float @dds_phase_to_radians(float %0) {
%2 = fmul float %0, 2.000000e+00
%3 = fmul float %2, 0x400921FB40000000
%4 = fmul float %3, 0x3DF0000000000000
ret float %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void Bit_Set(uint8_t *aPtr, int num) { aPtr[num / 8] |= (1 << (num % 8)); }


x86 assembly (clang, -O0):
<Bit_Set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x1c(%rbp),%edx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
or     (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Bit_Set>:
mov    %esi,%ecx
and    $0x7,%cl
mov    $0x1,%eax
shl    %cl,%eax
lea    0x7(%rsi),%ecx
test   %esi,%esi
cmovns %esi,%ecx
sar    $0x3,%ecx
movslq %ecx,%rcx
or     %eax,(%rdi,%rcx,4)
ret

LLVM IR (-O0):
define void @Bit_Set(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = srem i32 %5, 8
%7 = shl i32 1, %6
%8 = load i32*, i32** %3
%9 = load i32, i32* %4
%10 = sdiv i32 %9, 8
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %8, i64 %11
%13 = load i32, i32* %12
%14 = or i32 %13, %7
store i32 %14, i32* %12
ret void
}

LLVM IR (-O2):
define void @Bit_Set(i32* nocapture %0, i32 %1) {
%3 = and i32 %1, 7
%4 = shl nuw nsw i32 1, %3
%5 = sdiv i32 %1, 8
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = load i32, i32* %7
%9 = or i32 %8, %4
store i32 %9, i32* %7
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void sys_put_be16(uint16_t val, uint8_t dst[2]) {
  dst[0] = val >> 8;
  dst[1] = val;
}


x86 assembly (clang, -O0):
<sys_put_be16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_put_be16>:
mov    %edi,%eax
sar    $0x8,%eax
mov    %eax,(%rsi)
mov    %edi,0x4(%rsi)
ret

LLVM IR (-O0):
define void @sys_put_be16(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 = ashr i32 %5, 8
%7 = load i32*, i32** %4
%8 = getelementptr inbounds i32, i32* %7, i64 0
store i32 %6, i32* %8
%9 = load i32, i32* %3
%10 = load i32*, i32** %4
%11 = getelementptr inbounds i32, i32* %10, i64 1
store i32 %9, i32* %11
ret void
}

LLVM IR (-O2):
define void @sys_put_be16(i32 %0, i32* nocapture writeonly %1) {
%3 = ashr i32 %0, 8
store i32 %3, i32* %1
%4 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %0, i32* %4
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void __attribute__((weak)) usr_mlme_rx_enable_conf(uint8_t status) {
  status = status;
}


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

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

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

LLVM IR (-O2):
define weak void @usr_mlme_rx_enable_conf(i32 %0) {
ret void
}
/* Variables and functions */
int FX_SoundActive(int);
int PCFX_SoundPlaying(int);
int SFX_Playing(int handle) {
  if (handle & 0x8000) {
    return PCFX_SoundPlaying(handle & 0x7fff);
  }
  return FX_SoundActive(handle);
}


x86 assembly (clang, -O0):
<SFX_Playing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x8000,%eax
cmp    $0x0,%eax
je     1152 <SFX_Playing+0x32>
mov    -0x8(%rbp),%edi
and    $0x7fff,%edi
call   1030 <PCFX_SoundPlaying@plt>
mov    %eax,-0x4(%rbp)
jmp    115d <SFX_Playing+0x3d>
mov    -0x8(%rbp),%edi
call   1040 <FX_SoundActive@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SFX_Playing>:
test   $0x8000,%edi
jne    112d <SFX_Playing+0xd>
jmp    1040 <FX_SoundActive@plt>
and    $0x7fff,%edi
jmp    1030 <PCFX_SoundPlaying@plt>

LLVM IR (-O0):
define i32 @SFX_Playing(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 32768
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* %3
%9 = and i32 %8, 32767
%10 = call i32 @PCFX_SoundPlaying(i32 %9)
store i32 %10, i32* %2
br label %14
11: ; preds = %1
%12 = load i32, i32* %3
%13 = call i32 @FX_SoundActive(i32 %12)
store i32 %13, i32* %2
br label %14
14: ; preds = %11, %7
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @SFX_Playing(i32 %0) {
%2 = and i32 %0, 32768
%3 = icmp eq i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = and i32 %0, 32767
%6 = tail call i32 @PCFX_SoundPlaying(i32 %5)
br label %9
7: ; preds = %1
%8 = tail call i32 @FX_SoundActive(i32 %0)
br label %9
9: ; preds = %7, %4
%10 = phi i32 [ %6, %4 ], [ %8, %7 ]
ret i32 %10
}
int Athena_Private_DestroyHandle(void *x) {
  if (x == 1)
    return 0;
  return -1;
}


x86 assembly (clang, -O0):
<Athena_Private_DestroyHandle>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    $0x1,%eax
cmp    %rax,-0x10(%rbp)
jne    1123 <Athena_Private_DestroyHandle+0x23>
movl   $0x0,-0x4(%rbp)
jmp    112a <Athena_Private_DestroyHandle+0x2a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Athena_Private_DestroyHandle>:
xor    %eax,%eax
cmp    $0x1,%rdi
setne  %al
neg    %eax
ret

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

LLVM IR (-O2):
define i32 @Athena_Private_DestroyHandle(i8* readnone %0) {
%2 = icmp ne i8* %0, inttoptr (i64 1 to i8*)
%3 = sext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getprogname();
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr, "Usage: %s -nue2 [-d] [-s <file>]\n", getprogname());
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rdx
lea    0xea8(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xeb8(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"Usage: %s -nue2 [-d] [-s <file>]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i8* (...) @getprogname()
%3 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"Usage: %s -nue2 [-d] [-s <file>]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i8* (...) @getprogname()
%3 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int testfile(char *file) {
  FILE *f;
  int flag;
  if ((f = fopen(file, "r")) == NULL) {
    flag = 0;
  } else {
    flag = 1;
    fclose(f);
  }
  return flag;
}


x86 assembly (clang, -O0):
<testfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1156 <testfile+0x36>
movl   $0x0,-0x14(%rbp)
jmp    1166 <testfile+0x46>
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testfile>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1141 <testfile+0x21>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @testfile(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void USBHostEndpointPing(uint32_t ui32Base, uint32_t ui32Endpoint,
                         bool bEnable) {
  ;
  ;
  if (bEnable) {
    (*((volatile uint8_t *)(0x40050000 + 0x00000103))) &= ~0x00000008;
  } else {
    (*((volatile uint8_t *)(0x40050000 + 0x00000103))) |= 0x00000008;
  }
}


x86 assembly (clang, -O0):
<USBHostEndpointPing>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     112d <USBHostEndpointPing+0x2d>
mov    $0x40050103,%eax
mov    (%rax),%ecx
and    $0xfffffff7,%ecx
mov    $0x40050103,%eax
mov    %ecx,(%rax)
jmp    113e <USBHostEndpointPing+0x3e>
mov    $0x40050103,%eax
mov    (%rax),%ecx
or     $0x8,%ecx
mov    $0x40050103,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBHostEndpointPing>:
xor    %eax,%eax
test   %edx,%edx
sete   %al
mov    0x40050103,%ecx
and    $0xfffffff7,%ecx
lea    (%rcx,%rax,8),%eax
mov    %eax,0x40050103
ret

LLVM IR (-O0):
define void @USBHostEndpointPing(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = load volatile i32, i32* inttoptr (i64 1074069763 to i32*)
%11 = and i32 %10, -9
store volatile i32 %11, i32* inttoptr (i64 1074069763 to i32*)
br label %15
12: ; preds = %3
%13 = load volatile i32, i32* inttoptr (i64 1074069763 to i32*)
%14 = or i32 %13, 8
store volatile i32 %14, i32* inttoptr (i64 1074069763 to i32*)
br label %15
15: ; preds = %12, %9
ret void
}

LLVM IR (-O2):
define void @USBHostEndpointPing(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = load volatile i32, i32* inttoptr (i64 1074069763 to i32*)
%6 = and i32 %5, -9
%7 = select i1 %4, i32 8, i32 0
%8 = or i32 %6, %7
store volatile i32 %8, i32* inttoptr (i64 1074069763 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ return_struct_d1();
int /*<<< orphan*/ take_struct_d1(int /*<<< orphan*/);
void test_struct_d1() { take_struct_d1(return_struct_d1()); }


x86 assembly (clang, -O0):
<test_struct_d1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <return_struct_d1@plt>
mov    %eax,%edi
call   1030 <take_struct_d1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_struct_d1>:
push   %rax
xor    %eax,%eax
call   1040 <return_struct_d1@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <take_struct_d1@plt>

LLVM IR (-O0):
define void @test_struct_d1() {
%1 = call i32 (...) @return_struct_d1()
%2 = call i32 @take_struct_d1(i32 %1)
ret void
}

LLVM IR (-O2):
define void @test_struct_d1() {
%1 = tail call i32 (...) @return_struct_d1()
%2 = tail call i32 @take_struct_d1(i32 %1)
ret void
}
void setval_470(unsigned *p) { *p = 3223372185U; }


x86 assembly (clang, -O0):
<setval_470>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0xc020c199,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<setval_470>:
movl   $0xc020c199,(%rdi)
ret

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

LLVM IR (-O2):
define void @setval_470(i32* nocapture writeonly %0) {
store i32 -1071595111, i32* %0
ret void
}
int atomic_dec(int *x) { return __sync_fetch_and_add(x, -1); }


x86 assembly (clang, -O0):
<atomic_dec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0xffffffff,%eax
lock xadd %eax,(%rcx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<atomic_dec>:
mov    $0xffffffff,%eax
lock xadd %eax,(%rdi)
ret

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

LLVM IR (-O2):
define i32 @atomic_dec(i32* nocapture %0) {
%2 = atomicrmw add i32* %0, i32 -1 seq_cst
ret i32 %2
}
/* Variables and functions */
double M_PI;
double get_xi(double xlen, double beta) {
  double xi, xcm;
  xcm = xlen / 10000.0;
  xi = 2.0 * M_PI * 511.0 * xcm * (7.8e-26) * (2.32 * (6.02e23) * 0.5) /
       (beta * beta);
  return (xi);
}


x86 assembly (clang, -O0):
<get_xi>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xf05(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xeec(%rip),%xmm0
mov    0x2eb5(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xed1(%rip),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xeb8(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea4(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_xi>:
divsd  0xef8(%rip),%xmm0
mov    0x2ed9(%rip),%rax
movsd  (%rax),%xmm2
addsd  %xmm2,%xmm2
mulsd  0xee9(%rip),%xmm2
mulsd  %xmm2,%xmm0
mulsd  0xee5(%rip),%xmm0
mulsd  0xee5(%rip),%xmm0
mulsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @get_xi(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
store double %1, double* %4
%7 = load double, double* %3
%8 = fdiv double %7, 1.000000e+04
store double %8, double* %6
%9 = load double, double* @M_PI
%10 = fmul double 2.000000e+00, %9
%11 = fmul double %10, 5.110000e+02
%12 = load double, double* %6
%13 = fmul double %11, %12
%14 = fmul double %13, 0x3AB823CBF2F73933
%15 = fmul double %14, 0x44E27C001905C247
%16 = load double, double* %4
%17 = load double, double* %4
%18 = fmul double %16, %17
%19 = fdiv double %15, %18
store double %19, double* %5
%20 = load double, double* %5
ret double %20
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @get_xi(double %0, double %1) {
%3 = fdiv double %0, 1.000000e+04
%4 = load double, double* @M_PI
%5 = fmul double %4, 2.000000e+00
%6 = fmul double %5, 5.110000e+02
%7 = fmul double %3, %6
%8 = fmul double %7, 0x3AB823CBF2F73933
%9 = fmul double %8, 0x44E27C001905C247
%10 = fmul double %1, %1
%11 = fdiv double %9, %10
ret double %11
}
/* Variables and functions */
char *strrchr(char const *, char);
char *x_strdup(char const *);
char *str_basename(const char *s) {
  char *p;
  p = strrchr(s, '/');
  if (p) {
    s = (p + 1);
  }
  p = strrchr(s, '/');
  if (p) {
    s = (p + 1);
  }
  return x_strdup(s);
}


x86 assembly (clang, -O0):
<str_basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1155 <str_basename+0x35>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     117e <str_basename+0x5e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <x_strdup@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_basename>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rbx
test   %rax,%rax
cmove  %r14,%rbx
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rdi
test   %rax,%rax
cmove  %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <x_strdup@plt>

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

LLVM IR (-O2):
define i8* @str_basename(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
%6 = tail call i8* @strrchr(i8* dereferenceable(1) %5, i8 signext 47)
%7 = icmp eq i8* %6, null
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = select i1 %7, i8* %5, i8* %8
%10 = tail call i8* @x_strdup(i8* %9)
ret i8* %10
}
int test_imm_52int32_mem(int *val) {
  return ((*val) & (0x52 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_52int32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 82
%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_52int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 82
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ x;
};
struct TYPE_4__ {
  TYPE_1__ xconfigure;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
int get_XEvent_xconfigure_x(void *_p) {
  return (int)((XEvent *)_p)->xconfigure.x;
}


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

x86 assembly (clang, -O2):
<get_XEvent_xconfigure_x>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64 }
define i32 @get_XEvent_xconfigure_x(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_4__*
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i32 0, i32 0
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @get_XEvent_xconfigure_x(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
void idAndClearIRQ() {}


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

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

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

LLVM IR (-O2):
define void @idAndClearIRQ() {
ret void
}
char *get_longpath(char *path) { return path; }


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

x86 assembly (clang, -O2):
<get_longpath>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @get_longpath(i8* readnone returned %0) {
ret i8* %0
}
void load_13() { float matColors[4]; }


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

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

LLVM IR (-O0):
define void @load_13() {
%1 = alloca [4 x float]
ret void
}

LLVM IR (-O2):
define void @load_13() {
ret void
}
/* Variables and functions */
int random();
int get_bit() {
  int bit;
  static int bits = 0;
  static int x;
  if (bits == 0) {
    x = random();
    bits = 31;
  }
  bit = x & 1;
  x = x >> 1;
  bits--;
  return bit;
}


x86 assembly (clang, -O0):
<get_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cmpl   $0x0,0x2f0d(%rip)
jne    113c <get_bit+0x2c>
mov    $0x0,%al
call   1030 <random@plt>
mov    %eax,0x2efe(%rip)
movl   $0x1f,0x2ef0(%rip)
mov    0x2eee(%rip),%eax
and    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    0x2ee2(%rip),%eax
sar    $0x1,%eax
mov    %eax,0x2ed9(%rip)
mov    0x2ecf(%rip),%eax
add    $0xffffffff,%eax
mov    %eax,0x2ec6(%rip)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_bit>:
push   %rax
mov    0x2f15(%rip),%edx
test   %edx,%edx
je     1126 <get_bit+0x16>
mov    0x2f0f(%rip),%eax
add    $0xffffffff,%edx
jmp    1132 <get_bit+0x22>
xor    %eax,%eax
call   1030 <random@plt>
mov    $0x1e,%edx
mov    %eax,%ecx
and    $0x1,%ecx
sar    %eax
mov    %eax,0x2ef1(%rip)
mov    %edx,0x2ee7(%rip)
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@get_bit.bits = internal global i32 0
@get_bit.x = internal global i32 0
define i32 @get_bit() {
%1 = alloca i32
%2 = load i32, i32* @get_bit.bits
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @random()
store i32 %5, i32* @get_bit.x
store i32 31, i32* @get_bit.bits
br label %6
6: ; preds = %4, %0
%7 = load i32, i32* @get_bit.x
%8 = and i32 %7, 1
store i32 %8, i32* %1
%9 = load i32, i32* @get_bit.x
%10 = ashr i32 %9, 1
store i32 %10, i32* @get_bit.x
%11 = load i32, i32* @get_bit.bits
%12 = add nsw i32 %11, -1
store i32 %12, i32* @get_bit.bits
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@get_bit.bits = internal unnamed_addr global i32 0
@get_bit.x = internal unnamed_addr global i32 0
define i32 @get_bit() {
%1 = load i32, i32* @get_bit.bits
%2 = icmp eq i32 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = load i32, i32* @get_bit.x
%5 = add i32 %1, -1
br label %8
6: ; preds = %0
%7 = tail call i32 (...) @random()
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ %5, %3 ], [ 30, %6 ]
%10 = phi i32 [ %4, %3 ], [ %7, %6 ]
%11 = and i32 %10, 1
%12 = ashr i32 %10, 1
store i32 %12, i32* @get_bit.x
store i32 %9, i32* @get_bit.bits
ret i32 %11
}
/* Variables and functions */
int dal_reg_read(unsigned int, unsigned int, unsigned int *);
int egress_reg_get(unsigned int dev_id, unsigned int reg_addr,
                   unsigned int *pvalue) {
  return dal_reg_read(dev_id, reg_addr + 0x0, pvalue);
}


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

x86 assembly (clang, -O2):
<egress_reg_get>:
jmp    1030 <dal_reg_read@plt>

LLVM IR (-O0):
define i32 @egress_reg_get(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = add i32 %8, 0
%10 = load i32*, i32** %6
%11 = call i32 @dal_reg_read(i32 %7, i32 %9, i32* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @egress_reg_get(i32 %0, i32 %1, i32* %2) {
%4 = tail call i32 @dal_reg_read(i32 %0, i32 %1, i32* %2)
ret i32 %4
}
void pinWrite(int pin, int value) { ; }


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

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

LLVM IR (-O0):
define void @pinWrite(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 @pinWrite(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
unsigned long MsgBoxW22(short const *, short const *, unsigned long);
unsigned long msgboxw(const short int *s, const short int *title,
                      unsigned long i) {
  return MsgBoxW22(s, title, i);
}


x86 assembly (clang, -O0):
<msgboxw>:
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),%rdx
call   1030 <MsgBoxW22@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msgboxw>:
jmp    1030 <MsgBoxW22@plt>

LLVM IR (-O0):
define i64 @msgboxw(i16* %0, i16* %1, i64 %2) {
%4 = alloca i16*
%5 = alloca i16*
%6 = alloca i64
store i16* %0, i16** %4
store i16* %1, i16** %5
store i64 %2, i64* %6
%7 = load i16*, i16** %4
%8 = load i16*, i16** %5
%9 = load i64, i64* %6
%10 = call i64 @MsgBoxW22(i16* %7, i16* %8, i64 %9)
ret i64 %10
}

LLVM IR (-O2):
define i64 @msgboxw(i16* %0, i16* %1, i64 %2) {
%4 = tail call i64 @MsgBoxW22(i16* %0, i16* %1, i64 %2)
ret i64 %4
}
unsigned char calcY(unsigned char *Zprime, unsigned char *Q) {
  return ~(*Zprime ^ *Q);
}


x86 assembly (clang, -O0):
<calcY>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movzbl (%rcx),%ecx
xor    %ecx,%eax
xor    $0xffffffff,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcY>:
mov    (%rdi),%al
xor    (%rsi),%al
not    %al
ret

LLVM IR (-O0):
define zeroext i8 @calcY(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* %5
%7 = zext i8 %6 to i32
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = xor i32 %7, %10
%12 = xor i32 %11, -1
%13 = trunc i32 %12 to i8
ret i8 %13
}

LLVM IR (-O2):
define zeroext i8 @calcY(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = xor i8 %3, %4
%6 = xor i8 %5, -1
ret i8 %6
}
/* Variables and functions */
unsigned int log(unsigned int v) {
  unsigned int log = 0;
  unsigned int value = 1;
  while (value < v) {
    value <<= 1;
    log++;
  }
  return log;
}


x86 assembly (clang, -O0):
<log>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    1138 <log+0x38>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1115 <log+0x15>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<log>:
xor    %eax,%eax
cmp    $0x2,%edi
jb     1119 <log+0x19>
xor    %eax,%eax
mov    $0x1,%ecx
xchg   %ax,%ax
add    %ecx,%ecx
add    $0x1,%eax
cmp    %edi,%ecx
jb     1110 <log+0x10>
ret

LLVM IR (-O0):
define i32 @log(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 1, i32* %4
br label %5
5: ; preds = %9, %1
%6 = load i32, i32* %4
%7 = load i32, i32* %2
%8 = icmp ult i32 %6, %7
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = load i32, i32* %4
%11 = shl i32 %10, 1
store i32 %11, i32* %4
%12 = load i32, i32* %3
%13 = add i32 %12, 1
store i32 %13, i32* %3
br label %5
14: ; preds = %5
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @log(i32 %0) {
%2 = icmp ugt i32 %0, 1
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 1, %1 ]
%5 = phi i32 [ %7, %3 ], [ 0, %1 ]
%6 = shl i32 %4, 1
%7 = add i32 %5, 1
%8 = icmp ult i32 %6, %0
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}
/* Variables and functions */
void func() { char *string = "Hello"; }


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
mov    %rax,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"Hello\00"
define void @func() {
%1 = alloca i8*
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %1
ret void
}

LLVM IR (-O2):
define void @func() {
ret void
}
int test_imm_A1int64_lowword_mem(long long *val) {
  return ((*val) & (0xA1 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_A1int64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 161
%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_A1int64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 161
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() {
  printf("Hello World !");
  return 1;
}


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

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

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

LLVM IR (-O2):
@.str = [14 x i8] c"Hello World !\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ hex_digit(unsigned char);
void hex_byte(unsigned char byte) {
  hex_digit(byte >> 4);
  hex_digit(byte & 0xF);
}


x86 assembly (clang, -O0):
<hex_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
sar    $0x4,%eax
movzbl %al,%edi
call   1030 <hex_digit@plt>
movzbl -0x1(%rbp),%eax
and    $0xf,%eax
movzbl %al,%edi
call   1030 <hex_digit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex_byte>:
push   %rbx
mov    %edi,%ebx
mov    %ebx,%eax
shr    $0x4,%al
movzbl %al,%edi
call   1030 <hex_digit@plt>
and    $0xf,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <hex_digit@plt>

LLVM IR (-O0):
define void @hex_byte(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = ashr i32 %4, 4
%6 = trunc i32 %5 to i8
%7 = call i32 @hex_digit(i8 zeroext %6)
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = and i32 %9, 15
%11 = trunc i32 %10 to i8
%12 = call i32 @hex_digit(i8 zeroext %11)
ret void
}

LLVM IR (-O2):
define void @hex_byte(i8 zeroext %0) {
%2 = lshr i8 %0, 4
%3 = tail call i32 @hex_digit(i8 zeroext %2)
%4 = and i8 %0, 15
%5 = tail call i32 @hex_digit(i8 zeroext %4)
ret void
}
/* Type definitions */
typedef double time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *gmtime(double *);
void Date_Time(double julian_date, struct tm *cdate) {
  time_t jtime;
  jtime = (julian_date - 2440587.5) * 86400.;
  *cdate = *gmtime(&jtime);
}


x86 assembly (clang, -O0):
<Date_Time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeda(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xec6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x18(%rbp),%rdi
call   1030 <gmtime@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    (%rcx),%ecx
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Date_Time>:
push   %rbx
sub    $0x10,%rsp
addsd  0xee3(%rip),%xmm0
mov    %rdi,%rbx
mulsd  0xee0(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <gmtime@plt>
mov    (%rax),%eax
mov    %eax,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define void @Date_Time(double %0, %struct.tm* %1) {
%3 = alloca double
%4 = alloca %struct.tm*
%5 = alloca double
store double %0, double* %3
store %struct.tm* %1, %struct.tm** %4
%6 = load double, double* %3
%7 = fsub double %6, 0x41429EC5C0000000
%8 = fmul double %7, 8.640000e+04
store double %8, double* %5
%9 = load %struct.tm*, %struct.tm** %4
%10 = call %struct.tm* @gmtime(double* %5)
%11 = bitcast %struct.tm* %9 to i8*
%12 = bitcast %struct.tm* %10 to i8*
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define void @Date_Time(double %0, %struct.tm* nocapture writeonly %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = fadd double %0, 0xC1429EC5C0000000
%6 = fmul double %5, 8.640000e+04
store double %6, double* %3
%7 = call %struct.tm* @gmtime(double* %3)
%8 = getelementptr %struct.tm, %struct.tm* %7, i64 0, i32 0
%9 = getelementptr %struct.tm, %struct.tm* %1, i64 0, i32 0
%10 = load i32, i32* %8
store i32 %10, i32* %9
ret void
}
char **g(char **a) { return a + 1; }


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

x86 assembly (clang, -O2):
<g>:
lea    0x8(%rdi),%rax
ret

LLVM IR (-O0):
define i8** @g(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 1
ret i8** %4
}

LLVM IR (-O2):
define i8** @g(i8** readnone %0) {
%2 = getelementptr inbounds i8*, i8** %0, i64 1
ret i8** %2
}
/* Type definitions */
struct wl_shell {
  int dummy;
};
struct wl_proxy {
  int dummy;
};

/* Variables and functions */
void *wl_proxy_get_user_data(struct wl_proxy *);
void *wl_shell_get_user_data(struct wl_shell *wl_shell) {
  return wl_proxy_get_user_data((struct wl_proxy *)wl_shell);
}


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

x86 assembly (clang, -O2):
<wl_shell_get_user_data>:
jmp    1030 <wl_proxy_get_user_data@plt>

LLVM IR (-O0):
%struct.wl_shell = type { i32 }
%struct.wl_proxy = type { i32 }
define i8* @wl_shell_get_user_data(%struct.wl_shell* %0) {
%2 = alloca %struct.wl_shell*
store %struct.wl_shell* %0, %struct.wl_shell** %2
%3 = load %struct.wl_shell*, %struct.wl_shell** %2
%4 = bitcast %struct.wl_shell* %3 to %struct.wl_proxy*
%5 = call i8* @wl_proxy_get_user_data(%struct.wl_proxy* %4)
ret i8* %5
}

LLVM IR (-O2):
%struct.wl_shell = type { i32 }
%struct.wl_proxy = type { i32 }
define i8* @wl_shell_get_user_data(%struct.wl_shell* %0) {
%2 = bitcast %struct.wl_shell* %0 to %struct.wl_proxy*
%3 = tail call i8* @wl_proxy_get_user_data(%struct.wl_proxy* %2)
ret i8* %3
}
__attribute__((visibility("default"))) const char *
utf8proc_unicode_version(void) {
  return "13.0.0";
}


x86 assembly (clang, -O0):
<utf8proc_unicode_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8proc_unicode_version>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"13.0.0\00"
define i8* @utf8proc_unicode_version() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [7 x i8] c"13.0.0\00"
define i8* @utf8proc_unicode_version() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
size_t strnlen_s(char const *, size_t);
size_t strnlen(const char *s, size_t maxlen) { return strnlen_s(s, maxlen); }


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

x86 assembly (clang, -O2):
<strnlen>:
jmp    1030 <strnlen_s@plt>

LLVM IR (-O0):
define i64 @strnlen(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i64 @strnlen_s(i8* %5, i64 %6)
ret i64 %7
}

LLVM IR (-O2):
define i64 @strnlen(i8* %0, i64 %1) {
%3 = tail call i64 @strnlen_s(i8* %0, i64 %1)
ret i64 %3
}
/* Type definitions */
struct l_class_OC_std_KD__KD_vector {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/
_ZNSt6vectorIPiSaIS0_EED2Ev(struct l_class_OC_std_KD__KD_vector *);
void _ZNSt6vectorIPiSaIS0_EED1Ev(
    struct l_class_OC_std_KD__KD_vector *llvm_cbe_this) {
  struct l_class_OC_std_KD__KD_vector *llvm_cbe_this_2e_addr;
  struct l_class_OC_std_KD__KD_vector *llvm_cbe_this1;
  *(&llvm_cbe_this_2e_addr) = llvm_cbe_this;
  llvm_cbe_this1 = *(&llvm_cbe_this_2e_addr);
  _ZNSt6vectorIPiSaIS0_EED2Ev(llvm_cbe_this1);
  return;
}


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

x86 assembly (clang, -O2):
<_ZNSt6vectorIPiSaIS0_EED1Ev>:
jmp    1030 <_ZNSt6vectorIPiSaIS0_EED2Ev@plt>

LLVM IR (-O0):
%struct.l_class_OC_std_KD__KD_vector = type { i32 }
define void @_ZNSt6vectorIPiSaIS0_EED1Ev(%struct.l_class_OC_std_KD__KD_vector* %0) {
%2 = alloca %struct.l_class_OC_std_KD__KD_vector*
%3 = alloca %struct.l_class_OC_std_KD__KD_vector*
%4 = alloca %struct.l_class_OC_std_KD__KD_vector*
store %struct.l_class_OC_std_KD__KD_vector* %0, %struct.l_class_OC_std_KD__KD_vector** %2
%5 = load %struct.l_class_OC_std_KD__KD_vector*, %struct.l_class_OC_std_KD__KD_vector** %2
store %struct.l_class_OC_std_KD__KD_vector* %5, %struct.l_class_OC_std_KD__KD_vector** %3
%6 = load %struct.l_class_OC_std_KD__KD_vector*, %struct.l_class_OC_std_KD__KD_vector** %3
store %struct.l_class_OC_std_KD__KD_vector* %6, %struct.l_class_OC_std_KD__KD_vector** %4
%7 = load %struct.l_class_OC_std_KD__KD_vector*, %struct.l_class_OC_std_KD__KD_vector** %4
%8 = call i32 @_ZNSt6vectorIPiSaIS0_EED2Ev(%struct.l_class_OC_std_KD__KD_vector* %7)
ret void
}

LLVM IR (-O2):
%struct.l_class_OC_std_KD__KD_vector = type { i32 }
define void @_ZNSt6vectorIPiSaIS0_EED1Ev(%struct.l_class_OC_std_KD__KD_vector* %0) {
%2 = tail call i32 @_ZNSt6vectorIPiSaIS0_EED2Ev(%struct.l_class_OC_std_KD__KD_vector* %0)
ret void
}
int reset_mem(void *addr, int size) {
  char *ptr = (char *)addr;
  int i;
  for (i = 0; i < (size); i++) {
    *ptr = 0;
    if (*ptr != 0)
      return -1;
    ptr++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<reset_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1163 <reset_mem+0x63>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1149 <reset_mem+0x49>
movl   $0xffffffff,-0x4(%rbp)
jmp    116a <reset_mem+0x6a>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    111a <reset_mem+0x1a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset_mem>:
test   %esi,%esi
jle    1122 <reset_mem+0x12>
push   %rax
mov    %esi,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @reset_mem(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %2
ret i32 0
}
int test_imm_1Cint8_mem(signed char *val) {
  return ((*val) & (0x1C << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_1Cint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, 28
%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_1Cint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 28
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int real_robot(void) { return (1); }


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

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

LLVM IR (-O0):
define i32 @real_robot() {
ret i32 1
}

LLVM IR (-O2):
define i32 @real_robot() {
ret i32 1
}
void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev) {}


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

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

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

LLVM IR (-O2):
%struct.pci_dev = type opaque
define void @pcie_aspm_remove_sysfs_dev_files(%struct.pci_dev* nocapture %0) {
ret void
}
/* Type definitions */
struct proxy_worker {
  int dummy;
};

/* Variables and functions */
int proxy_worker_recv(struct proxy_worker *);
int proxy_worker_recv_cb(void *worker, void *data) {
  return proxy_worker_recv((struct proxy_worker *)worker);
}


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

x86 assembly (clang, -O2):
<proxy_worker_recv_cb>:
jmp    1030 <proxy_worker_recv@plt>

LLVM IR (-O0):
%struct.proxy_worker = type { i32 }
define i32 @proxy_worker_recv_cb(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 %struct.proxy_worker*
%7 = call i32 @proxy_worker_recv(%struct.proxy_worker* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.proxy_worker = type { i32 }
define i32 @proxy_worker_recv_cb(i8* %0, i8* nocapture readnone %1) {
%3 = bitcast i8* %0 to %struct.proxy_worker*
%4 = tail call i32 @proxy_worker_recv(%struct.proxy_worker* %3)
ret i32 %4
}