xunge/DecIR huggingface dataset:
/* Type definitions */
struct lineFile {
  int dummy;
};
struct gapCalc {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cloneString(char *);
struct gapCalc *gapCalcRead(struct lineFile *);
int /*<<< orphan*/ lineFileClose(struct lineFile **);
struct lineFile *lineFileOnString(char *, int, int /*<<< orphan*/);
struct gapCalc *gapCalcFromString(char *s) {
  struct lineFile *lf = lineFileOnString("string", 1, cloneString(s));
  struct gapCalc *gapCalc = gapCalcRead(lf);
  lineFileClose(&lf);
  return gapCalc;
}


x86 assembly (clang, -O0):
<gapCalcFromString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <cloneString@plt>
mov    %eax,%edx
lea    0xea2(%rip),%rdi
mov    $0x1,%esi
call   1040 <lineFileOnString@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <gapCalcRead@plt>
mov    %rax,-0x18(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <lineFileClose@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gapCalcFromString>:
push   %rbx
sub    $0x10,%rsp
call   1050 <cloneString@plt>
lea    0xeaf(%rip),%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1040 <lineFileOnString@plt>
mov    %rax,0x8(%rsp)
mov    %rax,%rdi
call   1060 <gapCalcRead@plt>
mov    %rax,%rbx
lea    0x8(%rsp),%rdi
call   1030 <lineFileClose@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.gapCalc = type { i32 }
%struct.lineFile = type { i32 }
@.str = [7 x i8] c"string\00"
define %struct.gapCalc* @gapCalcFromString(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.lineFile*
%4 = alloca %struct.gapCalc*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @cloneString(i8* %5)
%7 = call %struct.lineFile* @lineFileOnString(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 1, i32 %6)
store %struct.lineFile* %7, %struct.lineFile** %3
%8 = load %struct.lineFile*, %struct.lineFile** %3
%9 = call %struct.gapCalc* @gapCalcRead(%struct.lineFile* %8)
store %struct.gapCalc* %9, %struct.gapCalc** %4
%10 = call i32 @lineFileClose(%struct.lineFile** %3)
%11 = load %struct.gapCalc*, %struct.gapCalc** %4
ret %struct.gapCalc* %11
}

LLVM IR (-O2):
%struct.gapCalc = type { i32 }
%struct.lineFile = type { i32 }
@.str = [7 x i8] c"string\00"
define %struct.gapCalc* @gapCalcFromString(i8* %0) {
%2 = alloca %struct.lineFile*
%3 = bitcast %struct.lineFile** %2 to i8*
%4 = tail call i32 @cloneString(i8* %0)
%5 = tail call %struct.lineFile* @lineFileOnString(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 1, i32 %4)
store %struct.lineFile* %5, %struct.lineFile** %2
%6 = tail call %struct.gapCalc* @gapCalcRead(%struct.lineFile* %5)
%7 = call i32 @lineFileClose(%struct.lineFile** %2)
ret %struct.gapCalc* %6
}
int test_imm_6Cuint32_mem(unsigned int *val) {
  return ((*val) & (0x6C << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_6Cuint32_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, 108
%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_6Cuint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 108
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int checkForConfig() { return 0; }


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

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

LLVM IR (-O0):
define i32 @checkForConfig() {
ret i32 0
}

LLVM IR (-O2):
define i32 @checkForConfig() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cause_segfault();
void cause_calamity() { cause_segfault(); }


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

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

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

LLVM IR (-O2):
define void @cause_calamity() {
%1 = tail call i32 (...) @cause_segfault()
ret void
}
double SIM_resultbus_cap(void) {
  double Cline, reg_height;
  reg_height = (16) * ((16.0 * 0.0875) + (6.0 * 0.0875) * 3 * (4));
  Cline = (((4.4e-15 * ((172.2157) * (0.0875 * 0.0875))) / 16) * 5.2277) *
          (reg_height + 0.5 * (4) * 3200 * 0.0875);
  return Cline;
}


x86 assembly (clang, -O0):
<SIM_resultbus_cap>:
push   %rbp
mov    %rsp,%rbp
movsd  0xf04(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeef(%rip),%xmm1
addsd  -0x10(%rbp),%xmm1
movsd  0xeda(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<SIM_resultbus_cap>:
movsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @SIM_resultbus_cap() {
%1 = alloca double
%2 = alloca double
store double 0x405ECCCCCCCCCCCC, double* %2
%3 = load double, double* %2
%4 = fadd double %3, 5.600000e+02
%5 = fmul double 0x3CE112CF5FD1CE25, %4
store double %5, double* %1
%6 = load double, double* %1
ret double %6
}

LLVM IR (-O2):
define double @SIM_resultbus_cap() {
ret double 0x3D76C84CB70F28AD
}
/* Variables and functions */
int /*<<< orphan*/ EA_AL_8();
int /*<<< orphan*/ m68ki_write_8(int /*<<< orphan*/, int /*<<< orphan*/);
void m68k_op_sf_8_al(void) { m68ki_write_8(EA_AL_8(), 0); }


x86 assembly (clang, -O0):
<m68k_op_sf_8_al>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <EA_AL_8@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1040 <m68ki_write_8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<m68k_op_sf_8_al>:
push   %rax
xor    %eax,%eax
call   1030 <EA_AL_8@plt>
mov    %eax,%edi
xor    %esi,%esi
pop    %rax
jmp    1040 <m68ki_write_8@plt>

LLVM IR (-O0):
define void @m68k_op_sf_8_al() {
%1 = call i32 (...) @EA_AL_8()
%2 = call i32 @m68ki_write_8(i32 %1, i32 0)
ret void
}

LLVM IR (-O2):
define void @m68k_op_sf_8_al() {
%1 = tail call i32 (...) @EA_AL_8()
%2 = tail call i32 @m68ki_write_8(i32 %1, i32 0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
struct passwd {
  int dummy;
};
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
int /*<<< orphan*/ compat_getpwuid_r(int /*<<< orphan*/, struct passwd *,
                                     char *, int, struct passwd **);
struct passwd *compat_getpwuid(uid_t uid) {
  static char buffer[1024];
  static struct passwd resultbuf;
  struct passwd *result;
  compat_getpwuid_r(uid, &resultbuf, buffer, sizeof(buffer), &result);
  return result;
}


x86 assembly (clang, -O0):
<compat_getpwuid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0x331b(%rip),%rsi
lea    0x2f14(%rip),%rdx
mov    $0x400,%ecx
lea    -0x10(%rbp),%r8
call   1030 <compat_getpwuid_r@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compat_getpwuid>:
push   %rax
lea    0x3328(%rip),%rsi
lea    0x2f21(%rip),%rdx
mov    %rsp,%r8
mov    $0x400,%ecx
call   1030 <compat_getpwuid_r@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.passwd = type { i32 }
@compat_getpwuid.buffer = internal global [1024 x i8] zeroinitializer
@compat_getpwuid.resultbuf = internal global %struct.passwd zeroinitializer
define %struct.passwd* @compat_getpwuid(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.passwd*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @compat_getpwuid_r(i32 %4, %struct.passwd* @compat_getpwuid.resultbuf, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @compat_getpwuid.buffer, i64 0, i64 0), i32 1024, %struct.passwd** %3)
%6 = load %struct.passwd*, %struct.passwd** %3
ret %struct.passwd* %6
}

LLVM IR (-O2):
%struct.passwd = type { i32 }
@compat_getpwuid.buffer = internal global [1024 x i8] zeroinitializer
@compat_getpwuid.resultbuf = internal global %struct.passwd zeroinitializer
define %struct.passwd* @compat_getpwuid(i32 %0) {
%2 = alloca %struct.passwd*
%3 = bitcast %struct.passwd** %2 to i8*
%4 = call i32 @compat_getpwuid_r(i32 %0, %struct.passwd* @compat_getpwuid.resultbuf, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @compat_getpwuid.buffer, i64 0, i64 0), i32 1024, %struct.passwd** %2)
%5 = load %struct.passwd*, %struct.passwd** %2
ret %struct.passwd* %5
}
void gsc_fclose() {}


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

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

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

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

/* Variables and functions */
uint8_t fast_mod31_32(unsigned a) {
  unsigned r = a & 0x7fff;
  r += (a >> 15);
  r = (r >> 10) + (r & 0x3ff);
  r = (r >> 5) + (r & 0x1f);
  return r;
}


x86 assembly (clang, -O0):
<fast_mod31_32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7fff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0xf,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shr    $0xa,%eax
mov    -0x8(%rbp),%ecx
and    $0x3ff,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x5,%eax
mov    -0x8(%rbp),%ecx
and    $0x1f,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fast_mod31_32>:
mov    %edi,%eax
and    $0x7fff,%eax
shr    $0xf,%edi
add    %edi,%eax
mov    %eax,%ecx
shr    $0xa,%ecx
and    $0x3ff,%eax
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x5,%ecx
and    $0x1f,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @fast_mod31_32(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 32767
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = lshr i32 %6, 15
%8 = load i32, i32* %3
%9 = add i32 %8, %7
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = lshr i32 %10, 10
%12 = load i32, i32* %3
%13 = and i32 %12, 1023
%14 = add i32 %11, %13
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = lshr i32 %15, 5
%17 = load i32, i32* %3
%18 = and i32 %17, 31
%19 = add i32 %16, %18
store i32 %19, i32* %3
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @fast_mod31_32(i32 %0) {
%2 = and i32 %0, 32767
%3 = lshr i32 %0, 15
%4 = add nuw nsw i32 %2, %3
%5 = lshr i32 %4, 10
%6 = and i32 %4, 1023
%7 = add nuw nsw i32 %5, %6
%8 = lshr i32 %7, 5
%9 = and i32 %7, 31
%10 = add nuw nsw i32 %8, %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void detect(void) { printf("正在检测外观是否破损...\n"); }


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

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

LLVM IR (-O0):
@.str = [35 x i8] c"\E6\AD\A3\E5\9C\A8\E6\A3\80\E6\B5\8B\E5\A4\96\E8\A7\82\E6\98\AF\E5\90\A6\E7\A0\B4\E6\8D\9F...\0A\00"
define void @detect() {
%1 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [34 x i8] c"\E6\AD\A3\E5\9C\A8\E6\A3\80\E6\B5\8B\E5\A4\96\E8\A7\82\E6\98\AF\E5\90\A6\E7\A0\B4\E6\8D\9F...\00"
define void @detect() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
ret void
}
int do_046() { return 46; }


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

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

LLVM IR (-O0):
define i32 @do_046() {
ret i32 46
}

LLVM IR (-O2):
define i32 @do_046() {
ret i32 46
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  printf("sizeof(long):%u\n", sizeof(long));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [17 x i8] c"sizeof(long):%u\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 8)
ret i32 0
}
int test_imm_52uint8_mem(unsigned char *val) {
  return ((*val) & (-0x52 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_52uint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, -82
%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_52uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -82
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ ft_memset(char *, int, int);
void ft_arrayset2d(char *array[], int x, int y) {
  int i;
  i = -1;
  while (++i < y)
    ft_memset(array[i], (int)'.', x);
}


x86 assembly (clang, -O0):
<ft_arrayset2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmp    -0x10(%rbp),%eax
jge    1159 <ft_arrayset2d+0x49>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0xc(%rbp),%edx
mov    $0x2e,%esi
call   1030 <ft_memset@plt>
jmp    1129 <ft_arrayset2d+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_arrayset2d>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edx,%edx
jle    114a <ft_arrayset2d+0x3a>
mov    %esi,%r14d
mov    %rdi,%r15
mov    %edx,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15,%rbx,8),%rdi
mov    $0x2e,%esi
mov    %r14d,%edx
call   1030 <ft_memset@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1130 <ft_arrayset2d+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @ft_arrayset2d(i8** nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %14
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ 0, %5 ], [ %12, %7 ]
%9 = getelementptr inbounds i8*, i8** %0, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i32 @ft_memset(i8* %10, i32 46, i32 %1)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %6
br i1 %13, label %14, label %7
14: ; preds = %7, %3
ret void
}
double poly(double x) { return x * x * x + x - 6; }


x86 assembly (clang, -O0):
<poly>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xed3(%rip),%xmm1
subsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<poly>:
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  %xmm1,%xmm0
addsd  0xee8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @poly(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fmul double %3, %4
%6 = load double, double* %2
%7 = load double, double* %2
%8 = call double @llvm.fmuladd.f64(double %5, double %6, double %7)
%9 = fsub double %8, 6.000000e+00
ret double %9
}

LLVM IR (-O2):
define double @poly(double %0) {
%2 = fmul double %0, %0
%3 = tail call double @llvm.fmuladd.f64(double %2, double %0, double %0)
%4 = fadd double %3, -6.000000e+00
ret double %4
}
/* Type definitions */
struct gstack_n {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct gstack_n *);
void free_gstn(struct gstack_n *gsn) {
  if (!gsn)
    return;
  free(gsn);
}


x86 assembly (clang, -O0):
<free_gstn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <free_gstn+0x1c>
jmp    1135 <free_gstn+0x25>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_gstn>:
test   %rdi,%rdi
je     111a <free_gstn+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
%struct.gstack_n = type { i32 }
define void @free_gstn(%struct.gstack_n* %0) {
%2 = alloca %struct.gstack_n*
store %struct.gstack_n* %0, %struct.gstack_n** %2
%3 = load %struct.gstack_n*, %struct.gstack_n** %2
%4 = icmp ne %struct.gstack_n* %3, null
br i1 %4, label %6, label %5
5: ; preds = %1
br label %9
6: ; preds = %1
%7 = load %struct.gstack_n*, %struct.gstack_n** %2
%8 = call i32 @free(%struct.gstack_n* %7)
br label %9
9: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
%struct.gstack_n = type { i32 }
define void @free_gstn(%struct.gstack_n* %0) {
%2 = icmp eq %struct.gstack_n* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(%struct.gstack_n* %0)
br label %5
5: ; preds = %1, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int mylib_hello_world(void) {
  printf("mylib says: Hello World!");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [25 x i8] c"mylib says: Hello World!\00"
define i32 @mylib_hello_world() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int config_TOUCH(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @config_TOUCH() {
ret i32 0
}

LLVM IR (-O2):
define i32 @config_TOUCH() {
ret i32 0
}
int test_imm_B8uint8_reg(unsigned char val) {
  return ((val) & (-0xB8 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_B8uint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, -184
%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_B8uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 72
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int foo(int *p, int i) {
  int x;
  if (i > 10) {
    if (p) {
      x = *p;
      p = 0;
    }
  } else
    p = 0;
  if (p == 0)
    return x + 1;
  return i;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jle    1136 <foo+0x36>
cmpq   $0x0,-0x10(%rbp)
je     1131 <foo+0x31>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
movq   $0x0,-0x10(%rbp)
jmp    113e <foo+0x3e>
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1157 <foo+0x57>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115d <foo+0x5d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
test   %rdi,%rdi
je     110f <foo+0xf>
cmp    $0xb,%esi
jl     110f <foo+0xf>
mov    (%rdi),%eax
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32* %0, i32 %1) {
%3 = icmp slt i32 %1, 11
%4 = icmp eq i32* %0, null
%5 = or i1 %4, %3
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i32, i32* %0
%8 = add i32 %7, 1
br label %9
9: ; preds = %2, %6
%10 = phi i32 [ %8, %6 ], [ undef, %2 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ cblas_zdotu_sub(int const, void const *, int const,
                                   void const *, int const, void *);
void acc_zdotu_sub_(const int *N, const void *X, const int *incX, const void *Y,
                    const int *incY, void *dotu) {
  cblas_zdotu_sub(*N, X, *incX, Y, *incY, dotu);
}


x86 assembly (clang, -O0):
<acc_zdotu_sub_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    (%rax),%r8d
mov    -0x30(%rbp),%r9
call   1030 <cblas_zdotu_sub@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<acc_zdotu_sub_>:
mov    (%rdi),%edi
mov    (%rdx),%edx
mov    (%r8),%r8d
jmp    1030 <cblas_zdotu_sub@plt>

LLVM IR (-O0):
define void @acc_zdotu_sub_(i32* %0, i8* %1, i32* %2, i8* %3, i32* %4, i8* %5) {
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca i8*
store i32* %0, i32** %7
store i8* %1, i8** %8
store i32* %2, i32** %9
store i8* %3, i8** %10
store i32* %4, i32** %11
store i8* %5, i8** %12
%13 = load i32*, i32** %7
%14 = load i32, i32* %13
%15 = load i8*, i8** %8
%16 = load i32*, i32** %9
%17 = load i32, i32* %16
%18 = load i8*, i8** %10
%19 = load i32*, i32** %11
%20 = load i32, i32* %19
%21 = load i8*, i8** %12
%22 = call i32 @cblas_zdotu_sub(i32 %14, i8* %15, i32 %17, i8* %18, i32 %20, i8* %21)
ret void
}

LLVM IR (-O2):
define void @acc_zdotu_sub_(i32* nocapture %0, i8* %1, i32* nocapture %2, i8* %3, i32* nocapture %4, i8* %5) {
%7 = load i32, i32* %0
%8 = load i32, i32* %2
%9 = load i32, i32* %4
%10 = tail call i32 @cblas_zdotu_sub(i32 %7, i8* %1, i32 %8, i8* %3, i32 %9, i8* %5)
ret void
}
int binary(int num) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @binary(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ UAVObjLogging(int /*<<< orphan*/);
int /*<<< orphan*/ VtolPathFollowerSettingsHandle();
void VtolPathFollowerSettingsLogging() {
  UAVObjLogging(VtolPathFollowerSettingsHandle());
}


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

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

LLVM IR (-O0):
define void @VtolPathFollowerSettingsLogging() {
%1 = call i32 (...) @VtolPathFollowerSettingsHandle()
%2 = call i32 @UAVObjLogging(i32 %1)
ret void
}

LLVM IR (-O2):
define void @VtolPathFollowerSettingsLogging() {
%1 = tail call i32 (...) @VtolPathFollowerSettingsHandle()
%2 = tail call i32 @UAVObjLogging(i32 %1)
ret void
}
/* Variables and functions */
scalar_t__ memchr(char *, char, int);
char *strchr(char *, char);
char *sigar_skip_line(char *buffer, int buflen) {
  char *ptr =
      buflen ? (char *)memchr(buffer, '\n', buflen) : strchr(buffer, '\n');
  return ++ptr;
}


x86 assembly (clang, -O0):
<sigar_skip_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1153 <sigar_skip_line+0x33>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    $0xa,%esi
call   1040 <memchr@plt>
mov    %rax,-0x20(%rbp)
jmp    1165 <sigar_skip_line+0x45>
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigar_skip_line>:
push   %rax
test   %esi,%esi
je     1133 <sigar_skip_line+0x13>
mov    %esi,%edx
mov    $0xa,%esi
call   1040 <memchr@plt>
jmp    113d <sigar_skip_line+0x1d>
mov    $0xa,%esi
call   1030 <strchr@plt>
add    $0x1,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @sigar_skip_line(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i64 @memchr(i8* %0, i8 signext 10, i32 %1)
%6 = inttoptr i64 %5 to i8*
br label %9
7: ; preds = %2
%8 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 10)
br label %9
9: ; preds = %7, %4
%10 = phi i8* [ %6, %4 ], [ %8, %7 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
ret i8* %11
}
unsigned long rho_ruby_createHash() { return 0; }


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

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

LLVM IR (-O0):
define i64 @rho_ruby_createHash() {
ret i64 0
}

LLVM IR (-O2):
define i64 @rho_ruby_createHash() {
ret i64 0
}
__attribute__((always_)) void mask_and_ack_level_ioapic_irq(unsigned int irq) {}


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

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

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

LLVM IR (-O2):
define void @mask_and_ack_level_ioapic_irq(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_ioline_ref() {
  printf("NOT IMPLEMENTED:"
         "pa_ioline_ref"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [31 x i8] c"NOT IMPLEMENTED:pa_ioline_ref\0A\00"
define i32 @pa_ioline_ref() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [30 x i8] c"NOT IMPLEMENTED:pa_ioline_ref\00"
define i32 @pa_ioline_ref() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
int nftw_stub(const char *fpath, const struct stat *sb, int typeflag,
              struct FTW *ftwbuf) {
  return 0;
}


x86 assembly (clang, -O0):
<nftw_stub>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.stat = type opaque
%struct.FTW = type opaque
define i32 @nftw_stub(i8* %0, %struct.stat* %1, i32 %2, %struct.FTW* %3) {
%5 = alloca i8*
%6 = alloca %struct.stat*
%7 = alloca i32
%8 = alloca %struct.FTW*
store i8* %0, i8** %5
store %struct.stat* %1, %struct.stat** %6
store i32 %2, i32* %7
store %struct.FTW* %3, %struct.FTW** %8
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type opaque
%struct.FTW = type opaque
define i32 @nftw_stub(i8* nocapture readnone %0, %struct.stat* nocapture readnone %1, i32 %2, %struct.FTW* nocapture readnone %3) {
ret i32 0
}
int sgx_thread_setwait_untrusted_events_ocall(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @sgx_thread_setwait_untrusted_events_ocall() {
ret i32 1
}
/* Variables and functions */
scalar_t__ ft_isspace(char const);
char *skip_white_space(const char *s) {
  while (s && ft_isspace(*s))
    s++;
  return ((char *)s);
}


x86 assembly (clang, -O0):
<skip_white_space>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     1142 <skip_white_space+0x32>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <ft_isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1152 <skip_white_space+0x42>
jmp    1163 <skip_white_space+0x53>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <skip_white_space+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_white_space>:
push   %rbx
test   %rdi,%rdi
je     1134 <skip_white_space+0x24>
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nopl   (%rax)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <ft_isspace@plt>
test   %rax,%rax
jne    1120 <skip_white_space+0x10>
jmp    1136 <skip_white_space+0x26>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @skip_white_space(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i8* [ %8, %3 ], [ %0, %1 ]
%5 = load i8, i8* %4
%6 = tail call i64 @ft_isspace(i8 signext %5)
%7 = icmp eq i64 %6, 0
%8 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %7, label %9, label %3
9: ; preds = %3, %1
%10 = phi i8* [ null, %1 ], [ %4, %3 ]
ret i8* %10
}
int isPrime(int x) {
  int i, prime;
  prime = 1;
  if (x == 2)
    return prime;
  for (i = 2; i <= (x / 2 + 1); i++) {
    if (x % i == 0) {
      prime = 0;
      break;
    }
  }
  return prime;
}


x86 assembly (clang, -O0):
<isPrime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1123 <isPrime+0x23>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1180 <isPrime+0x80>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    $0x1,%ecx
cmp    %ecx,%eax
jg     117a <isPrime+0x7a>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1167 <isPrime+0x67>
movl   $0x0,-0x10(%rbp)
jmp    117a <isPrime+0x7a>
jmp    116c <isPrime+0x6c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <isPrime+0x2a>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPrime>:
mov    $0x1,%r8d
cmp    $0x3,%edi
jl     1137 <isPrime+0x37>
mov    %edi,%esi
shr    %esi
neg    %esi
mov    $0x2,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %edi,%eax
cltd
idiv   %ecx
test   %edx,%edx
je     113b <isPrime+0x3b>
lea    (%rsi,%rcx,1),%eax
add    $0x1,%eax
add    $0x1,%ecx
cmp    $0x2,%eax
jne    1120 <isPrime+0x20>
mov    %r8d,%eax
ret
xor    %r8d,%r8d
mov    %r8d,%eax
ret

LLVM IR (-O0):
define i32 @isPrime(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 1, i32* %5
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i32, i32* %5
store i32 %9, i32* %2
br label %29
10: ; preds = %1
store i32 2, i32* %4
br label %11
11: ; preds = %24, %10
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = sdiv i32 %13, 2
%15 = add nsw i32 %14, 1
%16 = icmp sle i32 %12, %15
br i1 %16, label %17, label %27
17: ; preds = %11
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = srem i32 %18, %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %17
store i32 0, i32* %5
br label %27
23: ; preds = %17
br label %24
24: ; preds = %23
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %11
27: ; preds = %22, %11
%28 = load i32, i32* %5
store i32 %28, i32* %2
br label %29
29: ; preds = %27, %8
%30 = load i32, i32* %2
ret i32 %30
}

LLVM IR (-O2):
define i32 @isPrime(i32 %0) {
%2 = icmp slt i32 %0, 3
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = lshr i32 %0, 1
%5 = add nuw nsw i32 %4, 1
br label %9
6: ; preds = %9
%7 = add nuw nsw i32 %10, 1
%8 = icmp eq i32 %10, %5
br i1 %8, label %13, label %9
9: ; preds = %3, %6
%10 = phi i32 [ %7, %6 ], [ 2, %3 ]
%11 = srem i32 %0, %10
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %9, %6, %1
%14 = phi i32 [ 1, %1 ], [ 0, %9 ], [ 1, %6 ]
ret i32 %14
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t rtp2435q_get_length(uint8_t *header) {
  return header[2] << 16 | header[3];
}


x86 assembly (clang, -O0):
<rtp2435q_get_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
shl    $0x10,%eax
mov    -0x8(%rbp),%rcx
or     0xc(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtp2435q_get_length>:
mov    0x8(%rdi),%eax
shl    $0x10,%eax
or     0xc(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @rtp2435q_get_length(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 2
%5 = load i32, i32* %4
%6 = shl i32 %5, 16
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 3
%9 = load i32, i32* %8
%10 = or i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @rtp2435q_get_length(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load i32, i32* %2
%4 = shl i32 %3, 16
%5 = getelementptr inbounds i32, i32* %0, i64 3
%6 = load i32, i32* %5
%7 = or i32 %4, %6
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ *wcscat(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
wchar_t *ISandBox_wcscat(wchar_t *s1, wchar_t *s2) { return wcscat(s1, s2); }


x86 assembly (clang, -O0):
<ISandBox_wcscat>:
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 <wcscat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ISandBox_wcscat>:
jmp    1030 <wcscat@plt>

LLVM IR (-O0):
define i32* @ISandBox_wcscat(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* @wcscat(i32* %5, i32* %6)
ret i32* %7
}

LLVM IR (-O2):
define i32* @ISandBox_wcscat(i32* %0, i32* %1) {
%3 = tail call i32* @wcscat(i32* %0, i32* %1)
ret i32* %3
}
/* Variables and functions */
unsigned int rand();
int _random(unsigned int n) {
  if (n != 0) {
    return rand() % n;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1139 <_random+0x29>
mov    $0x0,%al
call   1030 <rand@plt>
xor    %edx,%edx
divl   -0x8(%rbp)
mov    %edx,-0x4(%rbp)
jmp    1140 <_random+0x30>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_random>:
test   %edi,%edi
je     1126 <_random+0x16>
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
xor    %edx,%edx
div    %ebx
mov    %edx,%eax
pop    %rbx
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @_random(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 (...) @rand()
%5 = urem i32 %4, %0
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ %5, %3 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ eprintf(char *, size_t);
void *realloc(void *, size_t);
void *erealloc(void *vp, size_t n) {
  void *p;
  p = realloc(vp, n);
  if (p == NULL)
    eprintf("realloc of %u bytes failed:", n);
  return p;
}


x86 assembly (clang, -O0):
<erealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    115c <erealloc+0x3c>
mov    -0x10(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1030 <eprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erealloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <erealloc+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1030 <eprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [28 x i8] c"realloc of %u bytes failed:\00"
define noalias i8* @erealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @eprintf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i64 %1)
br label %7
7: ; preds = %5, %2
ret i8* %3
}
int d() {}


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

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

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

LLVM IR (-O2):
define i32 @d() {
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ double_t;

/* Variables and functions */
double hypot(double, int /*<<< orphan*/);
double __zabs(double zdreal, double_t zdimag) {
  return (hypot(zdreal, zdimag));
}


x86 assembly (clang, -O0):
<__zabs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1030 <hypot@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__zabs>:
jmp    1030 <hypot@plt>

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

LLVM IR (-O2):
define double @__zabs(double %0, i32 %1) {
%3 = tail call double @hypot(double %0, i32 %1)
ret double %3
}
/* Type definitions */
struct s_map {
  int dummy;
};

/* Variables and functions */
scalar_t__ mapAddReturnID(struct s_map *, void const *, void const *);
int mapAdd(struct s_map *map, const void *key, const void *value) {
  if (mapAddReturnID(map, key, value) < 0) {
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<mapAdd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <mapAddReturnID@plt>
cmp    $0x0,%rax
jge    114b <mapAdd+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    1152 <mapAdd+0x42>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mapAdd>:
push   %rax
call   1030 <mapAddReturnID@plt>
shr    $0x3f,%rax
xor    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.s_map = type { i32 }
define i32 @mapAdd(%struct.s_map* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.s_map*
%6 = alloca i8*
%7 = alloca i8*
store %struct.s_map* %0, %struct.s_map** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%8 = load %struct.s_map*, %struct.s_map** %5
%9 = load i8*, i8** %6
%10 = load i8*, i8** %7
%11 = call i64 @mapAddReturnID(%struct.s_map* %8, i8* %9, i8* %10)
%12 = icmp slt i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 0, i32* %4
br label %15
14: ; preds = %3
store i32 1, i32* %4
br label %15
15: ; preds = %14, %13
%16 = load i32, i32* %4
ret i32 %16
}

LLVM IR (-O2):
%struct.s_map = type { i32 }
define i32 @mapAdd(%struct.s_map* %0, i8* %1, i8* %2) {
%4 = tail call i64 @mapAddReturnID(%struct.s_map* %0, i8* %1, i8* %2)
%5 = lshr i64 %4, 63
%6 = trunc i64 %5 to i32
%7 = xor i32 %6, 1
ret i32 %7
}
/* Variables and functions */
int errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ say(char const *);
char *strerror(int);
void fatal(const char *label) {
  int err = errno;
  say("intr: ");
  say(label);
  say(": ");
  say(strerror(err));
  say("\n");
  exit(1);
}


x86 assembly (clang, -O0):
<fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
lea    0xeb1(%rip),%rdi
call   1050 <say@plt>
mov    -0x8(%rbp),%rdi
call   1050 <say@plt>
lea    0xea0(%rip),%rdi
call   1050 <say@plt>
mov    -0xc(%rbp),%edi
call   1040 <strerror@plt>
mov    %rax,%rdi
call   1050 <say@plt>
lea    0xe87(%rip),%rdi
call   1050 <say@plt>
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<fatal>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ea3(%rip),%rax
mov    (%rax),%ebp
lea    0xeba(%rip),%rdi
call   1050 <say@plt>
mov    %rbx,%rdi
call   1050 <say@plt>
lea    0xeaa(%rip),%rdi
call   1050 <say@plt>
mov    %ebp,%edi
call   1040 <strerror@plt>
mov    %rax,%rdi
call   1050 <say@plt>
lea    0xe92(%rip),%rdi
call   1050 <say@plt>
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@errno = global i32 0
@.str = [7 x i8] c"intr: \00"
@.str.1 = [3 x i8] c": \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @fatal(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i32, i32* @errno
store i32 %4, i32* %3
%5 = call i32 @say(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %2
%7 = call i32 @say(i8* %6)
%8 = call i32 @say(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* %3
%10 = call i8* @strerror(i32 %9)
%11 = call i32 @say(i8* %10)
%12 = call i32 @say(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [7 x i8] c"intr: \00"
@.str.1 = [3 x i8] c": \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @fatal(i8* %0) {
%2 = load i32, i32* @errno
%3 = tail call i32 @say(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @say(i8* %0)
%5 = tail call i32 @say(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i8* @strerror(i32 %2)
%7 = tail call i32 @say(i8* %6)
%8 = tail call i32 @say(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
}