xunge/DecIR huggingface dataset:
/* Variables and functions */
int check_arg_count(int, int /*<<< orphan*/);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ report_count(int);
int /*<<< orphan*/ report_return(int /*<<< orphan*/);
void cmd_noecho(int nargs, char **args) {
  if (check_arg_count(nargs, 0) == 1)
    return;
  report_count(1);
  report_return(noecho());
}


x86 assembly (clang, -O0):
<cmd_noecho>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
jne    1167 <cmd_noecho+0x27>
jmp    117f <cmd_noecho+0x3f>
mov    $0x1,%edi
call   1050 <report_count@plt>
mov    $0x0,%al
call   1060 <noecho@plt>
mov    %eax,%edi
call   1030 <report_return@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_noecho>:
push   %rax
xor    %esi,%esi
call   1040 <check_arg_count@plt>
cmp    $0x1,%eax
jne    114f <cmd_noecho+0xf>
pop    %rax
ret
mov    $0x1,%edi
call   1050 <report_count@plt>
xor    %eax,%eax
call   1060 <noecho@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <report_return@plt>

LLVM IR (-O0):
define void @cmd_noecho(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = call i32 @check_arg_count(i32 %5, i32 0)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %2
br label %13
9: ; preds = %2
%10 = call i32 @report_count(i32 1)
%11 = call i32 (...) @noecho()
%12 = call i32 @report_return(i32 %11)
br label %13
13: ; preds = %9, %8
ret void
}

LLVM IR (-O2):
define void @cmd_noecho(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @check_arg_count(i32 %0, i32 0)
%4 = icmp eq i32 %3, 1
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i32 @report_count(i32 1)
%7 = tail call i32 (...) @noecho()
%8 = tail call i32 @report_return(i32 %7)
br label %9
9: ; preds = %2, %5
ret void
}
/* Variables and functions */
int socket(int, int, int);
int create_generic_socket(int domain, int type, int protocol) {
  return socket(domain, type, protocol);
}


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

x86 assembly (clang, -O2):
<create_generic_socket>:
jmp    1030 <socket@plt>

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

LLVM IR (-O2):
define i32 @create_generic_socket(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @socket(i32 %0, i32 %1, i32 %2)
ret i32 %4
}
int is_ws(char c) {
  int value;
  if (c == ' ' || c == '\t' || c == '\n') {
    value = 1;
  } else {
    value = 0;
  }
  return value;
}


