xunge/DecIR huggingface dataset:
/* Variables and functions */
char *calloc(int, unsigned int);
int /*<<< orphan*/ fatal(char *);
char *getcore(unsigned size) {
  char *retptr;
  retptr = calloc(1, size);
  if (!retptr)
    fatal("Out of memory");
  return retptr;
}


x86 assembly (clang, -O0):
<getcore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0x1,%edi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1153 <getcore+0x33>
lea    0xeb2(%rip),%rdi
call   1040 <fatal@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getcore>:
push   %rbx
mov    %edi,%esi
mov    $0x1,%edi
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1141 <getcore+0x21>
lea    0xec4(%rip),%rdi
call   1040 <fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Out of memory\00"
define i8* @getcore(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @calloc(i32 1, i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @fatal(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [14 x i8] c"Out of memory\00"
define noalias i8* @getcore(i32 %0) {
%2 = tail call i8* @calloc(i32 1, i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @fatal(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ set_uint16(int *, int);
void set_uint32(uint8_t *p, uint32_t v) {
  set_uint16(p, v & 0xffff);
  p[2] = (v >> 16) & 0xff;
  p[3] = (uint8_t)((v >> 24) & 0xff);
}


x86 assembly (clang, -O0):
<set_uint32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
and    $0xffff,%esi
call   1030 <set_uint16@plt>
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_uint32>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
movzwl %bx,%esi
call   1030 <set_uint16@plt>
mov    %ebx,%eax
shr    $0x10,%eax
movzbl %al,%eax
mov    %eax,0x8(%r14)
shr    $0x18,%ebx
mov    %ebx,0xc(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @set_uint32(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 = and i32 %6, 65535
%8 = call i32 @set_uint16(i32* %5, i32 %7)
%9 = load i32, i32* %4
%10 = ashr i32 %9, 16
%11 = and i32 %10, 255
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 2
store i32 %11, i32* %13
%14 = load i32, i32* %4
%15 = ashr i32 %14, 24
%16 = and i32 %15, 255
%17 = load i32*, i32** %3
%18 = getelementptr inbounds i32, i32* %17, i64 3
store i32 %16, i32* %18
ret void
}

LLVM IR (-O2):
define void @set_uint32(i32* %0, i32 %1) {
%3 = and i32 %1, 65535
%4 = tail call i32 @set_uint16(i32* %0, i32 %3)
%5 = lshr i32 %1, 16
%6 = and i32 %5, 255
%7 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %6, i32* %7
%8 = lshr i32 %1, 24
%9 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %8, i32* %9
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int textfit(char const *, int /*<<< orphan*/, int);
int textfit_near(const char *str, uint16_t length, int width) {
  return textfit(str, length, width);
}


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

x86 assembly (clang, -O2):
<textfit_near>:
jmp    1030 <textfit@plt>

LLVM IR (-O0):
define i32 @textfit_near(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @textfit(i8* %7, i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @textfit_near(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @textfit(i8* %0, i32 %1, i32 %2)
ret i32 %4
}
int min_heap_extract_min(int *list[]) {}


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

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

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

LLVM IR (-O2):
define i32 @min_heap_extract_min(i32** nocapture readnone %0) {
ret i32 undef
}
/* Variables and functions */
void *calloc(unsigned int, int);
void *osMalloc(unsigned int l) { return calloc(l, 1); }


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

x86 assembly (clang, -O2):
<osMalloc>:
mov    $0x1,%esi
jmp    1030 <calloc@plt>

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

LLVM IR (-O2):
define noalias i8* @osMalloc(i32 %0) {
%2 = tail call i8* @calloc(i32 %0, i32 1)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ event_free_memory();
void eventlist_free_memory() { event_free_memory(); }


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

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

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

LLVM IR (-O2):
define void @eventlist_free_memory() {
%1 = tail call i32 (...) @event_free_memory()
ret void
}
void backface_(onoff) int *onoff;
{ backface(*onoff); }


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

x86 assembly (clang, -O2):
<backface_>:
mov    (%rdi),%edi
xor    %eax,%eax
jmp    1030 <backface@plt>

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

LLVM IR (-O2):
define void @backface_(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @backface to i32 (i32, ...)*)(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void userCommand_L1_exit(char **givenData) { exit(0); }


x86 assembly (clang, -O0):
<userCommand_L1_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<userCommand_L1_exit>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @userCommand_L1_exit(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @userCommand_L1_exit(i8** nocapture readnone %0) {
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
void __ashrdi3(int64_t a, unsigned int b) {}


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

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

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

LLVM IR (-O2):
define void @__ashrdi3(i32 %0, i32 %1) {
ret void
}
panic(str, argv) char *str;
int argv;
{
  write(2, str, strlen(str));
  exit(1);
}


x86 assembly (clang, -O0):
<panic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rsi
mov    %rax,%rdx
mov    $0x2,%edi
mov    $0x0,%al
call   1030 <write@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<panic>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <write@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
define i32 @panic(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 2, i8* %5, i64 %7)
unreachable
}

LLVM IR (-O2):
define i32 @panic(i8* %0, i32 %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 2, i8* %0, i64 %3)
tail call void @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ reset_table();
void Reset_Hash_Table() { reset_table(); }


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

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

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

LLVM IR (-O2):
define void @Reset_Hash_Table() {
%1 = tail call i32 (...) @reset_table()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void DMA2_Stream0_IRQHandler() { default_handler(); }


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

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

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

LLVM IR (-O2):
define weak void @DMA2_Stream0_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
int get_size_ploop(struct mosaic *m, struct volume *t,
                   unsigned long *size_in_blocks) {
  return -1;
}


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

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

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

LLVM IR (-O2):
%struct.mosaic = type opaque
%struct.volume = type opaque
define i32 @get_size_ploop(%struct.mosaic* nocapture readnone %0, %struct.volume* nocapture readnone %1, i64* nocapture readnone %2) {
ret i32 -1
}
void watchdog_start(void) {}


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

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

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

LLVM IR (-O2):
define void @watchdog_start() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ListFinish();
int /*<<< orphan*/ OutputCode();
char *OutputError();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void ProduceOutput(void) {
  ListFinish();
  if (!OutputCode()) {
    fprintf(stderr, "%s\n", OutputError());
  }
}


x86 assembly (clang, -O0):
<ProduceOutput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <ListFinish@plt>
mov    $0x0,%al
call   1050 <OutputCode@plt>
cmp    $0x0,%eax
jne    1184 <ProduceOutput+0x44>
mov    0x2e7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <OutputError@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rdx
lea    0xe81(%rip),%rsi
call   1060 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ProduceOutput>:
push   %rbx
xor    %eax,%eax
call   1040 <ListFinish@plt>
xor    %eax,%eax
call   1050 <OutputCode@plt>
test   %eax,%eax
je     1155 <ProduceOutput+0x15>
pop    %rbx
ret
mov    0x2e84(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1030 <OutputError@plt>
lea    0xe94(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
pop    %rbx
jmp    1060 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @ProduceOutput() {
%1 = call i32 (...) @ListFinish()
%2 = call i32 (...) @OutputCode()
%3 = icmp ne i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = call i8* (...) @OutputError()
%7 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %4, %0
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @ProduceOutput() {
%1 = tail call i32 (...) @ListFinish()
%2 = tail call i32 (...) @OutputCode()
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = tail call i8* (...) @OutputError()
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %4, %0
ret void
}
/* Variables and functions */
int socketpair(int, int, int, int *);
int evutil_socketpair(int family, int type, int protocol, int fd[2]) {
  return socketpair(family, type, protocol, fd);
}


x86 assembly (clang, -O0):
<evutil_socketpair>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
call   1030 <socketpair@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evutil_socketpair>:
jmp    1030 <socketpair@plt>

LLVM IR (-O0):
define i32 @evutil_socketpair(i32 %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32*, i32** %8
%13 = call i32 @socketpair(i32 %9, i32 %10, i32 %11, i32* %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @evutil_socketpair(i32 %0, i32 %1, i32 %2, i32* %3) {
%5 = tail call i32 @socketpair(i32 %0, i32 %1, i32 %2, i32* %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ txt_ctrd(char *, char);
void show_hint(int hint) {
  if (hint == -1) {
    txt_ctrd("Try more !", '\n');
  } else if (hint == 1) {
    txt_ctrd("Try less !", '\n');
  }
}


x86 assembly (clang, -O0):
<show_hint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    113b <show_hint+0x2b>
lea    0xed4(%rip),%rdi
mov    $0xa,%esi
call   1030 <txt_ctrd@plt>
jmp    115b <show_hint+0x4b>
cmpl   $0x1,-0x4(%rbp)
jne    1156 <show_hint+0x46>
lea    0xebf(%rip),%rdi
mov    $0xa,%esi
call   1030 <txt_ctrd@plt>
jmp    115b <show_hint+0x4b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_hint>:
cmp    $0xffffffff,%edi
je     112b <show_hint+0x1b>
cmp    $0x1,%edi
jne    113c <show_hint+0x2c>
lea    0xeea(%rip),%rdi
mov    $0xa,%esi
jmp    1030 <txt_ctrd@plt>
lea    0xece(%rip),%rdi
mov    $0xa,%esi
jmp    1030 <txt_ctrd@plt>
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Try more !\00"
@.str.1 = [11 x i8] c"Try less !\00"
define void @show_hint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @txt_ctrd(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8 signext 10)
br label %13
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @txt_ctrd(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8 signext 10)
br label %12
12: ; preds = %10, %7
br label %13
13: ; preds = %12, %5
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"Try more !\00"
@.str.1 = [11 x i8] c"Try less !\00"
define void @show_hint(i32 %0) {
switch i32 %0, label %6 [
i32 -1, label %3
i32 1, label %2
]
2: ; preds = %1
br label %3
3: ; preds = %1, %2
%4 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %1 ]
%5 = tail call i32 @txt_ctrd(i8* %4, i8 signext 10)
br label %6
6: ; preds = %3, %1
ret void
}
/* Variables and functions */
void Default_SecureFault_Handler(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<Default_SecureFault_Handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <Default_SecureFault_Handler+0x9>
jmp    1109 <Default_SecureFault_Handler+0x9>

x86 assembly (clang, -O2):
<Default_SecureFault_Handler>:
jmp    1100 <Default_SecureFault_Handler>

LLVM IR (-O0):
define void @Default_SecureFault_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @Default_SecureFault_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
char *strcpy(char *dstp, const char *srcp) {
  char *dp = dstp;
  if (!dstp)
    return (0);
  *dp = 0;
  if (!srcp)
    return (dstp);
  while ((*dp++ = *srcp++) != 0)
    ;
  return (dstp);
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    112c <strcpy+0x2c>
movq   $0x0,-0x8(%rbp)
jmp    118b <strcpy+0x8b>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
cmpq   $0x0,-0x18(%rbp)
jne    114b <strcpy+0x4b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    118b <strcpy+0x8b>
jmp    1150 <strcpy+0x50>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%al
mov    -0x20(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     1183 <strcpy+0x83>
jmp    1150 <strcpy+0x50>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
test   %rdi,%rdi
je     112f <strcpy+0x2f>
movb   $0x0,(%rax)
test   %rsi,%rsi
je     112f <strcpy+0x2f>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1120 <strcpy+0x20>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* writeonly %0, i8* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %13, label %4
4: ; preds = %2
store i8 0, i8* %0
%5 = icmp eq i8* %1, null
br i1 %5, label %13, label %6
6: ; preds = %4, %6
%7 = phi i8* [ %9, %6 ], [ %1, %4 ]
%8 = phi i8* [ %11, %6 ], [ %0, %4 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = load i8, i8* %7
%11 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %10, i8* %8
%12 = icmp eq i8 %10, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %4, %2
ret i8* %0
}
float normalizef(const float in_S) {
  float result = 0;
  result = (in_S < 0) ? -1 : result;
  result = (in_S > 0) ? 1 : result;
  return result;
}


x86 assembly (clang, -O0):
<normalizef>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1130 <normalizef+0x30>
movss  0xeda(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    113a <normalizef+0x3a>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1167 <normalizef+0x67>
movss  0xea7(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1171 <normalizef+0x71>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalizef>:
xorps  %xmm1,%xmm1
movaps %xmm0,%xmm2
cmpltss %xmm1,%xmm2
movss  0xeed(%rip),%xmm3
andps  %xmm2,%xmm3
cmpltss %xmm0,%xmm1
movss  0xee1(%rip),%xmm0
andps  %xmm1,%xmm0
andnps %xmm3,%xmm1
orps   %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @normalizef(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
store float 0.000000e+00, float* %3
%4 = load float, float* %2
%5 = fcmp olt float %4, 0.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %1
br label %9
7: ; preds = %1
%8 = load float, float* %3
br label %9
9: ; preds = %7, %6
%10 = phi float [ -1.000000e+00, %6 ], [ %8, %7 ]
store float %10, float* %3
%11 = load float, float* %2
%12 = fcmp ogt float %11, 0.000000e+00
br i1 %12, label %13, label %14
13: ; preds = %9
br label %16
14: ; preds = %9
%15 = load float, float* %3
br label %16
16: ; preds = %14, %13
%17 = phi float [ 1.000000e+00, %13 ], [ %15, %14 ]
store float %17, float* %3
%18 = load float, float* %3
ret float %18
}

LLVM IR (-O2):
define float @normalizef(float %0) {
%2 = fcmp olt float %0, 0.000000e+00
%3 = select i1 %2, float -1.000000e+00, float 0.000000e+00
%4 = fcmp ogt float %0, 0.000000e+00
%5 = select i1 %4, float 1.000000e+00, float %3
ret float %5
}
void d_storeub(register unsigned char **ptr, register unsigned char data) {
  *(*ptr)++ = data;
}


x86 assembly (clang, -O0):
<d_storeub>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_storeub>:
mov    (%rdi),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rdi)
mov    %sil,(%rax)
ret

LLVM IR (-O0):
define void @d_storeub(i8** %0, i8 zeroext %1) {
%3 = alloca i8**
%4 = alloca i8
store i8** %0, i8*** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
%8 = getelementptr inbounds i8, i8* %7, i32 1
store i8* %8, i8** %6
store i8 %5, i8* %7
ret void
}

LLVM IR (-O2):
define void @d_storeub(i8** nocapture %0, i8 zeroext %1) {
%3 = load i8*, i8** %0
%4 = getelementptr inbounds i8, i8* %3, i64 1
store i8* %4, i8** %0
store i8 %1, i8* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ copy(char *);
int main(int argc, char **argv) {
  if (argc > 1) {
    copy(argv[1]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    113d <main+0x2d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <copy@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x2,%edi
jl     1123 <main+0x13>
push   %rax
mov    0x8(%rsi),%rdi
call   1030 <copy@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

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 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @copy(i8* %11)
br label %13
13: ; preds = %8, %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @copy(i8* %6)
br label %8
8: ; preds = %4, %2
ret i32 0
}
int test_imm_75uint16_reg(unsigned short val) {
  return ((val) & (0x75 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_75uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x75,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_75uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 117
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void FCEUI_SaveSnapshot(void) {}


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

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

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

LLVM IR (-O2):
define void @FCEUI_SaveSnapshot() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void usage() {
  fprintf(stdout, "USAGE:\n"
                  "  klogripper --live\n"
                  "  klogripper --help\n"
                  "  klogripper --version\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@stdout = global i32 0
@.str = [71 x i8] c"USAGE:\0A klogripper --live\0A klogripper --help\0A klogripper --version\0A\00"
define void @usage() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [71 x i8] c"USAGE:\0A klogripper --live\0A klogripper --help\0A klogripper --version\0A\00"
define void @usage() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct mtwist_state {
  int dummy;
};

/* Variables and functions */
int mtwist_next(struct mtwist_state *);
char random_letter(struct mtwist_state *mt) {
  int x = mtwist_next(mt) % 26 + 'A';
  return (char)x;
}


x86 assembly (clang, -O0):
<random_letter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mtwist_next@plt>
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x41,%edx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_letter>:
push   %rax
call   1030 <mtwist_next@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x41,%al
pop    %rcx
ret

LLVM IR (-O0):
%struct.mtwist_state = type { i32 }
define signext i8 @random_letter(%struct.mtwist_state* %0) {
%2 = alloca %struct.mtwist_state*
%3 = alloca i32
store %struct.mtwist_state* %0, %struct.mtwist_state** %2
%4 = load %struct.mtwist_state*, %struct.mtwist_state** %2
%5 = call i32 @mtwist_next(%struct.mtwist_state* %4)
%6 = srem i32 %5, 26
%7 = add nsw i32 %6, 65
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = trunc i32 %8 to i8
ret i8 %9
}

LLVM IR (-O2):
%struct.mtwist_state = type { i32 }
define signext i8 @random_letter(%struct.mtwist_state* %0) {
%2 = tail call i32 @mtwist_next(%struct.mtwist_state* %0)
%3 = srem i32 %2, 26
%4 = trunc i32 %3 to i8
%5 = add nsw i8 %4, 65
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ test_upper_bound();
int main() {
  test_upper_bound();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_upper_bound@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_upper_bound()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_upper_bound()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char *);
void display_args(int argc, char **argv) {
  int i;
  for (i = 0; i < argc; i++) {
    printf("argv[%d]=\"%s\"\n", i, argv[i]);
  }
}


x86 assembly (clang, -O0):
<display_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115b <display_args+0x4b>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <display_args+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_args>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1147 <display_args+0x37>
mov    %rsi,%r14
mov    %edi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdx
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <display_args+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"argv[%d]=\22%s\22\0A\00"
define void @display_args(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %5
br label %6
6: ; preds = %18, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %21
10: ; preds = %6
%11 = load i32, i32* %5
%12 = load i8**, i8*** %4
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
%17 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %11, i8* %16)
br label %18
18: ; preds = %10
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"argv[%d]=\22%s\22\0A\00"
define void @display_args(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = trunc i64 %7 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %10, i8* %9)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret void
}
/* Variables and functions */
double RAND_MAX;
scalar_t__ rand();
int calculate_probability(float probability) {
  float myrand;
  myrand = (double)rand() / RAND_MAX;
  if (myrand > probability) {
    return 1;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<calculate_probability>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2eb8(%rip),%rax
divsd  (%rax),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1158 <calculate_probability+0x48>
movl   $0x1,-0x4(%rbp)
jmp    115f <calculate_probability+0x4f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_probability>:
push   %rax
movss  %xmm0,0x4(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mov    0x2ebb(%rip),%rax
divsd  (%rax),%xmm0
cvtsd2ss %xmm0,%xmm0
xor    %eax,%eax
ucomiss 0x4(%rsp),%xmm0
seta   %al
pop    %rcx
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define i32 @calculate_probability(float %0) {
%2 = alloca i32
%3 = alloca float
%4 = alloca float
store float %0, float* %3
%5 = call i64 (...) @rand()
%6 = sitofp i64 %5 to double
%7 = load double, double* @RAND_MAX
%8 = fdiv double %6, %7
%9 = fptrunc double %8 to float
store float %9, float* %4
%10 = load float, float* %4
%11 = load float, float* %3
%12 = fcmp ogt float %10, %11
br i1 %12, label %13, label %14
13: ; preds = %1
store i32 1, i32* %2
br label %15
14: ; preds = %1
store i32 0, i32* %2
br label %15
15: ; preds = %14, %13
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define i32 @calculate_probability(float %0) {
%2 = tail call i64 (...) @rand()
%3 = sitofp i64 %2 to double
%4 = load double, double* @RAND_MAX
%5 = fdiv double %3, %4
%6 = fptrunc double %5 to float
%7 = fcmp ogt float %6, %0
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
struct Shape1 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ draw(struct Shape1 *);
int f(struct Shape1 *pp) { draw(pp); }


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

x86 assembly (clang, -O2):
<f>:
jmp    1030 <draw@plt>

LLVM IR (-O0):
%struct.Shape1 = type { i32 }
define i32 @f(%struct.Shape1* %0) {
%2 = alloca i32
%3 = alloca %struct.Shape1*
store %struct.Shape1* %0, %struct.Shape1** %3
%4 = load %struct.Shape1*, %struct.Shape1** %3
%5 = call i32 @draw(%struct.Shape1* %4)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
%struct.Shape1 = type { i32 }
define i32 @f(%struct.Shape1* %0) {
%2 = tail call i32 @draw(%struct.Shape1* %0)
ret i32 undef
}
void gtk_draw_insertion_cursor() {}


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

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

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

LLVM IR (-O2):
define void @gtk_draw_insertion_cursor() {
ret void
}
/* Variables and functions */
double HRT_GetTimingMMS(int);
double HRT_GetTimingMS(int TimerID) {
  return HRT_GetTimingMMS(TimerID) * 0.001;
}


x86 assembly (clang, -O0):
<HRT_GetTimingMS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <HRT_GetTimingMMS@plt>
movsd  0xed5(%rip),%xmm1
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HRT_GetTimingMS>:
push   %rax
call   1030 <HRT_GetTimingMMS@plt>
mulsd  0xee2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @HRT_GetTimingMS(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call double @HRT_GetTimingMMS(i32 %3)
%5 = fmul double %4, 1.000000e-03
ret double %5
}

LLVM IR (-O2):
define double @HRT_GetTimingMS(i32 %0) {
%2 = tail call double @HRT_GetTimingMMS(i32 %0)
%3 = fmul double %2, 1.000000e-03
ret double %3
}
void foo711(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo711(i32 %0) {
ret void
}
/* Variables and functions */
void *c_calloc(int, size_t);
void *c_malloc(size_t size) {
  if (size == 0) {
    return NULL;
  }
  return c_calloc(1, size);
}


x86 assembly (clang, -O0):
<c_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <c_malloc+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1146 <c_malloc+0x36>
mov    -0x10(%rbp),%rsi
mov    $0x1,%edi
call   1030 <c_calloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_malloc>:
test   %rdi,%rdi
je     1122 <c_malloc+0x12>
mov    %rdi,%rsi
mov    $0x1,%edi
jmp    1030 <c_calloc@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @c_malloc(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* null, i8** %2
br label %10
7: ; preds = %1
%8 = load i64, i64* %3
%9 = call i8* @c_calloc(i32 1, i64 %8)
store i8* %9, i8** %2
br label %10
10: ; preds = %7, %6
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
define i8* @c_malloc(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i8* @c_calloc(i32 1, i64 %0)
br label %5
5: ; preds = %1, %3
%6 = phi i8* [ %4, %3 ], [ null, %1 ]
ret i8* %6
}
unsigned int ioread32(unsigned short port) {
  unsigned int v;
  __asm__ __volatile__("inl %1, %0" : "=a"(v) : "d"(port));
  return v;
}


x86 assembly (clang, -O0):
<ioread32>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ioread32>:
mov    %edi,%edx
in     (%dx),%eax
ret

LLVM IR (-O0):
define i32 @ioread32(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i32
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i32 asm sideeffect "inl $1, $0", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @ioread32(i16 zeroext %0) {
%2 = tail call i32 asm sideeffect "inl $1, $0", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ addbyte(int);
int /*<<< orphan*/ addlong(int /*<<< orphan*/);
void SUB_HOST_REG_IMM(int host_reg, uint32_t imm) {
  if (host_reg & 8)
    addbyte(0x41);
  addbyte(0x81);
  addbyte(0xE8 | (host_reg & 7));
  addlong(imm);
}


x86 assembly (clang, -O0):
<SUB_HOST_REG_IMM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     1147 <SUB_HOST_REG_IMM+0x27>
mov    $0x41,%edi
call   1040 <addbyte@plt>
mov    $0x81,%edi
call   1040 <addbyte@plt>
mov    -0x4(%rbp),%edi
and    $0x7,%edi
or     $0xe8,%edi
call   1040 <addbyte@plt>
mov    -0x8(%rbp),%edi
call   1030 <addlong@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SUB_HOST_REG_IMM>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
test   $0x8,%bpl
je     1137 <SUB_HOST_REG_IMM+0x17>
mov    $0x41,%edi
call   1040 <addbyte@plt>
mov    $0x81,%edi
call   1040 <addbyte@plt>
and    $0x7,%ebp
or     $0xe8,%ebp
mov    %ebp,%edi
call   1040 <addbyte@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <addlong@plt>

LLVM IR (-O0):
define void @SUB_HOST_REG_IMM(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 = and i32 %5, 8
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @addbyte(i32 65)
br label %10
10: ; preds = %8, %2
%11 = call i32 @addbyte(i32 129)
%12 = load i32, i32* %3
%13 = and i32 %12, 7
%14 = or i32 232, %13
%15 = call i32 @addbyte(i32 %14)
%16 = load i32, i32* %4
%17 = call i32 @addlong(i32 %16)
ret void
}

LLVM IR (-O2):
define void @SUB_HOST_REG_IMM(i32 %0, i32 %1) {
%3 = and i32 %0, 8
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @addbyte(i32 65)
br label %7
7: ; preds = %5, %2
%8 = tail call i32 @addbyte(i32 129)
%9 = and i32 %0, 7
%10 = or i32 %9, 232
%11 = tail call i32 @addbyte(i32 %10)
%12 = tail call i32 @addlong(i32 %1)
ret void
}
int cmp(const void *_a, const void *_b) {
  long int a = (long int)_a;
  long int b = (long int)_b;
  return (a > b ? (-1) : (1));
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rsi
mov    $0x1,%eax
mov    $0xffffffff,%ecx
cmp    %rsi,%rdx
cmovg  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
xor    %eax,%eax
cmp    %rsi,%rdi
setle  %al
add    %eax,%eax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = ptrtoint i8* %7 to i64
store i64 %8, i64* %5
%9 = load i8*, i8** %4
%10 = ptrtoint i8* %9 to i64
store i64 %10, i64* %6
%11 = load i64, i64* %5
%12 = load i64, i64* %6
%13 = icmp sgt i64 %11, %12
%14 = zext i1 %13 to i64
%15 = select i1 %13, i32 -1, i32 1
ret i32 %15
}

LLVM IR (-O2):
define i32 @cmp(i8* readnone %0, i8* readnone %1) {
%3 = icmp sgt i8* %0, %1
%4 = select i1 %3, i32 -1, i32 1
ret i32 %4
}
/* Type definitions */
struct rusage {
  long ru_maxrss;
};

/* Variables and functions */
int RUSAGE_SELF;
int getrusage(int, struct rusage *);
long queryMaxResidentSize() {
  int who = RUSAGE_SELF;
  struct rusage usage;
  int ret;
  ret = getrusage(who, &usage);
  return usage.ru_maxrss;
}


x86 assembly (clang, -O0):
<queryMaxResidentSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1030 <getrusage@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<queryMaxResidentSize>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <getrusage@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.rusage = type { i64 }
@RUSAGE_SELF = global i32 0
define i64 @queryMaxResidentSize() {
%1 = alloca i32
%2 = alloca %struct.rusage
%3 = alloca i32
%4 = load i32, i32* @RUSAGE_SELF
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = call i32 @getrusage(i32 %5, %struct.rusage* %2)
store i32 %6, i32* %3
%7 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i32 0, i32 0
%8 = load i64, i64* %7
ret i64 %8
}

LLVM IR (-O2):
%struct.rusage = type { i64 }
@RUSAGE_SELF = global i32 0
define i64 @queryMaxResidentSize() {
%1 = alloca %struct.rusage
%2 = load i32, i32* @RUSAGE_SELF
%3 = bitcast %struct.rusage* %1 to i8*
%4 = call i32 @getrusage(i32 %2, %struct.rusage* %1)
%5 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 0
%6 = load i64, i64* %5
ret i64 %6
}
/* Variables and functions */
double pow(double, double);
double dc_box(double B, double Q) { return 0.4672 * pow(Q / B, 0.667); }


x86 assembly (clang, -O0):
<dc_box>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  0xed4(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xebc(%rip),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dc_box>:
push   %rax
movapd %xmm1,%xmm2
divsd  %xmm0,%xmm2
movsd  0xedf(%rip),%xmm1
movapd %xmm2,%xmm0
call   1030 <pow@plt>
mulsd  0xed6(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @dc_box(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double, double* %3
%7 = fdiv double %5, %6
%8 = call double @pow(double %7, double 6.670000e-01)
%9 = fmul double 4.672000e-01, %8
ret double %9
}

LLVM IR (-O2):
define double @dc_box(double %0, double %1) {
%3 = fdiv double %1, %0
%4 = tail call double @pow(double %3, double 6.670000e-01)
%5 = fmul double %4, 4.672000e-01
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ Cvar_SetWithFlag_f(int);
void Cvar_Setau_f(void) { Cvar_SetWithFlag_f(1 | 2); }


x86 assembly (clang, -O0):
<Cvar_Setau_f>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1030 <Cvar_SetWithFlag_f@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cvar_Setau_f>:
mov    $0x3,%edi
jmp    1030 <Cvar_SetWithFlag_f@plt>

LLVM IR (-O0):
define void @Cvar_Setau_f() {
%1 = call i32 @Cvar_SetWithFlag_f(i32 3)
ret void
}

LLVM IR (-O2):
define void @Cvar_Setau_f() {
%1 = tail call i32 @Cvar_SetWithFlag_f(i32 3)
ret void
}
void string_replace(char *s, char old_str, char new_str) {
  while (*s) {
    if (old_str == *s)
      *s = new_str;
    s++;
  }
}


x86 assembly (clang, -O0):
<string_replace>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114d <string_replace+0x4d>
movsbl -0x9(%rbp),%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    113c <string_replace+0x3c>
mov    -0xa(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1113 <string_replace+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_replace>:
mov    (%rdi),%al
test   %al,%al
je     1125 <string_replace+0x25>
add    $0x1,%rdi
jmp    111b <string_replace+0x1b>
nopl   0x0(%rax)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     1125 <string_replace+0x25>
cmp    %sil,%al
jne    1110 <string_replace+0x10>
mov    %dl,-0x1(%rdi)
jmp    1110 <string_replace+0x10>
ret

LLVM IR (-O0):
define void @string_replace(i8* %0, i8 signext %1, i8 signext %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
br label %7
7: ; preds = %21, %3
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %24
11: ; preds = %7
%12 = load i8, i8* %5
%13 = sext i8 %12 to i32
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %13, %16
br i1 %17, label %18, label %21
18: ; preds = %11
%19 = load i8, i8* %6
%20 = load i8*, i8** %4
store i8 %19, i8* %20
br label %21
21: ; preds = %18, %11
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %4
br label %7
24: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @string_replace(i8* nocapture %0, i8 signext %1, i8 signext %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %3, %11
%7 = phi i8 [ %13, %11 ], [ %4, %3 ]
%8 = phi i8* [ %12, %11 ], [ %0, %3 ]
%9 = icmp eq i8 %7, %1
br i1 %9, label %10, label %11
10: ; preds = %6
store i8 %2, i8* %8
br label %11
11: ; preds = %10, %6
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %6
15: ; preds = %11, %3
ret void
}