xunge/DecIR huggingface dataset:
int fitsBits(int x, int n) {
  return !(((~x & (x >> 31)) + (x & ~(x >> 31))) >> (n + ~0));
}


x86 assembly (clang, -O0):
<fitsBits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
mov    -0x4(%rbp),%ecx
sar    $0x1f,%ecx
and    %ecx,%eax
mov    -0x4(%rbp),%ecx
mov    -0x4(%rbp),%edx
sar    $0x1f,%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%ecx
add    $0xffffffff,%ecx
sar    %cl,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fitsBits>:
mov    %edi,%eax
not    %eax
mov    %edi,%ecx
sar    $0x1f,%ecx
and    %eax,%ecx
xor    %edx,%edx
test   %edi,%edi
cmovns %edi,%edx
add    %ecx,%edx
lea    -0x1(%rsi),%ecx
sar    %cl,%edx
xor    %eax,%eax
test   %edx,%edx
sete   %al
ret

LLVM IR (-O0):
define i32 @fitsBits(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 = xor i32 %5, -1
%7 = load i32, i32* %3
%8 = ashr i32 %7, 31
%9 = and i32 %6, %8
%10 = load i32, i32* %3
%11 = load i32, i32* %3
%12 = ashr i32 %11, 31
%13 = xor i32 %12, -1
%14 = and i32 %10, %13
%15 = add nsw i32 %9, %14
%16 = load i32, i32* %4
%17 = add nsw i32 %16, -1
%18 = ashr i32 %15, %17
%19 = icmp ne i32 %18, 0
%20 = xor i1 %19, true
%21 = zext i1 %20 to i32
ret i32 %21
}

LLVM IR (-O2):
define i32 @fitsBits(i32 %0, i32 %1) {
%3 = xor i32 %0, -1
%4 = icmp slt i32 %0, 0
%5 = select i1 %4, i32 %3, i32 0
%6 = icmp sgt i32 %0, 0
%7 = select i1 %6, i32 %0, i32 0
%8 = add nsw i32 %5, %7
%9 = add nsw i32 %1, -1
%10 = ashr i32 %8, %9
%11 = icmp eq i32 %10, 0
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t binRev(uint16_t num, uint8_t length) {
  uint16_t rev_num = 0, count = length;
  while (num) {
    rev_num <<= 1;
    rev_num |= num & 0x01;
    num >>= 1;
    count--;
  }
  return rev_num << count;
}


x86 assembly (clang, -O0):
<binRev>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     114d <binRev+0x4d>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1117 <binRev+0x17>
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<binRev>:
mov    %esi,%ecx
xor    %eax,%eax
test   %edi,%edi
je     1124 <binRev+0x24>
mov    %edi,%edx
nopw   0x0(%rax,%rax,1)
mov    %edi,%esi
and    $0x1,%esi
lea    (%rsi,%rax,2),%eax
sar    %edx
add    $0xffffffff,%ecx
cmp    $0x1,%edi
mov    %edx,%edi
ja     1110 <binRev+0x10>
shl    %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @binRev(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %14, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %12, %4 ], [ %1, %2 ]
%6 = phi i32 [ %10, %4 ], [ 0, %2 ]
%7 = phi i32 [ %11, %4 ], [ %0, %2 ]
%8 = shl i32 %6, 1
%9 = and i32 %7, 1
%10 = or i32 %8, %9
%11 = ashr i32 %7, 1
%12 = add nsw i32 %5, -1
%13 = icmp ult i32 %7, 2
br i1 %13, label %14, label %4
14: ; preds = %4, %2
%15 = phi i32 [ 0, %2 ], [ %10, %4 ]
%16 = phi i32 [ %1, %2 ], [ %12, %4 ]
%17 = shl i32 %15, %16
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, char const *);
void printTimingEnd(const char *platformName, const char *routineName) {
  printf(
      "Finished timing measurement for function ' %s ' in platform ' %s '...\n",
      routineName, platformName);
}


