xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct cbmem_entry {
  int dummy;
};

/* Variables and functions */
const struct cbmem_entry *cbmem_entry_find(uint32_t id) { return NULL; }


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

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

LLVM IR (-O0):
%struct.cbmem_entry = type { i32 }
define %struct.cbmem_entry* @cbmem_entry_find(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret %struct.cbmem_entry* null
}

LLVM IR (-O2):
%struct.cbmem_entry = type { i32 }
define noalias %struct.cbmem_entry* @cbmem_entry_find(i32 %0) {
ret %struct.cbmem_entry* null
}
/* Type definitions */
struct onak_dbctx {
  int dummy;
};

/* Variables and functions */
bool keyring_starttrans(struct onak_dbctx *dbctx) { return true; }


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

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

LLVM IR (-O0):
%struct.onak_dbctx = type { i32 }
define i32 @keyring_starttrans(%struct.onak_dbctx* %0) {
%2 = alloca %struct.onak_dbctx*
store %struct.onak_dbctx* %0, %struct.onak_dbctx** %2
ret i32 1
}

LLVM IR (-O2):
%struct.onak_dbctx = type { i32 }
define i32 @keyring_starttrans(%struct.onak_dbctx* nocapture readnone %0) {
ret i32 1
}
int gen_cin(int cin) {
  int r = ((cin & 1) ? (1 << 29) : 0);
  return r;
}


x86 assembly (clang, -O0):
<gen_cin>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x1,%edx
xor    %eax,%eax
mov    $0x20000000,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_cin>:
mov    %edi,%eax
and    $0x1,%eax
shl    $0x1d,%eax
ret

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

LLVM IR (-O2):
define i32 @gen_cin(i32 %0) {
%2 = shl i32 %0, 29
%3 = and i32 %2, 536870912
ret i32 %3
}
float test_sfhi(short x) { return (float)x; }


x86 assembly (clang, -O0):
<test_sfhi>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
cvtsi2ss %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_sfhi>:
cvtsi2ss %edi,%xmm0
ret

LLVM IR (-O0):
define float @test_sfhi(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sitofp i16 %3 to float
ret float %4
}

LLVM IR (-O2):
define float @test_sfhi(i16 signext %0) {
%2 = sitofp i16 %0 to float
ret float %2
}
int delete_buffer(char **buffer) {
  int i = 0;
  for (i = 0; i < 200; i++) {
    free(buffer[i]);
  }
  free(buffer);
  return 0;
}


x86 assembly (clang, -O0):
<delete_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xc8,-0xc(%rbp)
jge    1156 <delete_buffer+0x46>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <delete_buffer+0x1a>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delete_buffer>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    $0xc8,%rbx
jne    1120 <delete_buffer+0x10>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @delete_buffer(i8** nocapture %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 0, %1 ], [ %6, %2 ]
%4 = getelementptr inbounds i8*, i8** %0, i64 %3
%5 = load i8*, i8** %4
tail call void @free(i8* %5)
%6 = add nuw nsw i64 %3, 1
%7 = icmp eq i64 %6, 200
br i1 %7, label %8, label %2
8: ; preds = %2
%9 = bitcast i8** %0 to i8*
tail call void @free(i8* %9)
ret i32 0
}
void BN_BLINDING_set_flags(void) {}


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

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

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

LLVM IR (-O2):
define void @BN_BLINDING_set_flags() {
ret void
}
double f2(double y) { return (y + (-0.0)) + (-0.0); }


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @f2(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double %3, -0.000000e+00
%5 = fadd double %4, -0.000000e+00
ret double %5
}

LLVM IR (-O2):
define double @f2(double returned %0) {
ret double %0
}
/* Type definitions */
typedef int x;
typedef int uint32_t;

/* Variables and functions */
uint32_t swap_uint32(uint32_t x) {
  return ((((x)&0xff000000) >> 24) | (((x)&0x00ff0000) >> 8) |
          (((x)&0x0000ff00) << 8) | (((x)&0x000000ff) << 24));
}


