xunge/DecIR huggingface dataset:
unsigned short get_unsigned_short_max() {
  unsigned short max = ~0;
  return (max);
}


x86 assembly (clang, -O0):
<get_unsigned_short_max>:
push   %rbp
mov    %rsp,%rbp
movw   $0xffff,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_unsigned_short_max>:
mov    $0xffff,%ax
ret

LLVM IR (-O0):
define zeroext i16 @get_unsigned_short_max() {
%1 = alloca i16
store i16 -1, i16* %1
%2 = load i16, i16* %1
ret i16 %2
}

LLVM IR (-O2):
define zeroext i16 @get_unsigned_short_max() {
ret i16 -1
}
/* Variables and functions */
int rand();
int ran(int range) {
  long i;
  i = rand() % range;
  return (i);
}


x86 assembly (clang, -O0):
<ran>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x4(%rbp)
movslq %edx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ran>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ran(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = call i32 (...) @rand()
%5 = load i32, i32* %2
%6 = srem i32 %4, %5
%7 = sext i32 %6 to i64
store i64 %7, i64* %3
%8 = load i64, i64* %3
%9 = trunc i64 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @ran(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ Fork();
int /*<<< orphan*/ printf(char *);
void doit() {
  Fork();
  Fork();
  printf("doit hello\n");
}


x86 assembly (clang, -O0):
<doit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <Fork@plt>
mov    $0x0,%al
call   1030 <Fork@plt>
lea    0xec7(%rip),%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<doit>:
push   %rax
xor    %eax,%eax
call   1030 <Fork@plt>
xor    %eax,%eax
call   1030 <Fork@plt>
lea    0xeca(%rip),%rdi
pop    %rax
jmp    1040 <puts@plt>

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

LLVM IR (-O2):
@str = [11 x i8] c"doit hello\00"
define void @doit() {
%1 = tail call i32 (...) @Fork()
%2 = tail call i32 (...) @Fork()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}
double sub(unsigned int numArgs, double *args) { return args[0] - args[1]; }


x86 assembly (clang, -O0):
<sub>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub>:
movsd  (%rsi),%xmm0
subsd  0x8(%rsi),%xmm0
ret

LLVM IR (-O0):
define double @sub(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
store i32 %0, i32* %3
store double* %1, double** %4
%5 = load double*, double** %4
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = getelementptr inbounds double, double* %8, i64 1
%10 = load double, double* %9
%11 = fsub double %7, %10
ret double %11
}

LLVM IR (-O2):
define double @sub(i32 %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = getelementptr inbounds double, double* %1, i64 1
%5 = load double, double* %4
%6 = fsub double %3, %5
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ asteroid_destroy(void *);
int /*<<< orphan*/ enemy_destroy(void *);
int /*<<< orphan*/ projectile_destroy(void *);
void destroy_entity(void *entity_ptr, void *type) {
  switch ((long)type) {
  case 0:
    enemy_destroy(entity_ptr);
    break;
  case 1:
    projectile_destroy(entity_ptr);
    break;
  case 2:
    asteroid_destroy(entity_ptr);
    break;
  }
}


x86 assembly (clang, -O0):
<destroy_entity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
test   %rax,%rax
je     117c <destroy_entity+0x4c>
jmp    1156 <destroy_entity+0x26>
mov    -0x18(%rbp),%rax
sub    $0x1,%rax
je     118a <destroy_entity+0x5a>
jmp    1169 <destroy_entity+0x39>
mov    -0x18(%rbp),%rax
sub    $0x2,%rax
je     1198 <destroy_entity+0x68>
jmp    11a1 <destroy_entity+0x71>
mov    -0x8(%rbp),%rdi
call   1030 <enemy_destroy@plt>
jmp    11a1 <destroy_entity+0x71>
mov    -0x8(%rbp),%rdi
call   1050 <projectile_destroy@plt>
jmp    11a1 <destroy_entity+0x71>
mov    -0x8(%rbp),%rdi
call   1040 <asteroid_destroy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<destroy_entity>:
cmp    $0x2,%rsi
je     1146 <destroy_entity+0x16>
cmp    $0x1,%rsi
je     114b <destroy_entity+0x1b>
test   %rsi,%rsi
jne    1150 <destroy_entity+0x20>
jmp    1030 <enemy_destroy@plt>
jmp    1040 <asteroid_destroy@plt>
jmp    1050 <projectile_destroy@plt>
ret

LLVM IR (-O0):
define void @destroy_entity(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 = ptrtoint i8* %5 to i64
switch i64 %6, label %16 [
i64 0, label %7
i64 1, label %10
i64 2, label %13
]
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i32 @enemy_destroy(i8* %8)
br label %16
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = call i32 @projectile_destroy(i8* %11)
br label %16
13: ; preds = %2
%14 = load i8*, i8** %3
%15 = call i32 @asteroid_destroy(i8* %14)
br label %16
16: ; preds = %2, %13, %10, %7
ret void
}

LLVM IR (-O2):
define void @destroy_entity(i8* %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
switch i64 %3, label %10 [
i64 0, label %4
i64 1, label %6
i64 2, label %8
]
4: ; preds = %2
%5 = tail call i32 @enemy_destroy(i8* %0)
br label %10
6: ; preds = %2
%7 = tail call i32 @projectile_destroy(i8* %0)
br label %10
8: ; preds = %2
%9 = tail call i32 @asteroid_destroy(i8* %0)
br label %10
10: ; preds = %2, %8, %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *);
void gpio_file(char *file, char *pin, char *append) {
  sprintf(file, "%sgpio%s%s", "/sys/class/gpio/", pin, append);
}


x86 assembly (clang, -O0):
<gpio_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xec9(%rip),%rsi
lea    0xecd(%rip),%rdx
call   1030 <sprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpio_file>:
mov    %rdx,%r8
mov    %rsi,%rcx
lea    0xee3(%rip),%rsi
lea    0xee7(%rip),%rdx
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"%sgpio%s%s\00"
@.str.1 = [17 x i8] c"/sys/class/gpio/\00"
define void @gpio_file(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %8, i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"%sgpio%s%s\00"
@.str.1 = [17 x i8] c"/sys/class/gpio/\00"
define void @gpio_file(i8* nocapture writeonly %0, i8* %1, i8* %2) {
%4 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %2)
ret void
}
/* Variables and functions */
int peek32(int);
int uart_txfifo_full(void) { return peek32((0x20201000 + 0x18)) & (1 << 5); }


x86 assembly (clang, -O0):
<uart_txfifo_full>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20201018,%edi
call   1030 <peek32@plt>
and    $0x20,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_txfifo_full>:
push   %rax
mov    $0x20201018,%edi
call   1030 <peek32@plt>
and    $0x20,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @uart_txfifo_full() {
%1 = call i32 @peek32(i32 538972184)
%2 = and i32 %1, 32
ret i32 %2
}

LLVM IR (-O2):
define i32 @uart_txfifo_full() {
%1 = tail call i32 @peek32(i32 538972184)
%2 = and i32 %1, 32
ret i32 %2
}
/* Type definitions */
struct expRex {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ constructorExpRex(struct expRex *);
void destructorExpRex(struct expRex *obj) { constructorExpRex(obj); }


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

x86 assembly (clang, -O2):
<destructorExpRex>:
jmp    1030 <constructorExpRex@plt>

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

LLVM IR (-O2):
%struct.expRex = type { i32 }
define void @destructorExpRex(%struct.expRex* %0) {
%2 = tail call i32 @constructorExpRex(%struct.expRex* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void yield() { printf("yield() called, but not implemented yet!"); }


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

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

LLVM IR (-O0):
@.str = [41 x i8] c"yield() called, but not implemented yet!\00"
define void @yield() {
%1 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"yield() called, but not implemented yet!\00"
define void @yield() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long long, unsigned long long, int);
void printSlot(uint64_t i, int value) {
  unsigned long long m = i * 2 % 60;
  unsigned long long h = i * 2 / 60;
  printf("%3llu:%02llu  %d\n", h, m, value);
}


x86 assembly (clang, -O0):
<printSlot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%ecx
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printSlot>:
mov    %esi,%ecx
lea    (%rdi,%rdi,1),%eax
cltq
imul   $0xffffffff88888889,%rax,%rdx
shr    $0x20,%rdx
lea    (%rdx,%rdi,2),%edx
mov    %edx,%esi
shr    $0x1f,%esi
sar    $0x5,%edx
add    %esi,%edx
imul   $0x3c,%edx,%edx
sub    %edx,%eax
movslq %eax,%rdx
movslq %edi,%rax
imul   $0xffffffff88888889,%rax,%rsi
shr    $0x20,%rsi
add    %esi,%eax
mov    %eax,%esi
shr    $0x1f,%esi
sar    $0x4,%eax
add    %esi,%eax
movslq %eax,%rsi
lea    0xea5(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"%3llu:%02llu %d\0A\00"
define void @printSlot(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = mul nsw i32 %7, 2
%9 = srem i32 %8, 60
%10 = sext i32 %9 to i64
store i64 %10, i64* %5
%11 = load i32, i32* %3
%12 = mul nsw i32 %11, 2
%13 = sdiv i32 %12, 60
%14 = sext i32 %13 to i64
store i64 %14, i64* %6
%15 = load i64, i64* %6
%16 = load i64, i64* %5
%17 = load i32, i32* %4
%18 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %15, i64 %16, i32 %17)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"%3llu:%02llu %d\0A\00"
define void @printSlot(i32 %0, i32 %1) {
%3 = shl nsw i32 %0, 1
%4 = srem i32 %3, 60
%5 = sext i32 %4 to i64
%6 = sdiv i32 %0, 30
%7 = sext i32 %6 to i64
%8 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %7, i64 %5, i32 %1)
ret void
}
int test_imm_07uint64_lowword_reg(unsigned long long val) {
  return ((val) & (0x07 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_07uint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 7
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ SPI1_DisableRxInt();
int /*<<< orphan*/ SPI1_DisableTxInt();
void SPI1_DisableInt(void) {
  SPI1_DisableTxInt();
  SPI1_DisableRxInt();
}


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

x86 assembly (clang, -O2):
<SPI1_DisableInt>:
push   %rax
xor    %eax,%eax
call   1040 <SPI1_DisableTxInt@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <SPI1_DisableRxInt@plt>

LLVM IR (-O0):
define void @SPI1_DisableInt() {
%1 = call i32 (...) @SPI1_DisableTxInt()
%2 = call i32 (...) @SPI1_DisableRxInt()
ret void
}

LLVM IR (-O2):
define void @SPI1_DisableInt() {
%1 = tail call i32 (...) @SPI1_DisableTxInt()
%2 = tail call i32 (...) @SPI1_DisableRxInt()
ret void
}
/* Variables and functions */
long strtol(char const *, void *, int /*<<< orphan*/);
long atol(const char *nptr) { return strtol(nptr, (void *)0, 0); }


x86 assembly (clang, -O0):
<atol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1030 <strtol@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atol>:
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <strtol@plt>

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

LLVM IR (-O2):
define i64 @atol(i8* nocapture %0) {
%2 = tail call i64 @strtol(i8* nocapture %0, i8* null, i32 0)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ _exit(int);
int open(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int open_dev(const char *devname) {
  int fd = -1;
  fd = open(devname, O_RDWR);
  if (fd < 0) {
    perror("open");
    _exit(-1);
  }
  return fd;
}


x86 assembly (clang, -O0):
<open_dev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e9a(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1178 <open_dev+0x48>
lea    0xe97(%rip),%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%edi
call   1030 <_exit@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_dev>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
call   1040 <open@plt>
test   %eax,%eax
js     1145 <open_dev+0x15>
pop    %rcx
ret
lea    0xeb4(%rip),%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@O_RDWR = global i32 0
@.str = [5 x i8] c"open\00"
define i32 @open_dev(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 -1, i32* %3
%4 = load i8*, i8** %2
%5 = load i32, i32* @O_RDWR
%6 = call i32 @open(i8* %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @_exit(i32 -1)
unreachable
12: ; preds = %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@O_RDWR = global i32 0
@.str = [5 x i8] c"open\00"
define i32 @open_dev(i8* nocapture %0) {
%2 = load i32, i32* @O_RDWR
%3 = tail call i32 @open(i8* %0, i32 %2)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @_exit(i32 -1)
unreachable
8: ; preds = %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void print_usage(const char *name) {
  fprintf(stderr, "Usage: %s [-n] file\n", name);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"Usage: %s [-n] file\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"Usage: %s [-n] file\0A\00"
define void @print_usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *default_allocator(size_t size) {
  void *mem = malloc(size);
  return mem;
}


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

x86 assembly (clang, -O2):
<default_allocator>:
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @default_allocator(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
ret i8* %6
}

LLVM IR (-O2):
define noalias i8* @default_allocator(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int read_and_compare();
int /*<<< orphan*/ stderr;
void might_print(const char *flag) {
  if (read_and_compare() == true) {
    fprintf(stderr, "Which was the right password: %s\n", flag);
  } else {
    fputs("Which was wrong..", stderr);
  }
}


x86 assembly (clang, -O0):
<might_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <read_and_compare@plt>
cmp    $0x1,%eax
jne    116a <might_print+0x3a>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xea0(%rip),%rsi
call   1040 <fprintf@plt>
jmp    117f <might_print+0x4f>
mov    0x2e6f(%rip),%rax
mov    (%rax),%esi
lea    0xea8(%rip),%rdi
call   1030 <fputs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<might_print>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <read_and_compare@plt>
mov    0x2e9e(%rip),%rcx
mov    (%rcx),%ecx
cmp    $0x1,%eax
jne    115b <might_print+0x2b>
lea    0xeb0(%rip),%rsi
mov    %ecx,%edi
mov    %rbx,%rdx
pop    %rbx
jmp    1040 <fprintf@plt>
lea    0xec0(%rip),%rdi
mov    %ecx,%esi
pop    %rbx
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"Which was the right password: %s\0A\00"
@.str.1 = [18 x i8] c"Which was wrong..\00"
define void @might_print(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @read_and_compare()
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %2
%8 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %12
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = call i32 @fputs(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %9, %5
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"Which was the right password: %s\0A\00"
@.str.1 = [18 x i8] c"Which was wrong..\00"
define void @might_print(i8* %0) {
%2 = tail call i32 (...) @read_and_compare()
%3 = icmp eq i32 %2, 1
%4 = load i32, i32* @stderr
br i1 %3, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %9
7: ; preds = %1
%8 = tail call i32 @fputs(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %4)
br label %9
9: ; preds = %7, %5
ret void
}
void do_channel_pressure(char pressure) {}


x86 assembly (clang, -O0):
<do_channel_pressure>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @do_channel_pressure(i8 signext %0) {
ret void
}
/* Type definitions */
struct rusage {
  int dummy;
};
typedef int /*<<< orphan*/ __pid_t;

/* Variables and functions */
int /*<<< orphan*/ WAIT_ANY;
int /*<<< orphan*/ __wait4(int /*<<< orphan*/, int *, int /*<<< orphan*/,
                           struct rusage *);
__pid_t __libc_wait(int *stat_loc) {
  return __wait4(WAIT_ANY, stat_loc, 0, (struct rusage *)NULL);
}


x86 assembly (clang, -O0):
<__libc_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
xor    %edx,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <__wait4@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__libc_wait>:
mov    %rdi,%rsi
mov    0x2ece(%rip),%rax
mov    (%rax),%edi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <__wait4@plt>

LLVM IR (-O0):
%struct.rusage = type { i32 }
@WAIT_ANY = global i32 0
define i32 @__libc_wait(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @WAIT_ANY
%4 = load i32*, i32** %2
%5 = call i32 @__wait4(i32 %3, i32* %4, i32 0, %struct.rusage* null)
ret i32 %5
}

LLVM IR (-O2):
%struct.rusage = type { i32 }
@WAIT_ANY = global i32 0
define i32 @__libc_wait(i32* %0) {
%2 = load i32, i32* @WAIT_ANY
%3 = tail call i32 @__wait4(i32 %2, i32* %0, i32 0, %struct.rusage* null)
ret i32 %3
}
void RTS3BucketsDestroy(void) {}


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

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

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

LLVM IR (-O2):
define void @RTS3BucketsDestroy() {
ret void
}
void cnull(c) int c;
{
  c = ulcase(c);
  null(c);
}


x86 assembly (clang, -O0):
<cnull>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <ulcase@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1040 <null@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cnull>:
push   %rax
xor    %eax,%eax
call   1030 <ulcase@plt>
mov    %eax,%edi
xor    %eax,%eax
pop    %rcx
jmp    1040 <null@plt>

LLVM IR (-O0):
define void @cnull(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i32, ...) bitcast (i32 (...)* @ulcase to i32 (i32, ...)*)(i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 (i32, ...) bitcast (i32 (...)* @null to i32 (i32, ...)*)(i32 %5)
ret void
}

LLVM IR (-O2):
define void @cnull(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @ulcase to i32 (i32, ...)*)(i32 %0)
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @null to i32 (i32, ...)*)(i32 %2)
ret void
}
void map2check_load(void *ptr, int size) {}


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

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

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

LLVM IR (-O2):
define void @map2check_load(i8* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ror8addr(int /*<<< orphan*/);
int /*<<< orphan*/ zeropage();
void rorZp8(void) { ror8addr(zeropage()); }


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

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

LLVM IR (-O0):
define void @rorZp8() {
%1 = call i32 (...) @zeropage()
%2 = call i32 @ror8addr(i32 %1)
ret void
}

LLVM IR (-O2):
define void @rorZp8() {
%1 = tail call i32 (...) @zeropage()
%2 = tail call i32 @ror8addr(i32 %1)
ret void
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMRE4_get(void) { return U_WMRCORENONE_get("U_WMRE4"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMRE4\00"
define i32 @U_WMRE4_get() {
%1 = call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMRE4\00"
define i32 @U_WMRE4_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
void marker1(void) {}


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

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

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

LLVM IR (-O2):
define void @marker1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncat(char *, char *, int);
void strncatTest() {
  char str1[20];
  char str2[20];
  strcpy(str1, "To be ");
  strcpy(str2, "or not to be");
  strncat(str1, str2, 8);
  puts(str1);
}


x86 assembly (clang, -O0):
<strncatTest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x20(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x40(%rbp),%rdi
lea    0xeb4(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x8,%edx
call   1050 <strncat@plt>
lea    -0x20(%rbp),%rdi
call   1040 <puts@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncatTest>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0xec2(%rip),%rsi
lea    0x20(%rsp),%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
lea    0xeb5(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1050 <strncat@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"To be \00"
@.str.1 = [13 x i8] c"or not to be\00"
define void @strncatTest() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%9 = call i32 @strncat(i8* %7, i8* %8, i32 8)
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%11 = call i32 @puts(i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"To be \00"
@.str.1 = [13 x i8] c"or not to be\00"
define void @strncatTest() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @strncat(i8* %3, i8* %4, i32 8)
%8 = call i32 @puts(i8* %3)
ret void
}
float degrees(float radians) {
  return radians * (180.0 / 3.14159265358979323846);
}


x86 assembly (clang, -O0):
<degrees>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee6(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<degrees>:
cvtss2sd %xmm0,%xmm0
mulsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @degrees(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fmul double %4, 0x404CA5DC1A63C1F8
%6 = fptrunc double %5 to float
ret float %6
}

LLVM IR (-O2):
define float @degrees(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 0x404CA5DC1A63C1F8
%4 = fptrunc double %3 to float
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ Reverse();
int /*<<< orphan*/ printf(char *);
int main() {
  Reverse();
  printf("\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @Reverse()
%2 = tail call i32 @putchar(i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ search(int);
int main(int argc, char *argv[]) {
  printf("10: %ld\n", search(10));
  printf("20: %ld\n", search(20));
  return 1;
}


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    $0xa,%edi
call   1040 <search@plt>
mov    %eax,%esi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
mov    $0x14,%edi
call   1040 <search@plt>
mov    %eax,%esi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1040 <search@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x14,%edi
call   1040 <search@plt>
lea    0xebf(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"10: %ld\0A\00"
@.str.1 = [9 x i8] c"20: %ld\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 @search(i32 10)
%7 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @search(i32 20)
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 1
}

LLVM IR (-O2):
@.str = [9 x i8] c"10: %ld\0A\00"
@.str.1 = [9 x i8] c"20: %ld\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @search(i32 10)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @search(i32 20)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ fh_cli_lmove(int *, int);
int /*<<< orphan*/ fh_cli_prompt();
int /*<<< orphan*/ fh_cli_write(char *, char *);
void fh_cli_reset(char *cmd, int cmd_len, int pos) {
  int tmp_pos = cmd_len;
  fh_cli_prompt();
  fh_cli_write("%s", cmd);
  fh_cli_lmove(&tmp_pos, cmd_len - pos);
}


x86 assembly (clang, -O0):
<fh_cli_reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <fh_cli_prompt@plt>
mov    -0x8(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1040 <fh_cli_write@plt>
mov    -0xc(%rbp),%esi
sub    -0x10(%rbp),%esi
lea    -0x14(%rbp),%rdi
call   1050 <fh_cli_lmove@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fh_cli_reset>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %esi,0xc(%rsp)
xor    %eax,%eax
call   1030 <fh_cli_prompt@plt>
lea    0xeae(%rip),%rdi
mov    %rbx,%rsi
call   1040 <fh_cli_write@plt>
sub    %r14d,%ebp
lea    0xc(%rsp),%rdi
mov    %ebp,%esi
call   1050 <fh_cli_lmove@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @fh_cli_reset(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
store i32 %8, i32* %7
%9 = call i32 (...) @fh_cli_prompt()
%10 = load i8*, i8** %4
%11 = call i32 @fh_cli_write(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = sub nsw i32 %12, %13
%15 = call i32 @fh_cli_lmove(i32* %7, i32 %14)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @fh_cli_reset(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
store i32 %1, i32* %4
%6 = tail call i32 (...) @fh_cli_prompt()
%7 = tail call i32 @fh_cli_write(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = sub nsw i32 %1, %2
%9 = call i32 @fh_cli_lmove(i32* %4, i32 %8)
ret void
}
void event_dispatcher_worker() {}


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

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

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

LLVM IR (-O2):
define void @event_dispatcher_worker() {
ret void
}
/* Variables and functions */
long double __infer_nondet_long_double();
long double fmodl(long double x, long double y) {
  return __infer_nondet_long_double();
}


x86 assembly (clang, -O0):
<fmodl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
xor    %eax,%eax
call   1030 <__infer_nondet_long_double@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define x86_fp80 @fmodl(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %3
store x86_fp80 %1, x86_fp80* %4
%5 = call x86_fp80 (...) @__infer_nondet_long_double()
ret x86_fp80 %5
}

LLVM IR (-O2):
define x86_fp80 @fmodl(x86_fp80 %0, x86_fp80 %1) {
%3 = tail call x86_fp80 (...) @__infer_nondet_long_double()
ret x86_fp80 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ GLint;
typedef int /*<<< orphan*/ GLenum;

/* Variables and functions */
int /*<<< orphan*/ __glGetTexLevelParameterfv_size(int /*<<< orphan*/);
GLint __glGetTexLevelParameteriv_size(GLenum pname) {
  return __glGetTexLevelParameterfv_size(pname);
}


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

x86 assembly (clang, -O2):
<__glGetTexLevelParameteriv_size>:
jmp    1030 <__glGetTexLevelParameterfv_size@plt>

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

LLVM IR (-O2):
define i32 @__glGetTexLevelParameteriv_size(i32 %0) {
%2 = tail call i32 @__glGetTexLevelParameterfv_size(i32 %0)
ret i32 %2
}
/* Variables and functions */
void *malloc(unsigned long);
void *my_malloc(unsigned long bytes) { return malloc(bytes); }


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

x86 assembly (clang, -O2):
<my_malloc>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @my_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
/* Variables and functions */
int strcmp(char const *, char const *);
int strcoll(const char *stra, const char *strb) { return strcmp(stra, strb); }


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

x86 assembly (clang, -O2):
<strcoll>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @strcoll(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
void foo058() {}


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

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

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

LLVM IR (-O2):
define void @foo058() {
ret void
}
int isPrime(int n) {
  int i = 2;
  for (i; i < n; i++) {
    if (n % i == 0) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<isPrime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1149 <isPrime+0x49>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1136 <isPrime+0x36>
movl   $0x0,-0x4(%rbp)
jmp    1150 <isPrime+0x50>
jmp    113b <isPrime+0x3b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <isPrime+0xe>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPrime>:
mov    $0x1,%ecx
cmp    $0x3,%edi
jl     1120 <isPrime+0x20>
mov    $0x2,%esi
nop
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1123 <isPrime+0x23>
add    $0x1,%esi
cmp    %esi,%edi
jne    1110 <isPrime+0x10>
mov    %ecx,%eax
ret
xor    %ecx,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @isPrime(i32 %0) {
%2 = icmp sgt i32 %0, 2
br i1 %2, label %5, label %10
3: ; preds = %5
%4 = icmp eq i32 %9, %0
br i1 %4, label %10, label %5
5: ; preds = %1, %3
%6 = phi i32 [ %9, %3 ], [ 2, %1 ]
%7 = srem i32 %0, %6
%8 = icmp eq i32 %7, 0
%9 = add nuw nsw i32 %6, 1
br i1 %8, label %10, label %3
10: ; preds = %5, %3, %1
%11 = phi i32 [ 1, %1 ], [ 1, %3 ], [ 0, %5 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hdl_sys1(int n) { printf("hdl_sys1: Signal recu: message1\n"); }


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

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

LLVM IR (-O0):
@.str = [33 x i8] c"hdl_sys1: Signal recu: message1\0A\00"
define void @hdl_sys1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [32 x i8] c"hdl_sys1: Signal recu: message1\00"
define void @hdl_sys1(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
size_t list_meter_int64_t(const void *el) {
  if (el) {
  }
  return sizeof(int64_t);
}


x86 assembly (clang, -O0):
<list_meter_int64_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1118 <list_meter_int64_t+0x18>
jmp    1118 <list_meter_int64_t+0x18>
mov    $0x4,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @list_meter_int64_t(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %6
5: ; preds = %1
br label %6
6: ; preds = %5, %1
ret i64 4
}

LLVM IR (-O2):
define i64 @list_meter_int64_t(i8* nocapture readnone %0) {
ret i64 4
}
void e(long long *f, int p2) { *f = p2; }


x86 assembly (clang, -O0):
<e>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movslq -0xc(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @e(i64* nocapture writeonly %0, i32 %1) {
%3 = sext i32 %1 to i64
store i64 %3, i64* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ VIM_SIF_I2cWriteByte(unsigned char, unsigned char);
void SensorSetReg_OV7649(unsigned short uAddr, unsigned short uVal) {
  VIM_SIF_I2cWriteByte((unsigned char)uAddr, (unsigned char)uVal);
}


x86 assembly (clang, -O0):
<SensorSetReg_OV7649>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x2(%rbp),%ax
mov    %al,%cl
mov    -0x4(%rbp),%ax
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <VIM_SIF_I2cWriteByte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SensorSetReg_OV7649>:
movzbl %dil,%edi
movzbl %sil,%esi
jmp    1030 <VIM_SIF_I2cWriteByte@plt>

LLVM IR (-O0):
define void @SensorSetReg_OV7649(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = trunc i16 %5 to i8
%7 = load i16, i16* %4
%8 = trunc i16 %7 to i8
%9 = call i32 @VIM_SIF_I2cWriteByte(i8 zeroext %6, i8 zeroext %8)
ret void
}

LLVM IR (-O2):
define void @SensorSetReg_OV7649(i16 zeroext %0, i16 zeroext %1) {
%3 = trunc i16 %0 to i8
%4 = trunc i16 %1 to i8
%5 = tail call i32 @VIM_SIF_I2cWriteByte(i8 zeroext %3, i8 zeroext %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int sprintf(char *, char *, double);
int fieldwidth_double(double val, unsigned int precision) {
  char format[10];
  char buf[0x200];
  if (precision > 999999)
    abort();
  sprintf(format, "%%.%uf", precision);
  return sprintf(buf, format, val);
}


x86 assembly (clang, -O0):
<fieldwidth_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
cmpl   $0xf423f,-0xc(%rbp)
jbe    1147 <fieldwidth_double+0x27>
mov    $0x0,%al
call   1030 <abort@plt>
lea    -0x16(%rbp),%rdi
mov    -0xc(%rbp),%eax
cvtsi2sd %rax,%xmm0
lea    0xea6(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x220(%rbp),%rdi
lea    -0x16(%rbp),%rsi
movsd  -0x8(%rbp),%xmm0
call   1040 <sprintf@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fieldwidth_double>:
push   %rbx
sub    $0x220,%rsp
movsd  %xmm0,0x8(%rsp)
cmp    $0xf4240,%edi
jae    1170 <fieldwidth_double+0x50>
mov    %edi,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
lea    0xeb9(%rip),%rsi
lea    0x16(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
lea    0x20(%rsp),%rdi
mov    %rbx,%rsi
movsd  0x8(%rsp),%xmm0
call   1040 <sprintf@plt>
add    $0x220,%rsp
pop    %rbx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%%.%uf\00"
define i32 @fieldwidth_double(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca [10 x i8]
%6 = alloca [512 x i8]
store double %0, double* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = icmp ugt i32 %7, 999999
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %2
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%13 = load i32, i32* %4
%14 = uitofp i32 %13 to double
%15 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %14)
%16 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%18 = load double, double* %3
%19 = call i32 @sprintf(i8* %16, i8* %17, double %18)
ret i32 %19
}

LLVM IR (-O2):
@.str = [7 x i8] c"%%.%uf\00"
define i32 @fieldwidth_double(double %0, i32 %1) {
%3 = alloca [10 x i8]
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%7 = icmp ugt i32 %1, 999999
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %2
%11 = uitofp i32 %1 to double
%12 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %11)
%13 = call i32 @sprintf(i8* %6, i8* %5, double %0)
ret i32 %13
}