x86 assembly (clang, -O0):
<is_ws>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x20,%eax
je     1131 <is_ws+0x31>
movsbl -0x1(%rbp),%eax
cmp    $0x9,%eax
je     1131 <is_ws+0x31>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
jne    113d <is_ws+0x3d>
movl   $0x1,-0x8(%rbp)
jmp    1144 <is_ws+0x44>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_ws>:
cmp    $0x20,%dil
ja     1120 <is_ws+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x100000600,%rdx
bt     %rcx,%rdx
jae    1120 <is_ws+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @is_ws(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %3
i8 10, label %3
i8 9, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Variables and functions */
void *calloc(unsigned int, unsigned int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned int);
int /*<<< orphan*/ stderr;
void *chk_alloc(unsigned n, unsigned size) {
  void *p;
  p = calloc(n, size);
  if (p == 0) {
    fprintf(stderr, "Ran out of memory (while trying to allocate %d bytes)\n",
            n * size);
    exit(1);
  }
  return p;
}


x86 assembly (clang, -O0):
<chk_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    117e <chk_alloc+0x4e>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
imul   -0x8(%rbp),%edx
lea    0xe91(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chk_alloc>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <calloc@plt>
test   %rax,%rax
je     1148 <chk_alloc+0x18>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
imul   %ebp,%ebx
lea    0xea5(%rip),%rsi
mov    %ebx,%edx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [55 x i8] c"Ran out of memory (while trying to allocate %d bytes)\0A\00"
define i8* @chk_alloc(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i8* @calloc(i32 %6, i32 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = mul i32 %13, %14
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %2
%19 = load i8*, i8** %5
ret i8* %19
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [55 x i8] c"Ran out of memory (while trying to allocate %d bytes)\0A\00"
define noalias i8* @chk_alloc(i32 %0, i32 %1) {
%3 = tail call i8* @calloc(i32 %0, i32 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = mul i32 %1, %0
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
ret i8* %3
}
int hasslash(char *s) {
  for (; *s; ++s)
    if (*s == '/')
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<hasslash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1147 <hasslash+0x47>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1131 <hasslash+0x31>
movl   $0x1,-0x4(%rbp)
jmp    114e <hasslash+0x4e>
jmp    1136 <hasslash+0x36>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1108 <hasslash+0x8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hasslash>:
movzbl (%rdi),%eax
test   %al,%al
je     1111 <hasslash+0x11>
cmp    $0x2f,%al
je     1114 <hasslash+0x14>
add    $0x1,%rdi
jmp    1100 <hasslash>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @hasslash(i8* nocapture %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %8
i8 47, label %7
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
br label %8
8: ; preds = %2, %7
%9 = phi i32 [ 1, %7 ], [ 0, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int usage(char *progname) {
  fprintf(stderr, "Usage: %s word dictionary\n", progname);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"Usage: %s word dictionary\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @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 ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"Usage: %s word dictionary\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ const uint8_t;

/* Variables and functions */
uint8_t hci_event_connection_complete_get_status(const uint8_t *event) {
  return event[2];
}


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

x86 assembly (clang, -O2):
<hci_event_connection_complete_get_status>:
mov    0x8(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @hci_event_connection_complete_get_status(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load i32, i32* %2
ret i32 %3
}
void RTTcpServerCreateEx(void) {}


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

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

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

LLVM IR (-O2):
define void @RTTcpServerCreateEx() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int sanity_check_array(int *parr, int size) {
  if (!parr || size <= 0) {
    printf("\n Array sanity check failed");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<sanity_check_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1134 <sanity_check_array+0x24>
cmpl   $0x0,-0x14(%rbp)
jg     114c <sanity_check_array+0x3c>
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1153 <sanity_check_array+0x43>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sanity_check_array>:
test   %rdi,%rdi
je     111c <sanity_check_array+0xc>
xor    %eax,%eax
test   %esi,%esi
jle    111c <sanity_check_array+0xc>
ret
push   %rax
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"\0A Array sanity check failed\00"
define i32 @sanity_check_array(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
%6 = load i32*, i32** %4
%7 = icmp ne i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp sle i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8, %2
%12 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %14
13: ; preds = %8
store i32 0, i32* %3
br label %14
14: ; preds = %13, %11
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@.str = [28 x i8] c"\0A Array sanity check failed\00"
define i32 @sanity_check_array(i32* readnone %0, i32 %1) {
%3 = icmp eq i32* %0, null
%4 = icmp slt i32 %1, 1
%5 = or i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ -1, %6 ], [ 0, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ lnxcStartMachine();
void linuxStartMachine(int window) {
  if (window) {
  } else {
    lnxcStartMachine();
  }
}


x86 assembly (clang, -O0):
<linuxStartMachine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     112a <linuxStartMachine+0x1a>
jmp    1131 <linuxStartMachine+0x21>
mov    $0x0,%al
call   1030 <lnxcStartMachine@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linuxStartMachine>:
test   %edi,%edi
je     1115 <linuxStartMachine+0x5>
ret
xor    %eax,%eax
jmp    1030 <lnxcStartMachine@plt>

LLVM IR (-O0):
define void @linuxStartMachine(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
br label %8
6: ; preds = %1
%7 = call i32 (...) @lnxcStartMachine()
br label %8
8: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
define void @linuxStartMachine(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @lnxcStartMachine()
br label %5
5: ; preds = %1, %3
ret void
}
void test_reset_commit_index() {}


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

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

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

LLVM IR (-O2):
define void @test_reset_commit_index() {
ret void
}
/* Variables and functions */
int strlen(char *);
char *strncat(char *, char *, int);
char *strcat(char *dest, char *src) {
  int countSrc = strlen(src);
  return strncat(dest, src, countSrc);
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <strncat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strncat@plt>

LLVM IR (-O0):
define i8* @strcat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %5
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = load i32, i32* %5
%11 = call i8* @strncat(i8* %8, i8* %9, i32 %10)
ret i8* %11
}

LLVM IR (-O2):
define i8* @strcat(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i8* @strncat(i8* %0, i8* %1, i32 %3)
ret i8* %4
}
void setlkw_timeout(int sig) {}


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

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

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

LLVM IR (-O2):
define void @setlkw_timeout(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void bar(void) { printf("This is a random test function!\n"); }


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

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

LLVM IR (-O0):
@.str = [33 x i8] c"This is a random test function!\0A\00"
define void @bar() {
%1 = 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"This is a random test function!\00"
define void @bar() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
ret void
}
void Chip_LOWPOWER_ArmSoftwareReset(void) {
  void (*p_Chip_LOWPOWER_ArmSoftwareReset)(void);
  p_Chip_LOWPOWER_ArmSoftwareReset = (void (*)(void))0x0300400dU;
  p_Chip_LOWPOWER_ArmSoftwareReset();
}


x86 assembly (clang, -O0):
<Chip_LOWPOWER_ArmSoftwareReset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x300400d,%eax
mov    %rax,-0x8(%rbp)
call   *-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Chip_LOWPOWER_ArmSoftwareReset>:
mov    $0x300400d,%eax
jmp    *%rax

LLVM IR (-O0):
define void @Chip_LOWPOWER_ArmSoftwareReset() {
%1 = alloca void ()*
store void ()* inttoptr (i64 50348045 to void ()*), void ()** %1
%2 = load void ()*, void ()** %1
ret void
}

LLVM IR (-O2):
define void @Chip_LOWPOWER_ArmSoftwareReset() {
tail call void inttoptr (i64 50348045 to void ()*)()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
void display_cleanup(void) { endwin(); }


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

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

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

LLVM IR (-O2):
define void @display_cleanup() {
%1 = tail call i32 (...) @endwin()
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int *allocateIntArray(int num) {
  int *ptr = (int *)malloc(num * sizeof(int));
  return ptr;
}


x86 assembly (clang, -O0):
<allocateIntArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocateIntArray>:
shl    $0x2,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i32* @allocateIntArray(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = mul i64 %5, 4
%7 = trunc i64 %6 to i32
%8 = call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to i32*
store i32* %9, i32** %3
%10 = load i32*, i32** %3
ret i32* %10
}

LLVM IR (-O2):
define i32* @allocateIntArray(i32 %0) {
%2 = shl i32 %0, 2
%3 = tail call i64 @malloc(i32 %2)
%4 = inttoptr i64 %3 to i32*
ret i32* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t hash(const void *key) { return *(uint32_t *)key; }


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

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ __write(int, void const *, size_t);
ssize_t write(int fd, const void *buf, size_t nbytes) {
  return __write(fd, buf, nbytes);
}


x86 assembly (clang, -O0):
<write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <__write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write>:
jmp    1030 <__write@plt>

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

LLVM IR (-O2):
define i32 @write(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 @__write(i32 %0, i8* %1, i64 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void imprimirElementos(double *arreglo, int n) {
  int i = 0;
  for (i = 0; i < n; i++) {
    double elemento = arreglo[i];
    printf(" %4.2lf", elemento);
  }
}


x86 assembly (clang, -O0):
<imprimirElementos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    116a <imprimirElementos+0x5a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <imprimirElementos+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [8 x i8] c" %4.2lf\00"
define void @imprimirElementos(double* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds double, double* %0, i64 %7
%9 = load double, double* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
size_t string_length(const char *s) {
  size_t len = 0;
  while (s[len] != '\0')
    len++;
  return len;
}


x86 assembly (clang, -O0):
<string_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1136 <string_length+0x36>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <string_length+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_length>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <string_length+0x10>
ret

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

LLVM IR (-O2):
define i64 @string_length(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %7, %2 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ op_write1(int);
void op_enc_add_hl_de(void) { op_write1(0x19); }


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

x86 assembly (clang, -O2):
<op_enc_add_hl_de>:
mov    $0x19,%edi
jmp    1030 <op_write1@plt>

LLVM IR (-O0):
define void @op_enc_add_hl_de() {
%1 = call i32 @op_write1(i32 25)
ret void
}

LLVM IR (-O2):
define void @op_enc_add_hl_de() {
%1 = tail call i32 @op_write1(i32 25)
ret void
}
/* Variables and functions */
unsigned long long __blcmsk_u64(unsigned long long);
unsigned long long test__blcmsk_u64(unsigned long long a) {
  return __blcmsk_u64(a);
}


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

x86 assembly (clang, -O2):
<test__blcmsk_u64>:
jmp    1030 <__blcmsk_u64@plt>

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

LLVM IR (-O2):
define i64 @test__blcmsk_u64(i64 %0) {
%2 = tail call i64 @__blcmsk_u64(i64 %0)
ret i64 %2
}
/* Type definitions */
typedef unsigned long long uint64_t;
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
scalar_t__ gettimeofday(struct timeval *, int /*<<< orphan*/);
uint64_t clust_time_now(void) {
  struct timeval tv;
  uint64_t time_now;
  if (gettimeofday(&tv, 0)) {
    return 0ULL;
  }
  time_now = (uint64_t)(tv.tv_sec) * 1000000000ULL;
  time_now += (uint64_t)(tv.tv_usec) * 1000ULL;
  return time_now;
}


x86 assembly (clang, -O0):
<clust_time_now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cmp    $0x0,%rax
je     113a <clust_time_now+0x2a>
movq   $0x0,-0x8(%rbp)
jmp    115e <clust_time_now+0x4e>
imul   $0x3b9aca00,-0x10(%rbp),%rax
3b
mov    %rax,-0x20(%rbp)
imul   $0x3e8,-0x18(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clust_time_now>:
push   %rbx
sub    $0x10,%rsp
mov    %rsp,%rdi
xor    %ebx,%ebx
xor    %esi,%esi
call   1030 <gettimeofday@plt>
test   %rax,%rax
jne    113a <clust_time_now+0x2a>
imul   $0x3b9aca00,0x8(%rsp),%rax
9a 3b
imul   $0x3e8,(%rsp),%rbx
add    %rax,%rbx
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define i64 @clust_time_now() {
%1 = alloca i64
%2 = alloca %struct.timeval
%3 = alloca i64
%4 = call i64 @gettimeofday(%struct.timeval* %2, i32 0)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %0
store i64 0, i64* %1
br label %17
7: ; preds = %0
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
%9 = load i64, i64* %8
%10 = mul i64 %9, 1000000000
store i64 %10, i64* %3
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%12 = load i64, i64* %11
%13 = mul i64 %12, 1000
%14 = load i64, i64* %3
%15 = add i64 %14, %13
store i64 %15, i64* %3
%16 = load i64, i64* %3
store i64 %16, i64* %1
br label %17
17: ; preds = %7, %6
%18 = load i64, i64* %1
ret i64 %18
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i64 @clust_time_now() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i64 @gettimeofday(%struct.timeval* %1, i32 0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %13
5: ; preds = %0
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i64, i64* %6
%8 = mul i64 %7, 1000000000
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%10 = load i64, i64* %9
%11 = mul i64 %10, 1000
%12 = add i64 %11, %8
br label %13
13: ; preds = %0, %5
%14 = phi i64 [ %12, %5 ], [ 0, %0 ]
ret i64 %14
}
void av_audio_fifo_write() {}


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

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

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

LLVM IR (-O2):
define void @av_audio_fifo_write() {
ret void
}
/* Variables and functions */
int goo(int *);
int foo3() {
  int a;
  int *p;
  p = &a + 5;
  return goo(p);
}


x86 assembly (clang, -O0):
<foo3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <goo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo3>:
push   %rax
lea    0x18(%rsp),%rdi
call   1030 <goo@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @foo3() {
%1 = alloca i32
%2 = alloca i32*
%3 = getelementptr inbounds i32, i32* %1, i64 5
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @goo(i32* %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @foo3() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = getelementptr inbounds i32, i32* %1, i64 5
%4 = call i32 @goo(i32* %3)
ret i32 %4
}
/* Variables and functions */
int cfg_processor_get_hex_int_attr(void *, char *);
int cfg_io_get_gpio_ren_addr(void *port) {
  return cfg_processor_get_hex_int_attr(port, "ren");
}


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

x86 assembly (clang, -O2):
<cfg_io_get_gpio_ren_addr>:
lea    0xee9(%rip),%rsi
jmp    1030 <cfg_processor_get_hex_int_attr@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"ren\00"
define i32 @cfg_io_get_gpio_ren_addr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @cfg_processor_get_hex_int_attr(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}

LLVM IR (-O2):
@.str = [4 x i8] c"ren\00"
define i32 @cfg_io_get_gpio_ren_addr(i8* %0) {
%2 = tail call i32 @cfg_processor_get_hex_int_attr(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
void mem_storage_tx_begin(void *handle) { return; }


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

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

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

LLVM IR (-O2):
define void @mem_storage_tx_begin(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage() { printf("Usage: please use -h to see help."); }


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

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

LLVM IR (-O0):
@.str = [34 x i8] c"Usage: please use -h to see help.\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"Usage: please use -h to see help.\00"
define void @print_usage() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ puts(char *);
void fatal_error(char *msg, ...) {
  puts(msg);
  exit(1);
}


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

x86 assembly (clang, -O2):
<fatal_error>:
push   %rax
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @fatal_error(i8* %0, ...) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @puts(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @fatal_error(i8* nocapture %0, ...) {
%2 = tail call i32 @puts(i8* dereferenceable(1) %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
int kt_int_log2(int n) {
  int tmp1 = n;
  int tmp2 = 0;
  while (tmp1 >>= 1) {
    tmp2++;
  }
  return tmp2;
}


x86 assembly (clang, -O0):
<kt_int_log2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     1134 <kt_int_log2+0x34>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1114 <kt_int_log2+0x14>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kt_int_log2>:
xor    %eax,%eax
cmp    $0x2,%edi
jb     111c <kt_int_log2+0x1c>
xor    %eax,%eax
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
sar    %ecx
add    $0x1,%eax
cmp    $0x3,%edi
mov    %ecx,%edi
ja     1110 <kt_int_log2+0x10>
ret

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

LLVM IR (-O2):
define i32 @kt_int_log2(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = ashr i32 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp ult i32 %5, 4
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}
/* Type definitions */
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ clockid_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int clock_settime(clockid_t clock_id, const struct timespec *tp) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<clock_settime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clock_settime>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@ENOSYS = global i32 0
define i32 @clock_settime(i32 %0, %struct.timespec* %1) {
%3 = alloca i32
%4 = alloca %struct.timespec*
store i32 %0, i32* %3
store %struct.timespec* %1, %struct.timespec** %4
%5 = load i32, i32* @ENOSYS
%6 = call i32 @__set_errno(i32 %5)
ret i32 -1
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@ENOSYS = global i32 0
define i32 @clock_settime(i32 %0, %struct.timespec* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
%4 = tail call i32 @__set_errno(i32 %3)
ret i32 -1
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ font_set;
};
typedef TYPE_1__ XmbTextItem;

/* Variables and functions */
void *get_XmbTextItem_font_set(void *_p) {
  return (void *)((XmbTextItem *)_p)->font_set;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i8* @get_XmbTextItem_font_set(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = inttoptr i64 %6 to i8*
ret i8* %7
}

LLVM IR (-O2):
define i8* @get_XmbTextItem_font_set(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
int isdirpunct(int c) { return (c == '/'); }


x86 assembly (clang, -O0):
<isdirpunct>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x2f,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isdirpunct>:
xor    %eax,%eax
cmp    $0x2f,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @isdirpunct(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 47
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @isdirpunct(i32 %0) {
%2 = icmp eq i32 %0, 47
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
long double __qerfc(long double);
long double qerfc_(long double *arg) { return (__qerfc(*arg)); }


x86 assembly (clang, -O0):
<qerfc_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
fldt   (%rax)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <__qerfc@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qerfc_>:
sub    $0x18,%rsp
fldt   (%rdi)
fstpt  (%rsp)
call   1030 <__qerfc@plt>
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define x86_fp80 @qerfc_(x86_fp80* nocapture %0) {
%2 = load x86_fp80, x86_fp80* %0
%3 = tail call x86_fp80 @__qerfc(x86_fp80 %2)
ret x86_fp80 %3
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *strrchr(char *, char);
char *xstrdup(char *);
char *rcsrev_prefix(char *revnum) {
  char *modrev, *pos;
  modrev = xstrdup(revnum);
  pos = strrchr(modrev, '.');
  if (pos == NULL) {
    free(modrev);
    return (NULL);
  }
  *pos = '\0';
  return (modrev);
}


x86 assembly (clang, -O0):
<rcsrev_prefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <xstrdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x2e,%esi
call   1040 <strrchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    117c <rcsrev_prefix+0x4c>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x8(%rbp)
jmp    118b <rcsrev_prefix+0x5b>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rcsrev_prefix>:
push   %rbx
call   1050 <xstrdup@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x2e,%esi
call   1040 <strrchr@plt>
test   %rax,%rax
je     1150 <rcsrev_prefix+0x20>
movb   $0x0,(%rax)
jmp    115a <rcsrev_prefix+0x2a>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @rcsrev_prefix(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i8* @xstrdup(i8* %6)
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = call i8* @strrchr(i8* %8, i8 signext 46)
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = load i8*, i8** %4
%14 = call i32 @free(i8* %13)
store i8* null, i8** %2
br label %18
15: ; preds = %1
%16 = load i8*, i8** %5
store i8 0, i8* %16
%17 = load i8*, i8** %4
store i8* %17, i8** %2
br label %18
18: ; preds = %15, %12
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
define i8* @rcsrev_prefix(i8* %0) {
%2 = tail call i8* @xstrdup(i8* %0)
%3 = tail call i8* @strrchr(i8* dereferenceable(1) %2, i8 signext 46)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @free(i8* %2)
br label %8
7: ; preds = %1
store i8 0, i8* %3
br label %8
8: ; preds = %7, %5
%9 = phi i8* [ null, %5 ], [ %2, %7 ]
ret i8* %9
}
/* Type definitions */
typedef int /*<<< orphan*/ BIO_info_cb;
typedef int /*<<< orphan*/ BIO;

/* Variables and functions */
long BIO_callback_ctrl(int /*<<< orphan*/ *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *BIO_next(int /*<<< orphan*/ *);
long enc_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) {
  long ret = 1;
  BIO *next = BIO_next(b);
  if (next == NULL)
    return 0;
  switch (cmd) {
  default:
    ret = BIO_callback_ctrl(next, cmd, fp);
    break;
  }
  return ret;
}


x86 assembly (clang, -O0):
<enc_callback_ctrl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x1,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <BIO_next@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1160 <enc_callback_ctrl+0x40>
movq   $0x0,-0x8(%rbp)
jmp    117c <enc_callback_ctrl+0x5c>
mov    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1030 <BIO_callback_ctrl@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enc_callback_ctrl>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%ebp
call   1040 <BIO_next@plt>
test   %rax,%rax
je     1145 <enc_callback_ctrl+0x25>
mov    %rax,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <BIO_callback_ctrl@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i64 @enc_callback_ctrl(i32* %0, i32 %1, i32* %2) {
%4 = alloca i64
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i64
%9 = alloca i32*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i64 1, i64* %8
%10 = load i32*, i32** %5
%11 = call i32* @BIO_next(i32* %10)
store i32* %11, i32** %9
%12 = load i32*, i32** %9
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %15
14: ; preds = %3
store i64 0, i64* %4
br label %24
15: ; preds = %3
%16 = load i32, i32* %6
switch i32 %16, label %17 [
]
17: ; preds = %15
%18 = load i32*, i32** %9
%19 = load i32, i32* %6
%20 = load i32*, i32** %7
%21 = call i64 @BIO_callback_ctrl(i32* %18, i32 %19, i32* %20)
store i64 %21, i64* %8
br label %22
22: ; preds = %17
%23 = load i64, i64* %8
store i64 %23, i64* %4
br label %24
24: ; preds = %22, %14
%25 = load i64, i64* %4
ret i64 %25
}

LLVM IR (-O2):
define i64 @enc_callback_ctrl(i32* %0, i32 %1, i32* %2) {
%4 = tail call i32* @BIO_next(i32* %0)
%5 = icmp eq i32* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i64 @BIO_callback_ctrl(i32* %4, i32 %1, i32* %2)
br label %8
8: ; preds = %3, %6
%9 = phi i64 [ %7, %6 ], [ 0, %3 ]
ret i64 %9
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void *thrfunc2(void *arg) {
  fprintf(stderr, "Starting thread %s\n", (char *)arg);
  return NULL;
}


x86 assembly (clang, -O0):
<thrfunc2>:
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>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thrfunc2>:
push   %rax
mov    %rdi,%rdx
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"Starting thread %s\0A\00"
define i8* @thrfunc2(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 ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i8* null
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"Starting thread %s\0A\00"
define noalias i8* @thrfunc2(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ RxD1Interrupt();
void USART3_IRQHandler(void) { RxD1Interrupt(); }


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

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

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

LLVM IR (-O2):
define void @USART3_IRQHandler() {
%1 = tail call i32 (...) @RxD1Interrupt()
ret void
}
char *strcpy(char *s1, const char *s2) {
  char *rc = s1;
  while ((*(s1++) = *(s2++)))
    ;
  return rc;
}


x86 assembly (clang, -O0):
<strcpy>:
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,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1143 <strcpy+0x43>
jmp    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
double _J_0(void) { return 0.0; }


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

x86 assembly (clang, -O2):
<_J_0>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @_J_0() {
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @_J_0() {
ret double 0.000000e+00
}