x86 assembly (clang, -O0):
<printTimingEnd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printTimingEnd>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [71 x i8] c"Finished timing measurement for function ' %s ' in platform ' %s '...\0A\00"
define void @printTimingEnd(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i8*, i8** %3
%7 = call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [71 x i8] c"Finished timing measurement for function ' %s ' in platform ' %s '...\0A\00"
define void @printTimingEnd(i8* %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0)
ret void
}
/* Variables and functions */
int syscall(int, int);
int sched_get_priority_min(int policy) { return syscall(160, policy); }


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

x86 assembly (clang, -O2):
<sched_get_priority_min>:
mov    %edi,%esi
mov    $0xa0,%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
define i32 @sched_get_priority_min(i32 %0) {
%2 = tail call i32 @syscall(i32 160, i32 %0)
ret i32 %2
}
struct command *SET_RANGE(struct command *c) {
  return (struct command *)(((unsigned long)c) | 1UL);
}


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

x86 assembly (clang, -O2):
<SET_RANGE>:
mov    %rdi,%rax
or     $0x1,%rax
ret

LLVM IR (-O0):
%struct.command = type opaque
define %struct.command* @SET_RANGE(%struct.command* %0) {
%2 = alloca %struct.command*
store %struct.command* %0, %struct.command** %2
%3 = load %struct.command*, %struct.command** %2
%4 = ptrtoint %struct.command* %3 to i64
%5 = or i64 %4, 1
%6 = inttoptr i64 %5 to %struct.command*
ret %struct.command* %6
}

LLVM IR (-O2):
%struct.command = type opaque
define %struct.command* @SET_RANGE(%struct.command* %0) {
%2 = ptrtoint %struct.command* %0 to i64
%3 = or i64 %2, 1
%4 = inttoptr i64 %3 to %struct.command*
ret %struct.command* %4
}
int test_imm_79int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x79 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_79int64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 32
%6 = and i64 %5, 121
%7 = icmp ne i64 %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_79int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 519691042816
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int tuncompressible_filename() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @tuncompressible_filename() {
ret i32 0
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t mp2vxst_get_id(uint8_t start) { return start >> 4; }


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

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

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

LLVM IR (-O2):
define i32 @mp2vxst_get_id(i32 %0) {
%2 = ashr i32 %0, 4
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
size_t strlen(char const *);
char *xmalloc(size_t);
char *xstrdup(const char *s) {
  char *new;
  size_t len;
  assert(s != NULL);
  len = strlen(s);
  new = xmalloc(len + 1);
  memcpy(new, s, len + 1);
  return new;
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1040 <xmalloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
add    $0x1,%rdx
call   1060 <memcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1050 <assert@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%r15
mov    %r15,%rdi
call   1040 <xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1060 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i8*, i8** %2
%10 = call i64 @strlen(i8* %9)
store i64 %10, i64* %4
%11 = load i64, i64* %4
%12 = add i64 %11, 1
%13 = call i8* @xmalloc(i64 %12)
store i8* %13, i8** %3
%14 = load i8*, i8** %3
%15 = load i8*, i8** %2
%16 = load i64, i64* %4
%17 = add i64 %16, 1
%18 = call i32 @memcpy(i8* %14, i8* %15, i64 %17)
%19 = load i8*, i8** %3
ret i8* %19
}

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = add i64 %5, 1
%7 = tail call i8* @xmalloc(i64 %6)
%8 = tail call i32 @memcpy(i8* %7, i8* %0, i64 %6)
ret i8* %7
}
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
int get_useconds() {
  struct timeval tv;
  struct timezone tz;
  gettimeofday(&tv, &tz);
  return tv.tv_usec;
}


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

x86 assembly (clang, -O2):
<get_useconds>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <gettimeofday@plt>
mov    0x8(%rsp),%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
%struct.timeval = type { i32 }
%struct.timezone = type { i32 }
define i32 @get_useconds() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.timezone* %2 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%7 = load i32, i32* %6
ret i32 %7
}
/* Variables and functions */
unsigned int f16(unsigned int);
unsigned int f17(unsigned int a) { return f16(f16(a)); }


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

