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

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_resp1_reg(uint32_t *emmc) {
  uint32_t resp1 = *(emmc + 0x14 / 4);
  printf("RESP1:-----------------------------------------\n");
  printf("RESP1:             %#08X\n", resp1);
}


x86 assembly (clang, -O0):
<print_resp1_reg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%eax
mov    %eax,-0xc(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xef3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_resp1_reg>:
push   %rbx
mov    0x14(%rdi),%ebx
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"RESP1:-----------------------------------------\0A\00"
@.str.1 = [26 x i8] c"RESP1: %X\0A\00"
define void @print_resp1_reg(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 5
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret void
}

LLVM IR (-O2):
@.str.1 = [26 x i8] c"RESP1: %X\0A\00"
@str = [48 x i8] c"RESP1:-----------------------------------------\00"
define void @print_resp1_reg(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 5
%3 = load i32, i32* %2
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret void
}
int do_745() { return 745; }


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

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

LLVM IR (-O0):
define i32 @do_745() {
ret i32 745
}

LLVM IR (-O2):
define i32 @do_745() {
ret i32 745
}
/* Variables and functions */
int /*<<< orphan*/ bar(int, int);
void foo(int a, int b) {
  bar(a, b);
  bar(a, b);
}


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

x86 assembly (clang, -O2):
<foo>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <bar@plt>
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <bar@plt>

LLVM IR (-O0):
define void @foo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @bar(i32 %5, i32 %6)
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @bar(i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0, i32 %1) {
%3 = tail call i32 @bar(i32 %0, i32 %1)
%4 = tail call i32 @bar(i32 %0, i32 %1)
ret void
}
/* Variables and functions */
void *malloc(unsigned int);
void *gzalloc(void *x, unsigned items, unsigned size) {
  void *p;
  size *= items;
  size = (size + 16 - 1) & ~(16 - 1);
  p = malloc(size);
  return (p);
}


x86 assembly (clang, -O0):
<gzalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%eax
sub    $0x1,%eax
and    $0xfffffff0,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gzalloc>:
imul   %edx,%esi
lea    0xf(%rsi),%edi
and    $0xfffffff0,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @gzalloc(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = mul i32 %9, %8
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = add i32 %11, 16
%13 = sub i32 %12, 1
%14 = and i32 %13, -16
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = call i8* @malloc(i32 %15)
store i8* %16, i8** %7
%17 = load i8*, i8** %7
ret i8* %17
}

LLVM IR (-O2):
define noalias i8* @gzalloc(i8* nocapture readnone %0, i32 %1, i32 %2) {
%4 = mul i32 %2, %1
%5 = add i32 %4, 15
%6 = and i32 %5, -16
%7 = tail call i8* @malloc(i32 %6)
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ serialCommand(char *, int /*<<< orphan*/);
void hr20SetModeAuto() { serialCommand("\rM01\r", 0); }


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

x86 assembly (clang, -O2):
<hr20SetModeAuto>:
lea    0xee9(%rip),%rdi
xor    %esi,%esi
jmp    1030 <serialCommand@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"\0DM01\0D\00"
define void @hr20SetModeAuto() {
%1 = call i32 @serialCommand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"\0DM01\0D\00"
define void @hr20SetModeAuto() {
%1 = tail call i32 @serialCommand(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 0)
ret void
}
/* Type definitions */
typedef scalar_t__ uint16_t;

/* Variables and functions */
void watchdog_reboot(void) { *(volatile uint16_t *)0x4005200C = 0; }


x86 assembly (clang, -O0):
<watchdog_reboot>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4005200c,%eax
movq   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<watchdog_reboot>:
movq   $0x0,0x4005200c
ret

LLVM IR (-O0):
define void @watchdog_reboot() {
store volatile i64 0, i64* inttoptr (i64 1074077708 to i64*)
ret void
}

LLVM IR (-O2):
define void @watchdog_reboot() {
store volatile i64 0, i64* inttoptr (i64 1074077708 to i64*)
ret void
}
double transfer(double neighbor, double current) {
  return ((1 - neighbor) * current) / 4;
}


x86 assembly (clang, -O0):
<transfer>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xef2(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xed8(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<transfer>:
movsd  0xef8(%rip),%xmm2
subsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
mulsd  0xef0(%rip),%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @transfer(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = fsub double 1.000000e+00, %5
%7 = load double, double* %4
%8 = fmul double %6, %7
%9 = fdiv double %8, 4.000000e+00
ret double %9
}

LLVM IR (-O2):
define double @transfer(double %0, double %1) {
%3 = fsub double 1.000000e+00, %0
%4 = fmul double %3, %1
%5 = fmul double %4, 2.500000e-01
ret double %5
}
void tinydrm_dbg_spi_message(struct spi_device *spi, struct spi_message *m) {}


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

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

LLVM IR (-O0):
%struct.spi_device = type opaque
%struct.spi_message = type opaque
define void @tinydrm_dbg_spi_message(%struct.spi_device* %0, %struct.spi_message* %1) {
%3 = alloca %struct.spi_device*
%4 = alloca %struct.spi_message*
store %struct.spi_device* %0, %struct.spi_device** %3
store %struct.spi_message* %1, %struct.spi_message** %4
ret void
}

LLVM IR (-O2):
%struct.spi_device = type opaque
%struct.spi_message = type opaque
define void @tinydrm_dbg_spi_message(%struct.spi_device* nocapture %0, %struct.spi_message* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int getNumber(void) {
  int num;
  printf("Enter a number --> ");
  scanf("%i", &num);
  return num;
}


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

x86 assembly (clang, -O2):
<getNumber>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Enter a number --> \00"
@.str.1 = [3 x i8] c"%i\00"
define i32 @getNumber() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@.str = [20 x i8] c"Enter a number --> \00"
@.str.1 = [3 x i8] c"%i\00"
define i32 @getNumber() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
ret i32 %5
}
/* Variables and functions */
int create_channel(int, char const *);
int /*<<< orphan*/ log_channel(int, int, char const *, char const *,
                               int /*<<< orphan*/);
void log_to_user_window(int sr, const char *nick, const char *what) {
  int ch = create_channel(sr, nick);
  log_channel(sr, ch, nick, what, 0);
}


x86 assembly (clang, -O0):
<log_to_user_window>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <create_channel@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1040 <log_channel@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_to_user_window>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
call   1030 <create_channel@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
xor    %r8d,%r8d
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <log_channel@plt>

LLVM IR (-O0):
define void @log_to_user_window(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i32, i32* %4
%9 = load i8*, i8** %5
%10 = call i32 @create_channel(i32 %8, i8* %9)
store i32 %10, i32* %7
%11 = load i32, i32* %4
%12 = load i32, i32* %7
%13 = load i8*, i8** %5
%14 = load i8*, i8** %6
%15 = call i32 @log_channel(i32 %11, i32 %12, i8* %13, i8* %14, i32 0)
ret void
}

LLVM IR (-O2):
define void @log_to_user_window(i32 %0, i8* %1, i8* %2) {
%4 = tail call i32 @create_channel(i32 %0, i8* %1)
%5 = tail call i32 @log_channel(i32 %0, i32 %4, i8* %1, i8* %2, i32 0)
ret void
}
int test_imm_D2uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0xD2 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_D2uint64_midword_reg>:
test   $0xd20000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_D2uint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 210
%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_D2uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 13762560
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello,Linux!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
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 = [14 x i8] c"Hello,Linux!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [13 x i8] c"Hello,Linux!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int IsQuote(char C) { return (C == '"' || C == '\''); }


x86 assembly (clang, -O0):
<IsQuote>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x22,%ecx
mov    %al,-0x2(%rbp)
je     1129 <IsQuote+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x27,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsQuote>:
cmp    $0x22,%dil
sete   %al
cmp    $0x27,%dil
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @IsQuote(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 34
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 39
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @IsQuote(i8 signext %0) {
%2 = icmp eq i8 %0, 34
%3 = icmp eq i8 %0, 39
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
char *gdb_write_registers(char *regs) {}


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

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

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

LLVM IR (-O2):
define noalias i8* @gdb_write_registers(i8* nocapture readnone %0) {
ret i8* undef
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int MAP_LOCKED;
int MAP_SHARED;
int PROT_EXEC;
int PROT_READ;
int PROT_WRITE;
scalar_t__ mmap(int /*<<< orphan*/, int /*<<< orphan*/, int, int, int,
                int /*<<< orphan*/);
uint32_t *initMapMem(int fd, uint32_t addr, uint32_t len) {
  return (uint32_t *)mmap(0, len, PROT_READ | PROT_WRITE | PROT_EXEC,
                          MAP_SHARED | MAP_LOCKED, fd, addr);
}


x86 assembly (clang, -O0):
<initMapMem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    0x2ecd(%rip),%rax
mov    (%rax),%edx
mov    0x2e8c(%rip),%rax
or     (%rax),%edx
mov    0x2e9b(%rip),%rax
or     (%rax),%edx
mov    0x2ea2(%rip),%rax
mov    (%rax),%ecx
mov    0x2e79(%rip),%rax
or     (%rax),%ecx
mov    -0x4(%rbp),%r8d
mov    -0x8(%rbp),%r9d
xor    %edi,%edi
call   1030 <mmap@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initMapMem>:
mov    %esi,%r9d
mov    %edi,%r8d
mov    0x2edb(%rip),%rcx
mov    0x2e9c(%rip),%rax
mov    (%rax),%eax
or     (%rcx),%eax
mov    0x2ea9(%rip),%rcx
or     (%rcx),%eax
mov    0x2eb0(%rip),%rsi
mov    0x2e89(%rip),%rcx
mov    (%rcx),%ecx
or     (%rsi),%ecx
xor    %edi,%edi
mov    %edx,%esi
mov    %eax,%edx
jmp    1030 <mmap@plt>

LLVM IR (-O0):
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@PROT_EXEC = global i32 0
@MAP_SHARED = global i32 0
@MAP_LOCKED = global i32 0
define i32* @initMapMem(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = load i32, i32* @PROT_READ
%9 = load i32, i32* @PROT_WRITE
%10 = or i32 %8, %9
%11 = load i32, i32* @PROT_EXEC
%12 = or i32 %10, %11
%13 = load i32, i32* @MAP_SHARED
%14 = load i32, i32* @MAP_LOCKED
%15 = or i32 %13, %14
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = call i64 @mmap(i32 0, i32 %7, i32 %12, i32 %15, i32 %16, i32 %17)
%19 = inttoptr i64 %18 to i32*
ret i32* %19
}

LLVM IR (-O2):
@PROT_READ = global i32 0
@PROT_WRITE = global i32 0
@PROT_EXEC = global i32 0
@MAP_SHARED = global i32 0
@MAP_LOCKED = global i32 0
define i32* @initMapMem(i32 %0, i32 %1, i32 %2) {
%4 = load i32, i32* @PROT_READ
%5 = load i32, i32* @PROT_WRITE
%6 = or i32 %5, %4
%7 = load i32, i32* @PROT_EXEC
%8 = or i32 %6, %7
%9 = load i32, i32* @MAP_SHARED
%10 = load i32, i32* @MAP_LOCKED
%11 = or i32 %10, %9
%12 = tail call i64 @mmap(i32 0, i32 %2, i32 %8, i32 %11, i32 %0, i32 %1)
%13 = inttoptr i64 %12 to i32*
ret i32* %13
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
void print_char_uart0(char c) {
  (*((volatile uint32_t *)((volatile uint32_t *const)0x101f1000)) =
       (volatile uint32_t)(c));
}


x86 assembly (clang, -O0):
<print_char_uart0>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbq -0x1(%rbp),%rcx
mov    $0x101f1000,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_char_uart0>:
movslq %edi,%rax
mov    %rax,0x101f1000
10
ret

LLVM IR (-O0):
define void @print_char_uart0(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i64
store volatile i64 %4, i64* inttoptr (i64 270471168 to i64*)
ret void
}

LLVM IR (-O2):
define void @print_char_uart0(i8 signext %0) {
%2 = sext i8 %0 to i64
store volatile i64 %2, i64* inttoptr (i64 270471168 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ setenv(char const *, char const *, int);
int /*<<< orphan*/ unsetenv(char const *);
void CGI_set_env(const char *var, const char *val) {
  (val == NULL) ? unsetenv(var) : setenv(var, val, 1);
}


x86 assembly (clang, -O0):
<CGI_set_env>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1149 <CGI_set_env+0x29>
mov    -0x8(%rbp),%rdi
call   1040 <unsetenv@plt>
jmp    115b <CGI_set_env+0x3b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1030 <setenv@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CGI_set_env>:
test   %rsi,%rsi
je     112f <CGI_set_env+0xf>
mov    $0x1,%edx
jmp    1030 <setenv@plt>
jmp    1040 <unsetenv@plt>

LLVM IR (-O0):
define void @CGI_set_env(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 = icmp eq i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i32 @unsetenv(i8* %8)
br label %14
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = load i8*, i8** %4
%13 = call i32 @setenv(i8* %11, i8* %12, i32 1)
br label %14
14: ; preds = %10, %7
%15 = phi i32 [ %9, %7 ], [ %13, %10 ]
ret void
}

LLVM IR (-O2):
define void @CGI_set_env(i8* %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @unsetenv(i8* %0)
br label %8
6: ; preds = %2
%7 = tail call i32 @setenv(i8* %0, i8* %1, i32 1)
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
double get_IAT_K();
double get_MAP();
double get_VE();
long double grams_air() {
  return ((get_VE() * get_MAP() * .4) / (get_IAT_K() * 8.3144621)) * 28.96;
}


x86 assembly (clang, -O0):
<grams_air>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
mov    %al,-0x19(%rbp)
call   1030 <get_VE@plt>
mov    -0x19(%rbp),%al
movsd  %xmm0,-0x18(%rbp)
call   1050 <get_MAP@plt>
mov    -0x19(%rbp),%al
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe9a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
call   1040 <get_IAT_K@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  0xe84(%rip),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  0xe7c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
fldl   -0x8(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grams_air>:
sub    $0x18,%rsp
xor    %eax,%eax
call   1030 <get_VE@plt>
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1050 <get_MAP@plt>
mulsd  0x8(%rsp),%xmm0
mulsd  0xeaa(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1040 <get_IAT_K@plt>
mulsd  0xe9d(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
mulsd  0xe93(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
fldl   0x10(%rsp)
add    $0x18,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @grams_air() {
%1 = call double (...) @get_VE()
%2 = call double (...) @get_MAP()
%3 = fmul double %1, %2
%4 = fmul double %3, 4.000000e-01
%5 = call double (...) @get_IAT_K()
%6 = fmul double %5, 0x4020A1012D26A9B8
%7 = fdiv double %4, %6
%8 = fmul double %7, 2.896000e+01
%9 = fpext double %8 to x86_fp80
ret x86_fp80 %9
}

LLVM IR (-O2):
define x86_fp80 @grams_air() {
%1 = tail call double (...) @get_VE()
%2 = tail call double (...) @get_MAP()
%3 = fmul double %1, %2
%4 = fmul double %3, 4.000000e-01
%5 = tail call double (...) @get_IAT_K()
%6 = fmul double %5, 0x4020A1012D26A9B8
%7 = fdiv double %4, %6
%8 = fmul double %7, 2.896000e+01
%9 = fpext double %8 to x86_fp80
ret x86_fp80 %9
}
int d_bgt_cr2(double a1) { return !(__builtin_isgreater(100, a1)); }


x86 assembly (clang, -O0):
<d_bgt_cr2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
seta   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_bgt_cr2>:
movsd  0xef8(%rip),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
setbe  %al
ret

LLVM IR (-O0):
define i32 @d_bgt_cr2(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ogt double 1.000000e+02, %3
%5 = xor i1 %4, true
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @d_bgt_cr2(double %0) {
%2 = fcmp uge double %0, 1.000000e+02
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
double atof(char *);
int ncmp(char *s1, char *s2) {
  double d1 = atof(s1);
  double d2 = atof(s2);
  return d1 > d2 ? 1 : d1 < d2 ? -1 : 0;
}


x86 assembly (clang, -O0):
<ncmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1159 <ncmp+0x49>
mov    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1174 <ncmp+0x64>
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
xor    %eax,%eax
mov    $0xffffffff,%ecx
ucomisd %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ncmp>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
call   1030 <atof@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <atof@plt>
xor    %ecx,%ecx
movsd  0x8(%rsp),%xmm1
ucomisd %xmm1,%xmm0
seta   %cl
neg    %ecx
ucomisd %xmm0,%xmm1
mov    $0x1,%eax
cmovbe %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ncmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca double
%6 = alloca double
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call double @atof(i8* %7)
store double %8, double* %5
%9 = load i8*, i8** %4
%10 = call double @atof(i8* %9)
store double %10, double* %6
%11 = load double, double* %5
%12 = load double, double* %6
%13 = fcmp ogt double %11, %12
br i1 %13, label %14, label %15
14: ; preds = %2
br label %21
15: ; preds = %2
%16 = load double, double* %5
%17 = load double, double* %6
%18 = fcmp olt double %16, %17
%19 = zext i1 %18 to i64
%20 = select i1 %18, i32 -1, i32 0
br label %21
21: ; preds = %15, %14
%22 = phi i32 [ 1, %14 ], [ %20, %15 ]
ret i32 %22
}

LLVM IR (-O2):
define i32 @ncmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call double @atof(i8* %0)
%4 = tail call double @atof(i8* %1)
%5 = fcmp ogt double %3, %4
%6 = fcmp olt double %3, %4
%7 = sext i1 %6 to i32
%8 = select i1 %5, i32 1, i32 %7
ret i32 %8
}
/* Variables and functions */
int unlink(char *);
int md_unlink(char *file) { return (unlink(file)); }


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

x86 assembly (clang, -O2):
<md_unlink>:
jmp    1030 <unlink@plt>

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

LLVM IR (-O2):
define i32 @md_unlink(i8* nocapture %0) {
%2 = tail call i32 @unlink(i8* %0)
ret i32 %2
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
unsigned int bytestream_get_be16(const uint8_t **b) {
  (*b) += 2;
  return ((((const uint8_t *)(*b - 2))[0] << 8) |
          ((const uint8_t *)(*b - 2))[1]);
}


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

x86 assembly (clang, -O2):
<bytestream_get_be16>:
mov    (%rdi),%rcx
lea    0x8(%rcx),%rax
mov    %rax,(%rdi)
mov    (%rcx),%eax
shl    $0x8,%eax
or     0x4(%rcx),%eax
ret

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

LLVM IR (-O2):
define i32 @bytestream_get_be16(i32** nocapture %0) {
%2 = load i32*, i32** %0
%3 = getelementptr inbounds i32, i32* %2, i64 2
store i32* %3, i32** %0
%4 = load i32, i32* %2
%5 = shl i32 %4, 8
%6 = getelementptr inbounds i32, i32* %2, i64 1
%7 = load i32, i32* %6
%8 = or i32 %5, %7
ret i32 %8
}
/* Variables and functions */
scalar_t__ malloc(unsigned short);
int /*<<< orphan*/ strcat(char *, char const *);
int /*<<< orphan*/ strcpy(char *, char const *);
unsigned short strlen(char const *);
char *bob_strcat(const char *str1, const char *str2) {
  unsigned short len1 = strlen(str1);
  unsigned short len2 = strlen(str2);
  char *newstr = (char *)malloc(len1 + len2 + 1);
  strcpy(newstr, str1);
  strcat(newstr, str2);
  return newstr;
}


x86 assembly (clang, -O0):
<bob_strcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %ax,-0x12(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %ax,-0x14(%rbp)
movzwl -0x12(%rbp),%eax
movzwl -0x14(%rbp),%ecx
add    %ecx,%eax
add    $0x1,%eax
movzwl %ax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bob_strcat>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1040 <strlen@plt>
mov    %eax,%r15d
mov    %r14,%rdi
call   1040 <strlen@plt>
add    %r15d,%eax
add    $0x1,%eax
movzwl %ax,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @bob_strcat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i16
%6 = alloca i16
%7 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = call zeroext i16 @strlen(i8* %8)
store i16 %9, i16* %5
%10 = load i8*, i8** %4
%11 = call zeroext i16 @strlen(i8* %10)
store i16 %11, i16* %6
%12 = load i16, i16* %5
%13 = zext i16 %12 to i32
%14 = load i16, i16* %6
%15 = zext i16 %14 to i32
%16 = add nsw i32 %13, %15
%17 = add nsw i32 %16, 1
%18 = trunc i32 %17 to i16
%19 = call i64 @malloc(i16 zeroext %18)
%20 = inttoptr i64 %19 to i8*
store i8* %20, i8** %7
%21 = load i8*, i8** %7
%22 = load i8*, i8** %3
%23 = call i32 @strcpy(i8* %21, i8* %22)
%24 = load i8*, i8** %7
%25 = load i8*, i8** %4
%26 = call i32 @strcat(i8* %24, i8* %25)
%27 = load i8*, i8** %7
ret i8* %27
}

LLVM IR (-O2):
define i8* @bob_strcat(i8* %0, i8* %1) {
%3 = tail call zeroext i16 @strlen(i8* %0)
%4 = tail call zeroext i16 @strlen(i8* %1)
%5 = add i16 %3, 1
%6 = add i16 %5, %4
%7 = tail call i64 @malloc(i16 zeroext %6)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32 @strcpy(i8* %8, i8* %0)
%10 = tail call i32 @strcat(i8* %8, i8* %1)
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void BT_free(void *pData) { free(pData); }


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

x86 assembly (clang, -O2):
<BT_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @BT_free(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @free(i8* %3)
ret void
}

LLVM IR (-O2):
define void @BT_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
char *skip_leading_whitespace(char *s) {
  char *i;
  for (i = s; *i == ' ' || *i == '\t' || *i == '\n';)
    i++;
  return i;
}


x86 assembly (clang, -O0):
<skip_leading_whitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x11(%rbp)
je     114a <skip_leading_whitespace+0x4a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x11(%rbp)
je     114a <skip_leading_whitespace+0x4a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115a <skip_leading_whitespace+0x5a>
jmp    116b <skip_leading_whitespace+0x6b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <skip_leading_whitespace+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_leading_whitespace>:
mov    %rdi,%rax
movabs $0x100000600,%rcx
nopl   (%rax)
movzbl (%rax),%edx
cmp    $0x20,%rdx
ja     1125 <skip_leading_whitespace+0x25>
bt     %rdx,%rcx
jae    1125 <skip_leading_whitespace+0x25>
add    $0x1,%rax
jmp    1110 <skip_leading_whitespace+0x10>
ret

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

LLVM IR (-O2):
define i8* @skip_leading_whitespace(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %7 [
i8 32, label %5
i8 9, label %5
i8 10, label %5
]
5: ; preds = %2, %2, %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
ret i8* %3
}
void print_string(char *p) {
  int i;
  for (i = 0; p[i]; ++i) {
    *(volatile unsigned char *)0x20000000 = (unsigned char)(p[i]);
  }
}


x86 assembly (clang, -O0):
<print_string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1141 <print_string+0x41>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    $0x20000000,%eax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <print_string+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_string>:
mov    (%rdi),%al
test   %al,%al
je     1122 <print_string+0x22>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
mov    %al,0x20000000
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <print_string+0x10>
ret

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

LLVM IR (-O2):
define void @print_string(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8 [ %9, %4 ], [ %2, %1 ]
store volatile i8 %6, i8* inttoptr (i64 536870912 to i8*)
%7 = add nuw i64 %5, 1
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
int bit_count(int /*<<< orphan*/);
int /*<<< orphan*/ get_stable_edge(unsigned long long const,
                                   unsigned long long const);
int get_edge_stability(const unsigned long long P, const unsigned long long O) {
  return bit_count(get_stable_edge(P, O));
}


x86 assembly (clang, -O0):
<get_edge_stability>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <get_stable_edge@plt>
mov    %eax,%edi
call   1040 <bit_count@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_edge_stability>:
push   %rax
call   1030 <get_stable_edge@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <bit_count@plt>

LLVM IR (-O0):
define i32 @get_edge_stability(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = call i32 @get_stable_edge(i64 %5, i64 %6)
%8 = call i32 @bit_count(i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @get_edge_stability(i64 %0, i64 %1) {
%3 = tail call i32 @get_stable_edge(i64 %0, i64 %1)
%4 = tail call i32 @bit_count(i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ apbuart_test(int);
int /*<<< orphan*/ gptimer_test(int, int);
int /*<<< orphan*/ irqtest(int);
int /*<<< orphan*/ leon3_test(int, int, int /*<<< orphan*/);
int /*<<< orphan*/ report_end();
int /*<<< orphan*/ report_start();
main() {
  report_start();
  leon3_test(1, 0xc0000200, 0);
  irqtest(0xc0000200);
  gptimer_test(0xc0000300, 8);
  apbuart_test(0xc0000100);
  report_end();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1080 <report_start@plt>
mov    $0x1,%edi
mov    $0xc0000200,%esi
xor    %edx,%edx
call   1040 <leon3_test@plt>
mov    $0xc0000200,%edi
call   1050 <irqtest@plt>
mov    $0xc0000300,%edi
mov    $0x8,%esi
call   1030 <gptimer_test@plt>
mov    $0xc0000100,%edi
call   1070 <apbuart_test@plt>
mov    $0x0,%al
call   1060 <report_end@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1080 <report_start@plt>
mov    $0x1,%edi
mov    $0xc0000200,%esi
xor    %edx,%edx
call   1040 <leon3_test@plt>
mov    $0xc0000200,%edi
call   1050 <irqtest@plt>
mov    $0xc0000300,%edi
mov    $0x8,%esi
call   1030 <gptimer_test@plt>
mov    $0xc0000100,%edi
call   1070 <apbuart_test@plt>
xor    %eax,%eax
call   1060 <report_end@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @report_start()
%2 = call i32 @leon3_test(i32 1, i32 -1073741312, i32 0)
%3 = call i32 @irqtest(i32 -1073741312)
%4 = call i32 @gptimer_test(i32 -1073741056, i32 8)
%5 = call i32 @apbuart_test(i32 -1073741568)
%6 = call i32 (...) @report_end()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @report_start()
%2 = tail call i32 @leon3_test(i32 1, i32 -1073741312, i32 0)
%3 = tail call i32 @irqtest(i32 -1073741312)
%4 = tail call i32 @gptimer_test(i32 -1073741056, i32 8)
%5 = tail call i32 @apbuart_test(i32 -1073741568)
%6 = tail call i32 (...) @report_end()
ret i32 0
}
/* Variables and functions */
int entry_point(int, char **);
int main(int argc, char **argv) { return entry_point(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)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <entry_point@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1030 <entry_point@plt>

LLVM IR (-O0):
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 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @entry_point(i32 %6, i8** %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @entry_point(i32 %0, i8** %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void instructionsStack(void) {
  puts("Enter choice:\n"
       "1 to push a value on the stack\n"
       "2 to pop a value off the stack\n"
       "3 to end program");
}


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

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

LLVM IR (-O0):
@.str = [93 x i8] c"Enter choice:\0A1 to push a value on the stack\0A2 to pop a value off the stack\0A3 to end program\00"
define void @instructionsStack() {
%1 = call i32 @puts(i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [93 x i8] c"Enter choice:\0A1 to push a value on the stack\0A2 to pop a value off the stack\0A3 to end program\00"
define void @instructionsStack() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([93 x i8], [93 x i8]* @.str, i64 0, i64 0))
ret void
}
int sprintf(char *_s, const char *_format, ...) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @sprintf(i8* nocapture readnone %0, i8* nocapture readnone %1, ...) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Fib2(int, int *);
int CountFib2(int n) {
  int calls = 0;
  Fib2(n, &calls);
  return calls;
}


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

x86 assembly (clang, -O2):
<CountFib2>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
call   1030 <Fib2@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @CountFib2(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = call i32 @Fib2(i32 %0, i32* %2)
%5 = load i32, i32* %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void FXClose(int sock) {
  close(sock);
  return;
}


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

x86 assembly (clang, -O2):
<FXClose>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @FXClose(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
const char *get_last_separator(const char *path) {
  const char *ret = 0;
  while (*path) {
    if (*path == '\\' || *path == '/')
      ret = path;
    path++;
  }
  return ret;
}


x86 assembly (clang, -O0):
<get_last_separator>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1156 <get_last_separator+0x56>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
je     113d <get_last_separator+0x3d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1145 <get_last_separator+0x45>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <get_last_separator+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_last_separator>:
xor    %eax,%eax
jmp    1117 <get_last_separator+0x17>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rdi,%rax
add    $0x1,%rdi
movzbl (%rdi),%ecx
cmp    $0x2f,%cl
je     1110 <get_last_separator+0x10>
cmp    $0x5c,%cl
je     1110 <get_last_separator+0x10>
test   %cl,%cl
jne    1113 <get_last_separator+0x13>
ret

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

LLVM IR (-O2):
define i8* @get_last_separator(i8* %0) {
br label %2
2: ; preds = %7, %1
%3 = phi i8* [ %0, %1 ], [ %9, %7 ]
%4 = phi i8* [ null, %1 ], [ %8, %7 ]
%5 = load i8, i8* %3
switch i8 %5, label %7 [
i8 0, label %10
i8 92, label %6
i8 47, label %6
]
6: ; preds = %2, %2
br label %7
7: ; preds = %2, %6
%8 = phi i8* [ %3, %6 ], [ %4, %2 ]
%9 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
10: ; preds = %2
ret i8* %4
}
/* Type definitions */
struct emuState {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cursor_index(struct emuState *, int);
void do_RI(struct emuState *S) { cursor_index(S, -1); }


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

x86 assembly (clang, -O2):
<do_RI>:
mov    $0xffffffff,%esi
jmp    1030 <cursor_index@plt>

LLVM IR (-O0):
%struct.emuState = type { i32 }
define void @do_RI(%struct.emuState* %0) {
%2 = alloca %struct.emuState*
store %struct.emuState* %0, %struct.emuState** %2
%3 = load %struct.emuState*, %struct.emuState** %2
%4 = call i32 @cursor_index(%struct.emuState* %3, i32 -1)
ret void
}

LLVM IR (-O2):
%struct.emuState = type { i32 }
define void @do_RI(%struct.emuState* %0) {
%2 = tail call i32 @cursor_index(%struct.emuState* %0, i32 -1)
ret void
}
/* Variables and functions */
scalar_t__ tolower(int);
int char_ci_le(int c1, int c2) { return tolower(c1) <= tolower(c2); }


x86 assembly (clang, -O0):
<char_ci_le>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <tolower@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <tolower@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
setle  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_ci_le>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
call   1030 <tolower@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1030 <tolower@plt>
xor    %ecx,%ecx
cmp    %rax,%rbx
setle  %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @char_ci_le(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 = call i64 @tolower(i32 %5)
%7 = load i32, i32* %4
%8 = call i64 @tolower(i32 %7)
%9 = icmp sle i64 %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @char_ci_le(i32 %0, i32 %1) {
%3 = tail call i64 @tolower(i32 %0)
%4 = tail call i64 @tolower(i32 %1)
%5 = icmp sle i64 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int array_sum(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int array[5] = {0, 1, 2, 3, 4};
  int len = 5;
  printf("The sum of the array is: %i\n", array_sum(array, len));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x5,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1040 <array_sum@plt>
mov    %eax,%esi
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1040 <array_sum@plt>
lea    0xec7(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.array = [5 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4]
@.str = [29 x i8] c"The sum of the array is: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [5 x i32]* %2 to i8*
store i32 5, i32* %3
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @array_sum(i32* %5, i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.array = [5 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4]
@.str = [29 x i8] c"The sum of the array is: %i\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @array_sum(i32* %3, i32 5)
%5 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}