x86 assembly (clang, -O0):
<swap_uint32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    -0x4(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_uint32>:
mov    %edi,%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @swap_uint32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -16777216
%5 = lshr i32 %4, 24
%6 = load i32, i32* %2
%7 = and i32 %6, 16711680
%8 = ashr i32 %7, 8
%9 = or i32 %5, %8
%10 = load i32, i32* %2
%11 = and i32 %10, 65280
%12 = shl i32 %11, 8
%13 = or i32 %9, %12
%14 = load i32, i32* %2
%15 = and i32 %14, 255
%16 = shl i32 %15, 24
%17 = or i32 %13, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @swap_uint32(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ SEC_HYPERVISOR_CALL_DriverIRQHandler();
__attribute__((weak)) void SEC_HYPERVISOR_CALL_IRQHandler(void) {
  SEC_HYPERVISOR_CALL_DriverIRQHandler();
}


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

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

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

LLVM IR (-O2):
define weak void @SEC_HYPERVISOR_CALL_IRQHandler() {
%1 = tail call i32 (...) @SEC_HYPERVISOR_CALL_DriverIRQHandler()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ generate_stellar_system();
int /*<<< orphan*/ init();
int /*<<< orphan*/ stderr;
int main() {
  fprintf(stderr, "DEBUG-00\n");
  init();
  fprintf(stderr, "DEBUG-01\n");
  generate_stellar_system();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xeb1(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1050 <init@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <generate_stellar_system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ea8(%rip),%rbx
mov    (%rbx),%edi
lea    0xebf(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1050 <init@plt>
mov    (%rbx),%edi
lea    0xeb4(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <generate_stellar_system@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [10 x i8] c"DEBUG-00\0A\00"
@.str.1 = [10 x i8] c"DEBUG-01\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @stderr
%3 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @init()
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (...) @generate_stellar_system()
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [10 x i8] c"DEBUG-00\0A\00"
@.str.1 = [10 x i8] c"DEBUG-01\0A\00"
define i32 @main() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @init()
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 (...) @generate_stellar_system()
ret i32 0
}
int have_thin_subvol(struct mosaic *m, const char *name, int flags) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%struct.mosaic = type opaque
define i32 @have_thin_subvol(%struct.mosaic* nocapture readnone %0, i8* nocapture readnone %1, i32 %2) {
ret i32 0
}
unsigned short C_Utils_max_ushort(const unsigned short item1,
                                  const unsigned short item2) {
  return item1 > item2 ? item1 : item2;
}


x86 assembly (clang, -O0):
<C_Utils_max_ushort>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movzwl -0x2(%rbp),%eax
movzwl -0x4(%rbp),%ecx
cmp    %ecx,%eax
jle    112e <C_Utils_max_ushort+0x2e>
movzwl -0x2(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1135 <C_Utils_max_ushort+0x35>
movzwl -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<C_Utils_max_ushort>:
mov    %esi,%eax
cmp    %ax,%di
cmova  %edi,%eax
ret

LLVM IR (-O0):
define zeroext i16 @C_Utils_max_ushort(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = load i16, i16* %4
%8 = zext i16 %7 to i32
%9 = icmp sgt i32 %6, %8
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i16, i16* %3
%12 = zext i16 %11 to i32
br label %16
13: ; preds = %2
%14 = load i16, i16* %4
%15 = zext i16 %14 to i32
br label %16
16: ; preds = %13, %10
%17 = phi i32 [ %12, %10 ], [ %15, %13 ]
%18 = trunc i32 %17 to i16
ret i16 %18
}

LLVM IR (-O2):
define zeroext i16 @C_Utils_max_ushort(i16 zeroext %0, i16 zeroext %1) {
%3 = icmp ugt i16 %0, %1
%4 = select i1 %3, i16 %0, i16 %1
ret i16 %4
}
int ubi_debugfs_init_dev(struct ubi_device *ubi) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.ubi_device = type opaque
define i32 @ubi_debugfs_init_dev(%struct.ubi_device* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int judgeCircle(char *);
char *whenULR_ShouldReturnFalse() {
  int result = judgeCircle("UL");
  do {
    if (!(1 != result))
      return "When moves are UP-LEFT-RIGHT, the result should be 0";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<whenULR_ShouldReturnFalse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <judgeCircle@plt>
mov    %eax,-0xc(%rbp)
mov    $0x1,%eax
cmp    -0xc(%rbp),%eax
jne    1145 <whenULR_ShouldReturnFalse+0x35>
lea    0xec7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1152 <whenULR_ShouldReturnFalse+0x42>
jmp    114a <whenULR_ShouldReturnFalse+0x3a>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<whenULR_ShouldReturnFalse>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <judgeCircle@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
lea    0xeda(%rip),%rax
cmove  %rax,%rcx
mov    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"UL\00"
@.str.1 = [53 x i8] c"When moves are UP-LEFT-RIGHT, the result should be 0\00"
define i8* @whenULR_ShouldReturnFalse() {
%1 = alloca i8*
%2 = alloca i32
%3 = call i32 @judgeCircle(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %3, i32* %2
br label %4
4: ; preds = %0
%5 = load i32, i32* %2
%6 = icmp ne i32 1, %5
br i1 %6, label %8, label %7
7: ; preds = %4
store i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %10
8: ; preds = %4
br label %9
9: ; preds = %8
store i8* null, i8** %1
br label %10
10: ; preds = %9, %7
%11 = load i8*, i8** %1
ret i8* %11
}

LLVM IR (-O2):
@.str = [3 x i8] c"UL\00"
@.str.1 = [53 x i8] c"When moves are UP-LEFT-RIGHT, the result should be 0\00"
define i8* @whenULR_ShouldReturnFalse() {
%1 = tail call i32 @judgeCircle(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 1
%3 = select i1 %2, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), i8* null
ret i8* %3
}
void reb_integrator_ias15_part1(struct reb_simulation *r) {}


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

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

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

LLVM IR (-O2):
%struct.reb_simulation = type opaque
define void @reb_integrator_ias15_part1(%struct.reb_simulation* nocapture %0) {
ret void
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  long quot;
  long rem;
};
typedef TYPE_1__ ldiv_t;

/* Variables and functions */
ldiv_t ldiv(long int n, long int d) {
  ldiv_t retval;
  retval.quot = n / d;
  retval.rem = n % d;
  return retval;
}


x86 assembly (clang, -O0):
<ldiv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
cqto
idiv   %rcx
mov    %rdx,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldiv>:
mov    %rdi,%rax
mov    %rdi,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     1115 <ldiv+0x15>
cqto
idiv   %rsi
ret
xor    %edx,%edx
div    %esi
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64, i64 }
define { i64, i64 } @ldiv(i64 %0, i64 %1) {
%3 = alloca %struct.TYPE_3__
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%6 = load i64, i64* %4
%7 = load i64, i64* %5
%8 = sdiv i64 %6, %7
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
store i64 %8, i64* %9
%10 = load i64, i64* %4
%11 = load i64, i64* %5
%12 = srem i64 %10, %11
%13 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 1
store i64 %12, i64* %13
%14 = bitcast %struct.TYPE_3__* %3 to { i64, i64 }*
%15 = load { i64, i64 }, { i64, i64 }* %14
ret { i64, i64 } %15
}

LLVM IR (-O2):
define { i64, i64 } @ldiv(i64 %0, i64 %1) {
%3 = sdiv i64 %0, %1
%4 = srem i64 %0, %1
%5 = insertvalue { i64, i64 } poison, i64 %3, 0
%6 = insertvalue { i64, i64 } %5, i64 %4, 1
ret { i64, i64 } %6
}
/* Variables and functions */
void *malloc(unsigned int);
int my_malloc(unsigned int size, void **b) {
  *b = malloc(size);
  if (*b)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<my_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     114b <my_malloc+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1152 <my_malloc+0x42>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_malloc>:
push   %rbx
mov    %rsi,%rbx
call   1030 <malloc@plt>
mov    %rax,(%rbx)
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @my_malloc(i32 %0, i8** nocapture writeonly %1) {
%3 = tail call i8* @malloc(i32 %0)
store i8* %3, i8** %1
%4 = icmp ne i8* %3, null
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int rand();
unsigned char mk_rnd_u4(void) { return (rand() & 0xf); }


x86 assembly (clang, -O0):
<mk_rnd_u4>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
and    $0xf,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mk_rnd_u4>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
and    $0xf,%al
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i8 @mk_rnd_u4() {
%1 = call i32 (...) @rand()
%2 = and i32 %1, 15
%3 = trunc i32 %2 to i8
ret i8 %3
}

LLVM IR (-O2):
define zeroext i8 @mk_rnd_u4() {
%1 = tail call i32 (...) @rand()
%2 = trunc i32 %1 to i8
%3 = and i8 %2, 15
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *argv0) {
  fprintf(stderr,
          "Usage: %s [-c count] [-d] [-g goodness] -h hostname [-i interval]\n"
          "\t[-l] [-p port] [-r] [-s] \n",
          argv0);
}


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

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [94 x i8] c"Usage: %s [-c count] [-d] [-g goodness] -h hostname [-i interval]\0A\09[-l] [-p port] [-r] [-s] \0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [94 x i8] c"Usage: %s [-c count] [-d] [-g goodness] -h hostname [-i interval]\0A\09[-l] [-p port] [-r] [-s] \0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
scalar_t__ waitpid(int, int *, int /*<<< orphan*/);
void childhandler(int signum) {
  int status;
  while (waitpid(-1, &status, WNOHANG) > 0)
    ;
}


x86 assembly (clang, -O0):
<childhandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
lea    -0x8(%rbp),%rsi
call   1030 <waitpid@plt>
cmp    $0x0,%rax
jle    1141 <childhandler+0x31>
jmp    111b <childhandler+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<childhandler>:
push   %r14
push   %rbx
push   %rax
mov    0x2ecd(%rip),%r14
lea    0x4(%rsp),%rbx
mov    (%r14),%edx
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1030 <waitpid@plt>
test   %rax,%rax
jg     1120 <childhandler+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
define void @childhandler(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %8, %1
%5 = load i32, i32* @WNOHANG
%6 = call i64 @waitpid(i32 -1, i32* %3, i32 %5)
%7 = icmp sgt i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %4
br label %4
9: ; preds = %4
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
define void @childhandler(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
br label %4
4: ; preds = %4, %1
%5 = load i32, i32* @WNOHANG
%6 = call i64 @waitpid(i32 -1, i32* %2, i32 %5)
%7 = icmp sgt i64 %6, 0
br i1 %7, label %4, label %8
8: ; preds = %4
ret void
}
int compare_int_descending(const void *ap, const void *bp) {
  int a = *(int *)ap;
  int b = *(int *)bp;
  if (a < b) {
    return 1;
  } else if (a > b) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<compare_int_descending>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1136 <compare_int_descending+0x36>
movl   $0x1,-0x4(%rbp)
jmp    115a <compare_int_descending+0x5a>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    114e <compare_int_descending+0x4e>
movl   $0xffffffff,-0x4(%rbp)
jmp    115a <compare_int_descending+0x5a>
jmp    1153 <compare_int_descending+0x53>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_int_descending>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
xor    %edx,%edx
cmp    %ecx,%eax
setg   %dl
neg    %edx
cmp    %ecx,%eax
mov    $0x1,%eax
cmovge %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @compare_int_descending(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp slt i32 %4, %6
%8 = icmp sgt i32 %4, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
void freeDoublePointer(double **P, unsigned int ROWS) {
  unsigned int i;
  for (i = 0; i < ROWS; i++)
    free(P[i]);
  free(P);
}


x86 assembly (clang, -O0):
<freeDoublePointer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1150 <freeDoublePointer+0x40>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <freeDoublePointer+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeDoublePointer>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
je     1142 <freeDoublePointer+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <freeDoublePointer+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

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


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

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

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

LLVM IR (-O2):
define void @net_exit() {
ret void
}
double dd_quick_two_diff(double a, double b, double *err) {
  double s = a - b;
  *err = (a - s) - b;
  return s;
}


x86 assembly (clang, -O0):
<dd_quick_two_diff>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dd_quick_two_diff>:
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
subsd  %xmm2,%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rdi)
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @dd_quick_two_diff(double %0, double %1, double* %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double*
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double* %2, double** %6
%8 = load double, double* %4
%9 = load double, double* %5
%10 = fsub double %8, %9
store double %10, double* %7
%11 = load double, double* %4
%12 = load double, double* %7
%13 = fsub double %11, %12
%14 = load double, double* %5
%15 = fsub double %13, %14
%16 = load double*, double** %6
store double %15, double* %16
%17 = load double, double* %7
ret double %17
}

LLVM IR (-O2):
define double @dd_quick_two_diff(double %0, double %1, double* nocapture writeonly %2) {
%4 = fsub double %0, %1
%5 = fsub double %0, %4
%6 = fsub double %5, %1
store double %6, double* %2
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ _xsrand48();
void xsrand(void) { _xsrand48(); }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ print_order(struct node *, int);
void lvl_order_trav(struct node *root, int height) {
  int i;
  for (i = 0; i <= height; i++) {
    print_order(root, i);
  }
  return;
}


x86 assembly (clang, -O0):
<lvl_order_trav>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     114c <lvl_order_trav+0x3c>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <print_order@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <lvl_order_trav+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lvl_order_trav>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
js     1141 <lvl_order_trav+0x31>
mov    %esi,%ebx
mov    %rdi,%r14
add    $0x1,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <print_order@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1130 <lvl_order_trav+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.node = type { i32 }
define void @lvl_order_trav(%struct.node* %0, i32 %1) {
%3 = alloca %struct.node*
%4 = alloca i32
%5 = alloca i32
store %struct.node* %0, %struct.node** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %14, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load %struct.node*, %struct.node** %3
%12 = load i32, i32* %5
%13 = call i32 @print_order(%struct.node* %11, i32 %12)
br label %14
14: ; preds = %10
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
br label %6
17: ; preds = %6
ret void
}

LLVM IR (-O2):
%struct.node = type { i32 }
define void @lvl_order_trav(%struct.node* %0, i32 %1) {
%3 = icmp slt i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ 0, %2 ]
%6 = tail call i32 @print_order(%struct.node* %0, i32 %5)
%7 = add nuw i32 %5, 1
%8 = icmp eq i32 %5, %1
br i1 %8, label %9, label %4
9: ; preds = %4, %2
ret void
}
/* Type definitions */
struct b_tonegen {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ setMIDIDrawBar(struct b_tonegen *, int, unsigned char);
void setDrawbar13(void *d, unsigned char v) {
  setMIDIDrawBar((struct b_tonegen *)d, 13, v);
}


x86 assembly (clang, -O0):
<setDrawbar13>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xd,%esi
movzbl -0x9(%rbp),%edx
call   1030 <setMIDIDrawBar@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.b_tonegen = type { i32 }
define void @setDrawbar13(i8* %0, i8 zeroext %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.b_tonegen*
%7 = load i8, i8* %4
%8 = call i32 @setMIDIDrawBar(%struct.b_tonegen* %6, i32 13, i8 zeroext %7)
ret void
}

LLVM IR (-O2):
%struct.b_tonegen = type { i32 }
define void @setDrawbar13(i8* %0, i8 zeroext %1) {
%3 = bitcast i8* %0 to %struct.b_tonegen*
%4 = tail call i32 @setMIDIDrawBar(%struct.b_tonegen* %3, i32 13, i8 zeroext %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debugMsg(char *);
int fire(int, char **);
int main(int argc, char *argv[]) {
  debugMsg("main() ...");
  return fire(argc, argv);
}


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    0xec3(%rip),%rdi
call   1030 <debugMsg@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <fire@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xed1(%rip),%rdi
call   1030 <debugMsg@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fire@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"main() ...\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 @debugMsg(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i32 @fire(i32 %7, i8** %8)
ret i32 %9
}

LLVM IR (-O2):
@.str = [11 x i8] c"main() ...\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @debugMsg(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @fire(i32 %0, i8** %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void atexit1(void) { printf("atexit1 executed\n"); }


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

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

LLVM IR (-O0):
@.str = [18 x i8] c"atexit1 executed\0A\00"
define void @atexit1() {
%1 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [17 x i8] c"atexit1 executed\00"
define void @atexit1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char EOF;
char getchar();
limpiarbufferchar(char c) {
  while ((c = getchar()) != '\n' && c != EOF)
    ;
}


x86 assembly (clang, -O0):
<limpiarbufferchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x6(%rbp)
je     114f <limpiarbufferchar+0x3f>
movsbl -0x5(%rbp),%eax
mov    0x2ea4(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
test   $0x1,%al
jne    115f <limpiarbufferchar+0x4f>
jmp    1164 <limpiarbufferchar+0x54>
jmp    111e <limpiarbufferchar+0xe>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<limpiarbufferchar>:
push   %rbx
mov    0x2ed0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
je     112f <limpiarbufferchar+0x1f>
cmp    (%rbx),%al
jne    1120 <limpiarbufferchar+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
@EOF = global i8 0
define i32 @limpiarbufferchar(i8 signext %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call signext i8 (...) @getchar()
%4 = icmp ne i8 %3, 10
%5 = load i8, i8* @EOF
%6 = icmp ne i8 %3, %5
%7 = select i1 %4, i1 %6, i1 false
br i1 %7, label %2, label %8
8: ; preds = %2
ret i32 undef
}
long __ashrsi3(long a, int b) { return a >> b; }


x86 assembly (clang, -O0):
<__ashrsi3>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sar    %cl,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ashrsi3>:
mov    %esi,%ecx
mov    %rdi,%rax
sar    %cl,%rax
ret

LLVM IR (-O0):
define i64 @__ashrsi3(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i32, i32* %4
%7 = zext i32 %6 to i64
%8 = ashr i64 %5, %7
ret i64 %8
}

LLVM IR (-O2):
define i64 @__ashrsi3(i64 %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = ashr i64 %0, %3
ret i64 %4
}
int test_imm_CEint64_lowword_mem(long long *val) {
  return ((*val) & (0xCE << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_CEint64_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, 206
%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_CEint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 206
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
rename(old, new) char *old;
char *new;
{
  link(old, new);
  unlink(old);
}


x86 assembly (clang, -O0):
<rename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <link@plt>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <unlink@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rename>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <link@plt>
mov    %rbx,%rdi
xor    %eax,%eax
pop    %rbx
jmp    1030 <unlink@plt>

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

LLVM IR (-O2):
define i32 @rename(i8* %0, i8* %1) {
%3 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @link to i32 (i8*, i8*, ...)*)(i8* %0, i8* %1)
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @unlink to i32 (i8*, ...)*)(i8* %0)
ret i32 undef
}
int should_split(int upperlast, int lowerlast, int upperfirst, int lowerfirst) {
  if ((upperlast && lowerlast) && (upperfirst && !lowerfirst))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<should_split>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1144 <should_split+0x44>
cmpl   $0x0,-0xc(%rbp)
je     1144 <should_split+0x44>
cmpl   $0x0,-0x10(%rbp)
je     1144 <should_split+0x44>
cmpl   $0x0,-0x14(%rbp)
jne    1144 <should_split+0x44>
movl   $0x1,-0x4(%rbp)
jmp    114b <should_split+0x4b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<should_split>:
test   %edi,%edi
setne  %dil
test   %esi,%esi
setne  %al
and    %dil,%al
test   %edx,%edx
setne  %dl
test   %ecx,%ecx
sete   %cl
and    %dl,%cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @should_split(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp ne i32 %0, 0
%6 = icmp ne i32 %1, 0
%7 = and i1 %5, %6
%8 = icmp ne i32 %2, 0
%9 = and i1 %7, %8
%10 = icmp eq i32 %3, 0
%11 = and i1 %9, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
signed int plane_bbox(void *obj, struct anon$0 *min, struct anon$0 *max) {
  return 0;
}


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

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

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

LLVM IR (-O2):
%"struct.anon$0" = type opaque
define i32 @plane_bbox(i8* nocapture readnone %0, %"struct.anon$0"* nocapture readnone %1, %"struct.anon$0"* nocapture readnone %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print(int);
int main(void) {
  print(1);
  print(2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <print@plt>
mov    $0x2,%edi
call   1030 <print@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <print@plt>
mov    $0x2,%edi
call   1030 <print@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @print(i32 1)
%2 = tail call i32 @print(i32 2)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ srec_set_hex4(int /*<<< orphan*/ *, unsigned int);
void srec_set_hex8(FILE *fp, unsigned val) {
  srec_set_hex4(fp, (val >> 4) & 0x0f);
  srec_set_hex4(fp, val & 0x0f);
}


x86 assembly (clang, -O0):
<srec_set_hex8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
shr    $0x4,%esi
and    $0xf,%esi
call   1030 <srec_set_hex4@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
and    $0xf,%esi
call   1030 <srec_set_hex4@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<srec_set_hex8>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
shr    $0x4,%esi
and    $0xf,%esi
call   1030 <srec_set_hex4@plt>
and    $0xf,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <srec_set_hex4@plt>

LLVM IR (-O0):
define void @srec_set_hex8(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 = lshr i32 %6, 4
%8 = and i32 %7, 15
%9 = call i32 @srec_set_hex4(i32* %5, i32 %8)
%10 = load i32*, i32** %3
%11 = load i32, i32* %4
%12 = and i32 %11, 15
%13 = call i32 @srec_set_hex4(i32* %10, i32 %12)
ret void
}

LLVM IR (-O2):
define void @srec_set_hex8(i32* %0, i32 %1) {
%3 = lshr i32 %1, 4
%4 = and i32 %3, 15
%5 = tail call i32 @srec_set_hex4(i32* %0, i32 %4)
%6 = and i32 %1, 15
%7 = tail call i32 @srec_set_hex4(i32* %0, i32 %6)
ret void
}
/* Variables and functions */
int env_len(char *const envp[]) {
  int num_env = -1;
  while (envp[++num_env] != NULL)
    ;
  return num_env;
}


x86 assembly (clang, -O0):
<env_len>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     112f <env_len+0x2f>
jmp    110f <env_len+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<env_len>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpq   $0x0,(%rdi)
lea    0x8(%rdi),%rdi
jne    1110 <env_len+0x10>
ret

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

LLVM IR (-O2):
define i32 @env_len(i8** nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %4, %2 ], [ -1, %1 ]
%4 = add nsw i64 %3, 1
%5 = getelementptr inbounds i8*, i8** %0, i64 %4
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %4 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void fault_test_by_div0(void) {
  volatile int *SCB_CCR = (volatile int *)0xE000ED14;
  int x, y, z;
  *SCB_CCR |= (1 << 4);
  x = 10;
  y = 0;
  z = x / y;
  printf("z:%d\n", z);
}


x86 assembly (clang, -O0):
<fault_test_by_div0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0xe000ed14,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
or     $0x10,%ecx
mov    %ecx,(%rax)
movl   $0xa,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fault_test_by_div0>:
mov    $0xe000ed14,%eax
orl    $0x10,(%rax)
lea    0xee1(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"z:%d\0A\00"
define void @fault_test_by_div0() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32* inttoptr (i64 3758157076 to i32*), i32** %1
%5 = load i32*, i32** %1
%6 = load volatile i32, i32* %5
%7 = or i32 %6, 16
store volatile i32 %7, i32* %5
store i32 10, i32* %2
store i32 0, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = sdiv i32 %8, %9
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %11)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"z:%d\0A\00"
define void @fault_test_by_div0() {
%1 = load volatile i32, i32* inttoptr (i64 3758157076 to i32*)
%2 = or i32 %1, 16
store volatile i32 %2, i32* inttoptr (i64 3758157076 to i32*)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 poison)
ret void
}