x86 assembly (clang, -O2):
<f17>:
push   %rax
call   1030 <f16@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <f16@plt>

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

LLVM IR (-O2):
define i32 @f17(i32 %0) {
%2 = tail call i32 @f16(i32 %0)
%3 = tail call i32 @f16(i32 %2)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ InitSD();
int /*<<< orphan*/ Nand_Init();
int /*<<< orphan*/ SD_Init();
void sdmmc_sdcard_init() {
  ;
  InitSD();
  uint32_t nand_res __attribute__((unused)) = Nand_Init();
  ;
  uint32_t sd_res __attribute__((unused)) = SD_Init();
  ;
}


x86 assembly (clang, -O0):
<sdmmc_sdcard_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <InitSD@plt>
mov    $0x0,%al
call   1040 <Nand_Init@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <SD_Init@plt>
mov    %eax,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sdmmc_sdcard_init>:
push   %rax
xor    %eax,%eax
call   1030 <InitSD@plt>
xor    %eax,%eax
call   1040 <Nand_Init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <SD_Init@plt>

LLVM IR (-O0):
define void @sdmmc_sdcard_init() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @InitSD()
%4 = call i32 (...) @Nand_Init()
store i32 %4, i32* %1
%5 = call i32 (...) @SD_Init()
store i32 %5, i32* %2
ret void
}

LLVM IR (-O2):
define void @sdmmc_sdcard_init() {
%1 = tail call i32 (...) @InitSD()
%2 = tail call i32 (...) @Nand_Init()
%3 = tail call i32 (...) @SD_Init()
ret void
}
/* Variables and functions */
int abs(int);
scalar_t__ fmod(int, int);
int trunc(float);
int third_digit(float input) {
  int digit, num = trunc(input * 1000.0);
  digit = abs((int)fmod(num, 10));
  if (digit == 3)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<third_digit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb2(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1050 <trunc@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    $0xa,%esi
call   1040 <fmod@plt>
mov    %eax,%edi
call   1030 <abs@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jne    118b <third_digit+0x5b>
movl   $0x1,-0x4(%rbp)
jmp    1192 <third_digit+0x62>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<third_digit>:
push   %rax
mulss  0xed7(%rip),%xmm0
call   1040 <trunc@plt>
mov    %eax,%edi
mov    $0xa,%esi
call   1030 <fmod@plt>
mov    %eax,%ecx
neg    %ecx
cmovs  %eax,%ecx
xor    %eax,%eax
cmp    $0x3,%ecx
sete   %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @third_digit(float %0) {
%2 = alloca i32
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
store float %0, float* %3
%6 = load float, float* %3
%7 = fpext float %6 to double
%8 = fmul double %7, 1.000000e+03
%9 = fptrunc double %8 to float
%10 = call i32 @trunc(float %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = call i64 @fmod(i32 %11, i32 10)
%13 = trunc i64 %12 to i32
%14 = call i32 @abs(i32 %13)
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 3
br i1 %16, label %17, label %18
17: ; preds = %1
store i32 1, i32* %2
br label %19
18: ; preds = %1
store i32 0, i32* %2
br label %19
19: ; preds = %18, %17
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @third_digit(float %0) {
%2 = fmul float %0, 1.000000e+03
%3 = tail call i32 @trunc(float %2)
%4 = tail call i64 @fmod(i32 %3, i32 10)
%5 = trunc i64 %4 to i32
%6 = tail call i32 @llvm.abs.i32(i32 %5, i1 true)
%7 = icmp eq i32 %6, 3
%8 = zext i1 %7 to i32
ret i32 %8
}
void counters_free(void) {}


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

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

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

LLVM IR (-O2):
define void @counters_free() {
ret void
}
/* Variables and functions */
int sys_pkey_alloc(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sys_pkey_free(int);
int kernel_has_pkeys(void) {
  int ret = sys_pkey_alloc(0, 0);
  if (ret <= 0) {
    return 0;
  }
  sys_pkey_free(ret);
  return 1;
}


x86 assembly (clang, -O0):
<kernel_has_pkeys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %esi,%esi
mov    %esi,%edi
call   1030 <sys_pkey_alloc@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     114a <kernel_has_pkeys+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    1159 <kernel_has_pkeys+0x39>
mov    -0x8(%rbp),%edi
call   1040 <sys_pkey_free@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_has_pkeys>:
push   %rbx
xor    %ebx,%ebx
xor    %edi,%edi
xor    %esi,%esi
call   1030 <sys_pkey_alloc@plt>
test   %eax,%eax
jle    113c <kernel_has_pkeys+0x1c>
mov    %eax,%edi
call   1040 <sys_pkey_free@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @kernel_has_pkeys() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @sys_pkey_alloc(i32 0, i32 0)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 0, i32* %1
br label %10
7: ; preds = %0
%8 = load i32, i32* %2
%9 = call i32 @sys_pkey_free(i32 %8)
store i32 1, i32* %1
br label %10
10: ; preds = %7, %6
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
define i32 @kernel_has_pkeys() {
%1 = tail call i32 @sys_pkey_alloc(i32 0, i32 0)
%2 = icmp slt i32 %1, 1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @sys_pkey_free(i32 %1)
br label %5
5: ; preds = %0, %3
%6 = phi i32 [ 1, %3 ], [ 0, %0 ]
ret i32 %6
}
char *getwd(char *buf) { return "./"; }


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

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

LLVM IR (-O0):
@.str = [3 x i8] c"./\00"
define i8* @getwd(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [3 x i8] c"./\00"
define i8* @getwd(i8* nocapture readnone %0) {
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
float cos(float);
float expRand(double);
float sqrt(float);
float uRand(int /*<<< orphan*/, int);
float gaussRand(float mu, float sigma) {
  float theta, rsq, x;
  theta = uRand(0, 2 * 3.14159265359);
  rsq = expRand(0.5);
  x = sqrt(rsq) * cos(theta);
  return x * sigma + mu;
}


x86 assembly (clang, -O0):
<gaussRand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
xor    %edi,%edi
mov    $0x6,%esi
call   1040 <uRand@plt>
movss  %xmm0,-0xc(%rbp)
movsd  0xe95(%rip),%xmm0
call   1030 <expRand@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
call   1060 <sqrt@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
movss  -0x4(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gaussRand>:
sub    $0x18,%rsp
movss  %xmm1,0x10(%rsp)
movss  %xmm0,0x14(%rsp)
xor    %edi,%edi
mov    $0x6,%esi
call   1040 <uRand@plt>
movss  %xmm0,0xc(%rsp)
movsd  0xe96(%rip),%xmm0
call   1030 <expRand@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     117d <gaussRand+0x3d>
sqrtss %xmm0,%xmm0
jmp    1182 <gaussRand+0x42>
call   1060 <sqrt@plt>
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
call   1050 <cos@plt>
mulss  0x8(%rsp),%xmm0
mulss  0x10(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @gaussRand(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %3
store float %1, float* %4
%8 = call float @uRand(i32 0, i32 6)
store float %8, float* %5
%9 = call float @expRand(double 5.000000e-01)
store float %9, float* %6
%10 = load float, float* %6
%11 = call float @sqrt(float %10)
%12 = load float, float* %5
%13 = call float @cos(float %12)
%14 = fmul float %11, %13
store float %14, float* %7
%15 = load float, float* %7
%16 = load float, float* %4
%17 = load float, float* %3
%18 = call float @llvm.fmuladd.f32(float %15, float %16, float %17)
ret float %18
}

LLVM IR (-O2):
define float @gaussRand(float %0, float %1) {
%3 = tail call float @uRand(i32 0, i32 6)
%4 = tail call float @expRand(double 5.000000e-01)
%5 = tail call float @sqrt(float %4)
%6 = tail call float @cos(float %3)
%7 = fmul float %5, %6
%8 = tail call float @llvm.fmuladd.f32(float %7, float %1, float %0)
ret float %8
}
/* Type definitions */
struct vnic_rq {
  int dummy;
};

/* Variables and functions */
int stub1(struct vnic_rq *);
int vnic_rq_desc_avail(struct vnic_rq *);
int vnic_rq_fill(struct vnic_rq *rq, int (*buf_fill)(struct vnic_rq *rq)) {
  int err;
  while (vnic_rq_desc_avail(rq) > 1) {
    err = (*buf_fill)(rq);
    if (err)
      return err;
  }
  return 0;
}


x86 assembly (clang, -O0):
<vnic_rq_fill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <vnic_rq_desc_avail@plt>
cmp    $0x1,%eax
jle    1159 <vnic_rq_fill+0x49>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rdi
call   *%rax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1154 <vnic_rq_fill+0x44>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1160 <vnic_rq_fill+0x50>
jmp    1120 <vnic_rq_fill+0x10>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vnic_rq_fill>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <vnic_rq_desc_avail@plt>
cmp    $0x2,%eax
jl     1139 <vnic_rq_fill+0x29>
mov    %rbx,%rdi
call   *%r14
test   %eax,%eax
je     1120 <vnic_rq_fill+0x10>
jmp    113b <vnic_rq_fill+0x2b>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.vnic_rq = type { i32 }
define i32 @vnic_rq_fill(%struct.vnic_rq* %0, i32 (%struct.vnic_rq*)* nocapture %1) {
br label %3
3: ; preds = %6, %2
%4 = tail call i32 @vnic_rq_desc_avail(%struct.vnic_rq* %0)
%5 = icmp sgt i32 %4, 1
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 %1(%struct.vnic_rq* %0)
%8 = icmp eq i32 %7, 0
br i1 %8, label %3, label %9
9: ; preds = %3, %6
%10 = phi i32 [ %7, %6 ], [ 0, %3 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ project(int, int /*<<< orphan*/, int, int, int, int, int);
void monst_bolt_monst(int m_idx, int y, int x, int typ, int dam_hp) {
  int flg = 0x00000008 | 0x00000040;
  (void)project(m_idx, 0, y, x, dam_hp, typ, flg);
}


x86 assembly (clang, -O0):
<monst_bolt_monst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
movl   $0x48,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x10(%rbp),%r9d
mov    -0x18(%rbp),%eax
xor    %esi,%esi
mov    %eax,(%rsp)
call   1030 <project@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<monst_bolt_monst>:
push   %rax
mov    %ecx,%r9d
mov    %edx,%ecx
mov    %esi,%edx
movl   $0x48,(%rsp)
xor    %esi,%esi
call   1030 <project@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @monst_bolt_monst(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
store i32 72, i32* %11
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i32, i32* %10
%16 = load i32, i32* %9
%17 = load i32, i32* %11
%18 = call i32 @project(i32 %12, i32 0, i32 %13, i32 %14, i32 %15, i32 %16, i32 %17)
ret void
}

LLVM IR (-O2):
define void @monst_bolt_monst(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @project(i32 %0, i32 0, i32 %1, i32 %2, i32 %4, i32 %3, i32 72)
ret void
}
/* Variables and functions */
char *CuStrAlloc(size_t);
int /*<<< orphan*/ strcpy(char *, char const *);
size_t strlen(char const *);
char *CuStrCopy(const char *old) {
  size_t len = strlen(old);
  char *newStr = CuStrAlloc(len + 1);
  strcpy(newStr, old);
  return newStr;
}


x86 assembly (clang, -O0):
<CuStrCopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1050 <CuStrAlloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CuStrCopy>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <CuStrAlloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @CuStrCopy(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = add i64 %7, 1
%9 = call i8* @CuStrAlloc(i64 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = load i8*, i8** %2
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = load i8*, i8** %4
ret i8* %13
}

LLVM IR (-O2):
define i8* @CuStrCopy(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i8* @CuStrAlloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("Hello World \n\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"Hello World \0A\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 ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [14 x i8] c"Hello World \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void av_fft_end() {}


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

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

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

LLVM IR (-O2):
define void @av_fft_end() {
ret void
}
void GPMCAutoIdleConfig(unsigned int baseAddr, unsigned int configVal) {
  (*((volatile unsigned int *)(baseAddr + (0x10)))) &= ~(0x00000001u);
  (*((volatile unsigned int *)(baseAddr + (0x10)))) =
      ((configVal << (0x00000000u)) & (0x00000001u));
}


x86 assembly (clang, -O0):
<GPMCAutoIdleConfig>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xfffffffe,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
shl    $0x0,%ecx
and    $0x1,%ecx
mov    -0x4(%rbp),%eax
add    $0x10,%eax
mov    %eax,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPMCAutoIdleConfig>:
add    $0x10,%edi
andl   $0xfffffffe,(%rdi)
and    $0x1,%esi
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @GPMCAutoIdleConfig(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 = add i32 %5, 16
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = and i32 %9, -2
store volatile i32 %10, i32* %8
%11 = load i32, i32* %4
%12 = shl i32 %11, 0
%13 = and i32 %12, 1
%14 = load i32, i32* %3
%15 = add i32 %14, 16
%16 = zext i32 %15 to i64
%17 = inttoptr i64 %16 to i32*
store volatile i32 %13, i32* %17
ret void
}

LLVM IR (-O2):
define void @GPMCAutoIdleConfig(i32 %0, i32 %1) {
%3 = add i32 %0, 16
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = and i32 %6, -2
store volatile i32 %7, i32* %5
%8 = and i32 %1, 1
store volatile i32 %8, i32* %5
ret void
}
/* Variables and functions */
size_t backtrace(void **, int);
char **backtrace_symbols(void **, size_t);
int /*<<< orphan*/ backtrace_symbols_fd(void **, size_t, int);
int /*<<< orphan*/ exit(int);
void segvhld(int no) {
  void *array[10];
  size_t size;
  char **strings;
  int i;
  size = backtrace(array, 10);
  strings = backtrace_symbols(array, size);
  backtrace_symbols_fd(array, size, 1);
  exit(1);
}


x86 assembly (clang, -O0):
<segvhld>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
mov    $0xa,%esi
call   1050 <backtrace@plt>
mov    %rax,-0x68(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
call   1040 <backtrace_symbols@plt>
mov    %rax,-0x70(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rsi
mov    $0x1,%edx
call   1030 <backtrace_symbols_fd@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<segvhld>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0xa,%esi
call   1050 <backtrace@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <backtrace_symbols@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <backtrace_symbols_fd@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
define void @segvhld(i32 %0) {
%2 = alloca i32
%3 = alloca [10 x i8*]
%4 = alloca i64
%5 = alloca i8**
%6 = alloca i32
store i32 %0, i32* %2
%7 = getelementptr inbounds [10 x i8*], [10 x i8*]* %3, i64 0, i64 0
%8 = call i64 @backtrace(i8** %7, i32 10)
store i64 %8, i64* %4
%9 = getelementptr inbounds [10 x i8*], [10 x i8*]* %3, i64 0, i64 0
%10 = load i64, i64* %4
%11 = call i8** @backtrace_symbols(i8** %9, i64 %10)
store i8** %11, i8*** %5
%12 = getelementptr inbounds [10 x i8*], [10 x i8*]* %3, i64 0, i64 0
%13 = load i64, i64* %4
%14 = call i32 @backtrace_symbols_fd(i8** %12, i64 %13, i32 1)
%15 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @segvhld(i32 %0) {
%2 = alloca [10 x i8*]
%3 = bitcast [10 x i8*]* %2 to i8*
%4 = getelementptr inbounds [10 x i8*], [10 x i8*]* %2, i64 0, i64 0
%5 = call i64 @backtrace(i8** %4, i32 10)
%6 = call i8** @backtrace_symbols(i8** %4, i64 %5)
%7 = call i32 @backtrace_symbols_fd(i8** %4, i64 %5, i32 1)
%8 = call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int partition(float *, int, int);
void quick_sort(float *array, int low, int high) {
  if (low < high) {
    int p = partition(array, low, high);
    quick_sort(array, low, p - 1);
    quick_sort(array, p + 1, high);
  }
}


x86 assembly (clang, -O0):
<quick_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <quick_sort+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quick_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quick_sort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quick_sort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <quick_sort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quick_sort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quick_sort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @quick_sort(float* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(float* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quick_sort(float* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
/* Variables and functions */
char *gmk_alloc(size_t);
int /*<<< orphan*/ memcpy(void *, char const *, size_t);
size_t strlen(char const *);
char *gmake_strcpy(const char *src) {
  size_t len = strlen(src);
  char *dest = gmk_alloc(len + 1);
  memcpy((void *)dest, src, len);
  dest[len] = 0;
  return dest;
}


x86 assembly (clang, -O0):
<gmake_strcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1040 <gmk_alloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1050 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gmake_strcpy>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %rax,%r15
lea    0x1(%rax),%rdi
call   1040 <gmk_alloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <memcpy@plt>
movb   $0x0,(%rbx,%r15,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @gmake_strcpy(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = add i64 %7, 1
%9 = call i8* @gmk_alloc(i64 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = load i8*, i8** %2
%12 = load i64, i64* %3
%13 = call i32 @memcpy(i8* %10, i8* %11, i64 %12)
%14 = load i8*, i8** %4
%15 = load i64, i64* %3
%16 = getelementptr inbounds i8, i8* %14, i64 %15
store i8 0, i8* %16
%17 = load i8*, i8** %4
ret i8* %17
}

LLVM IR (-O2):
define i8* @gmake_strcpy(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i8* @gmk_alloc(i64 %3)
%5 = tail call i32 @memcpy(i8* %4, i8* %0, i64 %2)
%6 = getelementptr inbounds i8, i8* %4, i64 %2
store i8 0, i8* %6
ret i8* %4
}
float Sleef_nextafterf(float x, float y) { return __builtin_nextafterf(x, y); }


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

x86 assembly (clang, -O2):
<Sleef_nextafterf>:
jmp    1030 <nextafterf@plt>

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

LLVM IR (-O2):
define float @Sleef_nextafterf(float %0, float %1) {
%3 = tail call float @nextafterf(float %0, float %1)
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ SIZE_MAX;
size_t utf8nlen(void const *, int /*<<< orphan*/);
size_t utf8len(const void *str) { return utf8nlen(str, SIZE_MAX); }


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

x86 assembly (clang, -O2):
<utf8len>:
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
jmp    1030 <utf8nlen@plt>

LLVM IR (-O0):
@SIZE_MAX = global i32 0
define i64 @utf8len(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @SIZE_MAX
%5 = call i64 @utf8nlen(i8* %3, i32 %4)
ret i64 %5
}

LLVM IR (-O2):
@SIZE_MAX = global i32 0
define i64 @utf8len(i8* %0) {
%2 = load i32, i32* @SIZE_MAX
%3 = tail call i64 @utf8nlen(i8* %0, i32 %2)
ret i64 %3
}
/* Variables and functions */
unsigned int rand_range(int /*<<< orphan*/, int);
unsigned int choice(unsigned int prob) { return (rand_range(0, 100) < prob); }


x86 assembly (clang, -O0):
<choice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %edi,%edi
mov    $0x64,%esi
call   1030 <rand_range@plt>
cmp    -0x4(%rbp),%eax
setb   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<choice>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
mov    $0x64,%esi
call   1030 <rand_range@plt>
xor    %ecx,%ecx
cmp    %ebx,%eax
setb   %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @choice(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @rand_range(i32 0, i32 100)
%4 = load i32, i32* %2
%5 = icmp ult i32 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @choice(i32 %0) {
%2 = tail call i32 @rand_range(i32 0, i32 100)
%3 = icmp ult i32 %2, %0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
scalar_t__ getint(int *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int a;
  if (getint(&a)) {
    printf("You entered %d\n", a);
  } else {
    printf("You did not enter a valid number\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <getint@plt>
cmp    $0x0,%rax
je     1158 <main+0x38>
mov    -0x8(%rbp),%esi
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1166 <main+0x46>
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
call   1050 <getint@plt>
test   %rax,%rax
je     1154 <main+0x24>
mov    0x4(%rsp),%esi
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1160 <main+0x30>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"You entered %d\0A\00"
@.str.1 = [34 x i8] c"You did not enter a valid number\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i64 @getint(i32* %2)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32, i32* %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %10
8: ; preds = %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"You entered %d\0A\00"
@str = [33 x i8] c"You did not enter a valid number\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i64 @getint(i32* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = load i32, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %10
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
br label %10
10: ; preds = %8, %5
ret i32 0
}
/* Variables and functions */
char *strchr(char const *, char);
const char *next_mod(const char *mod) {
  mod = strchr(mod, '\0') + 1;
  while (*mod == '\0')
    mod++;
  return mod;
}


x86 assembly (clang, -O0):
<next_mod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <strchr@plt>
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1150 <next_mod+0x40>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    112f <next_mod+0x1f>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_mod>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
add    %rbx,%rax
nopl   0x0(%rax)
cmpb   $0x0,0x1(%rax)
lea    0x1(%rax),%rax
je     1120 <next_mod+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @next_mod(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = getelementptr i8, i8* %0, i64 %2
br label %4
4: ; preds = %4, %1
%5 = phi i8* [ %3, %1 ], [ %6, %4 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %4, label %9
9: ; preds = %4
ret i8* %6
}
void __aeabi_unwind_cpp_pr2() {}


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

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

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

LLVM IR (-O2):
define void @__aeabi_unwind_cpp_pr2() {
ret void
}
void wr_string(addr, len) char *addr;
long len;
{ OUTWRITE((((0 + 3) + 1) + 1), addr, len); }


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

x86 assembly (clang, -O2):
<wr_string>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x5,%edi
xor    %eax,%eax
jmp    1030 <OUTWRITE@plt>

LLVM IR (-O0):
define void @wr_string(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @OUTWRITE to i32 (i32, i8*, i64, ...)*)(i32 5, i8* %5, i64 %6)
ret void
}

LLVM IR (-O2):
define void @wr_string(i8* %0, i64 %1) {
%3 = tail call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @OUTWRITE to i32 (i32, i8*, i64, ...)*)(i32 5, i8* %0, i64 %1)
ret void
}
/* Variables and functions */
double sla_dat_(double *);
double slaDat(double utc) {
  double UTC;
  double RETVAL;
  double retval;
  UTC = utc;
  RETVAL = sla_dat_(&UTC);
  retval = RETVAL;
  return retval;
}


x86 assembly (clang, -O0):
<slaDat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <sla_dat_@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slaDat>:
push   %rax
movsd  %xmm0,(%rsp)
mov    %rsp,%rdi
call   1030 <sla_dat_@plt>
pop    %rax
ret

LLVM IR (-O0):
define double @slaDat(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %2
%6 = load double, double* %2
store double %6, double* %3
%7 = call double @sla_dat_(double* %3)
store double %7, double* %4
%8 = load double, double* %4
store double %8, double* %5
%9 = load double, double* %5
ret double %9
}

LLVM IR (-O2):
define double @slaDat(double %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
store double %0, double* %2
%4 = call double @sla_dat_(double* %2)
ret double %4
}