xunge/DecIR huggingface dataset:
/* Variables and functions */
unsigned int strtoul(char *, char **, int);
unsigned int my_atoi(char *txt) {
  char *endptr = NULL;
  if (!txt)
    return 0;
  unsigned int ret = strtoul(txt, &endptr, 10);
  if (endptr == txt || *endptr)
    return 0;
  return ret;
}


x86 assembly (clang, -O0):
<my_atoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    113b <my_atoi+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    1180 <my_atoi+0x70>
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtoul@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     116e <my_atoi+0x5e>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     117a <my_atoi+0x6a>
movl   $0x0,-0x4(%rbp)
jmp    1180 <my_atoi+0x70>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_atoi>:
push   %rbp
push   %rbx
push   %rax
movq   $0x0,(%rsp)
xor    %ebp,%ebp
test   %rdi,%rdi
je     1143 <my_atoi+0x33>
mov    %rdi,%rbx
mov    %rsp,%rsi
mov    $0xa,%edx
call   1030 <strtoul@plt>
mov    (%rsp),%rcx
cmp    %rbx,%rcx
je     1143 <my_atoi+0x33>
xor    %ebp,%ebp
cmpb   $0x0,(%rcx)
cmove  %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @my_atoi(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%4 = icmp eq i8* %0, null
br i1 %4, label %13, label %5
5: ; preds = %1
%6 = call i32 @strtoul(i8* %0, i8** %2, i32 10)
%7 = load i8*, i8** %2
%8 = icmp eq i8* %7, %0
br i1 %8, label %13, label %9
9: ; preds = %5
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
%12 = select i1 %11, i32 %6, i32 0
br label %13
13: ; preds = %9, %5, %1
%14 = phi i32 [ 0, %1 ], [ 0, %5 ], [ %12, %9 ]
ret i32 %14
}
int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.wpa_global = type opaque
%struct.wpa_supplicant = type opaque
define i32 @wpas_p2p_init(%struct.wpa_global* %0, %struct.wpa_supplicant* %1) {
%3 = alloca %struct.wpa_global*
%4 = alloca %struct.wpa_supplicant*
store %struct.wpa_global* %0, %struct.wpa_global** %3
store %struct.wpa_supplicant* %1, %struct.wpa_supplicant** %4
ret i32 0
}

LLVM IR (-O2):
%struct.wpa_global = type opaque
%struct.wpa_supplicant = type opaque
define i32 @wpas_p2p_init(%struct.wpa_global* nocapture readnone %0, %struct.wpa_supplicant* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int f383(int *);
int f384(int *p) { return f383(p); }


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

x86 assembly (clang, -O2):
<f384>:
jmp    1030 <f383@plt>

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

LLVM IR (-O2):
define i32 @f384(i32* %0) {
%2 = tail call i32 @f383(i32* %0)
ret i32 %2
}
/* Variables and functions */
int rand();
int random_integer(int min, int max) {
  return ((rand() % (max - min + 1)) + min);
}


x86 assembly (clang, -O0):
<random_integer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_integer>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @random_integer(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (...) @rand()
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %6, %7
%9 = add nsw i32 %8, 1
%10 = srem i32 %5, %9
%11 = load i32, i32* %3
%12 = add nsw i32 %10, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @random_integer(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = sub i32 1, %0
%5 = add i32 %4, %1
%6 = srem i32 %3, %5
%7 = add nsw i32 %6, %0
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, char, size_t);
int /*<<< orphan*/ strftime(char *, size_t, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void get_local_time(char *ptime, size_t max) {
  struct tm *time_info;
  time_t raw_time;
  memset(ptime, '\0', max);
  time(&raw_time);
  time_info = localtime(&raw_time);
  strftime(ptime, max, "%a, %d %h %Y %T GMT", time_info);
}


x86 assembly (clang, -O0):
<get_local_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1040 <memset@plt>
lea    -0x1c(%rbp),%rdi
call   1050 <time@plt>
lea    -0x1c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
lea    0xe78(%rip),%rdx
call   1060 <strftime@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_local_time>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
lea    0xc(%rsp),%r15
mov    %r15,%rdi
call   1050 <time@plt>
mov    %r15,%rdi
call   1030 <localtime@plt>
lea    0xe8b(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rax,%rcx
call   1060 <strftime@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [20 x i8] c"%a, %d %h %Y %T GMT\00"
define void @get_local_time(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca %struct.tm*
%6 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
%7 = load i8*, i8** %3
%8 = load i64, i64* %4
%9 = call i32 @memset(i8* %7, i8 signext 0, i64 %8)
%10 = call i32 @time(i32* %6)
%11 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %11, %struct.tm** %5
%12 = load i8*, i8** %3
%13 = load i64, i64* %4
%14 = load %struct.tm*, %struct.tm** %5
%15 = call i32 @strftime(i8* %12, i64 %13, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %struct.tm* %14)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [20 x i8] c"%a, %d %h %Y %T GMT\00"
define void @get_local_time(i8* %0, i64 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @memset(i8* %0, i8 signext 0, i64 %1)
%6 = call i32 @time(i32* %3)
%7 = call %struct.tm* @localtime(i32* %3)
%8 = call i32 @strftime(i8* %0, i64 %1, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %struct.tm* %7)
ret void
}
char get_escape_equiv(unsigned c) {
  switch (c) {
  case 'b':
    return '\b';
  case 'n':
    return '\n';
  case 'r':
    return '\r';
  case 't':
    return '\t';
  case 'f':
    return '\f';
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_escape_equiv>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffff9e,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x12,%eax
ja     115d <get_escape_equiv+0x5d>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x8,-0x1(%rbp)
jmp    1161 <get_escape_equiv+0x61>
movb   $0xa,-0x1(%rbp)
jmp    1161 <get_escape_equiv+0x61>
movb   $0xd,-0x1(%rbp)
jmp    1161 <get_escape_equiv+0x61>
movb   $0x9,-0x1(%rbp)
jmp    1161 <get_escape_equiv+0x61>
movb   $0xc,-0x1(%rbp)
jmp    1161 <get_escape_equiv+0x61>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_escape_equiv>:
add    $0xffffff9e,%edi
ror    %edi
cmp    $0x9,%edi
ja     1118 <get_escape_equiv+0x18>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rax,%rcx,1),%al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define signext i8 @get_escape_equiv(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %10 [
i32 98, label %5
i32 110, label %6
i32 114, label %7
i32 116, label %8
i32 102, label %9
]
5: ; preds = %1
store i8 8, i8* %2
br label %11
6: ; preds = %1
store i8 10, i8* %2
br label %11
7: ; preds = %1
store i8 13, i8* %2
br label %11
8: ; preds = %1
store i8 9, i8* %2
br label %11
9: ; preds = %1
store i8 12, i8* %2
br label %11
10: ; preds = %1
store i8 0, i8* %2
br label %11
11: ; preds = %10, %9, %8, %7, %6, %5
%12 = load i8, i8* %2
ret i8 %12
}

LLVM IR (-O2):
@switch.table.get_escape_equiv = [10 x i8] c"\08\00\0C\00\00\00\0A\00\0D\09"
define signext i8 @get_escape_equiv(i32 %0) {
%2 = add i32 %0, -98
%3 = tail call i32 @llvm.fshl.i32(i32 %2, i32 %2, i32 31)
%4 = icmp ult i32 %3, 10
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [10 x i8], [10 x i8]* @switch.table.get_escape_equiv, i64 0, i64 %6
%8 = load i8, i8* %7
br label %9
9: ; preds = %1, %5
%10 = phi i8 [ %8, %5 ], [ 0, %1 ]
ret i8 %10
}
/* Variables and functions */
scalar_t__ queue_base_init();
scalar_t__ sem_base_init();
scalar_t__ task_base_init();
scalar_t__ timer_base_init();
int osw_init(void) {
  if (task_base_init() || sem_base_init() || queue_base_init() ||
      timer_base_init())
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<osw_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <task_base_init@plt>
cmp    $0x0,%rax
jne    118c <osw_init+0x4c>
mov    $0x0,%al
call   1040 <sem_base_init@plt>
cmp    $0x0,%rax
jne    118c <osw_init+0x4c>
mov    $0x0,%al
call   1030 <queue_base_init@plt>
cmp    $0x0,%rax
jne    118c <osw_init+0x4c>
mov    $0x0,%al
call   1060 <timer_base_init@plt>
cmp    $0x0,%rax
je     1198 <osw_init+0x58>
movl   $0xffffffff,-0x4(%rbp)
jmp    119f <osw_init+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<osw_init>:
push   %rbx
xor    %eax,%eax
call   1050 <task_base_init@plt>
mov    $0xffffffff,%ebx
test   %rax,%rax
jne    1176 <osw_init+0x36>
xor    %eax,%eax
call   1040 <sem_base_init@plt>
test   %rax,%rax
jne    1176 <osw_init+0x36>
xor    %eax,%eax
call   1030 <queue_base_init@plt>
test   %rax,%rax
jne    1176 <osw_init+0x36>
xor    %eax,%eax
call   1060 <timer_base_init@plt>
neg    %rax
sbb    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @osw_init() {
%1 = alloca i32
%2 = call i64 (...) @task_base_init()
%3 = icmp ne i64 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %0
%5 = call i64 (...) @sem_base_init()
%6 = icmp ne i64 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %4
%8 = call i64 (...) @queue_base_init()
%9 = icmp ne i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = call i64 (...) @timer_base_init()
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10, %7, %4, %0
store i32 -1, i32* %1
br label %15
14: ; preds = %10
store i32 0, i32* %1
br label %15
15: ; preds = %14, %13
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
define i32 @osw_init() {
%1 = tail call i64 (...) @task_base_init()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %13
3: ; preds = %0
%4 = tail call i64 (...) @sem_base_init()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = tail call i64 (...) @queue_base_init()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = tail call i64 (...) @timer_base_init()
%11 = icmp ne i64 %10, 0
%12 = sext i1 %11 to i32
br label %13
13: ; preds = %9, %0, %3, %6
%14 = phi i32 [ -1, %6 ], [ -1, %3 ], [ -1, %0 ], [ %12, %9 ]
ret i32 %14
}
/* Type definitions */
struct evhttp_request {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ HTTP_NOTFOUND;
int /*<<< orphan*/ evhttp_send_error(struct evhttp_request *,
                                     int /*<<< orphan*/, char *);
void http_callback_default(struct evhttp_request *request, void *data) {
  evhttp_send_error(request, HTTP_NOTFOUND, "Service not found");
}


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

x86 assembly (clang, -O2):
<http_callback_default>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdx
jmp    1030 <evhttp_send_error@plt>

LLVM IR (-O0):
%struct.evhttp_request = type { i32 }
@HTTP_NOTFOUND = global i32 0
@.str = [18 x i8] c"Service not found\00"
define void @http_callback_default(%struct.evhttp_request* %0, i8* %1) {
%3 = alloca %struct.evhttp_request*
%4 = alloca i8*
store %struct.evhttp_request* %0, %struct.evhttp_request** %3
store i8* %1, i8** %4
%5 = load %struct.evhttp_request*, %struct.evhttp_request** %3
%6 = load i32, i32* @HTTP_NOTFOUND
%7 = call i32 @evhttp_send_error(%struct.evhttp_request* %5, i32 %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.evhttp_request = type { i32 }
@HTTP_NOTFOUND = global i32 0
@.str = [18 x i8] c"Service not found\00"
define void @http_callback_default(%struct.evhttp_request* %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @HTTP_NOTFOUND
%4 = tail call i32 @evhttp_send_error(%struct.evhttp_request* %0, i32 %3, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
double round_down(double, double);
double rs_rainflow_round_down(double x, double scale) {
  return (x == 0.0 ? 0.0 : round_down(x, scale));
}


x86 assembly (clang, -O0):
<rs_rainflow_round_down>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1147 <rs_rainflow_round_down+0x37>
jp     1147 <rs_rainflow_round_down+0x37>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    115b <rs_rainflow_round_down+0x4b>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <round_down@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rs_rainflow_round_down>:
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jne    1121 <rs_rainflow_round_down+0x11>
jp     1121 <rs_rainflow_round_down+0x11>
xorpd  %xmm0,%xmm0
ret
jmp    1030 <round_down@plt>

LLVM IR (-O0):
define double @rs_rainflow_round_down(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = fcmp oeq double %5, 0.000000e+00
br i1 %6, label %7, label %8
7: ; preds = %2
br label %12
8: ; preds = %2
%9 = load double, double* %3
%10 = load double, double* %4
%11 = call double @round_down(double %9, double %10)
br label %12
12: ; preds = %8, %7
%13 = phi double [ 0.000000e+00, %7 ], [ %11, %8 ]
ret double %13
}

LLVM IR (-O2):
define double @rs_rainflow_round_down(double %0, double %1) {
%3 = fcmp oeq double %0, 0.000000e+00
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call double @round_down(double %0, double %1)
br label %6
6: ; preds = %2, %4
%7 = phi double [ %5, %4 ], [ 0.000000e+00, %2 ]
ret double %7
}
/* Variables and functions */
scalar_t__ __mriCore_IsFirstException();
scalar_t__ __mriPlatform_CommSharingWithApplication();
int /*<<< orphan*/ writeStringToExclusiveGdbCommChannel(char const *);
int /*<<< orphan*/ writeStringToSharedCommChannel(char const *);
void __mriGdbConsole_WriteString(const char *pString) {
  if (__mriPlatform_CommSharingWithApplication() &&
      __mriCore_IsFirstException())
    writeStringToSharedCommChannel(pString);
  else
    writeStringToExclusiveGdbCommChannel(pString);
}


x86 assembly (clang, -O0):
<__mriGdbConsole_WriteString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <__mriPlatform_CommSharingWithApplication@plt>
cmp    $0x0,%rax
je     117c <__mriGdbConsole_WriteString+0x3c>
mov    $0x0,%al
call   1030 <__mriCore_IsFirstException@plt>
cmp    $0x0,%rax
je     117c <__mriGdbConsole_WriteString+0x3c>
mov    -0x8(%rbp),%rdi
call   1060 <writeStringToSharedCommChannel@plt>
jmp    1185 <__mriGdbConsole_WriteString+0x45>
mov    -0x8(%rbp),%rdi
call   1040 <writeStringToExclusiveGdbCommChannel@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__mriGdbConsole_WriteString>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <__mriPlatform_CommSharingWithApplication@plt>
test   %rax,%rax
je     1165 <__mriGdbConsole_WriteString+0x25>
xor    %eax,%eax
call   1030 <__mriCore_IsFirstException@plt>
test   %rax,%rax
je     1165 <__mriGdbConsole_WriteString+0x25>
mov    %rbx,%rdi
pop    %rbx
jmp    1060 <writeStringToSharedCommChannel@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <writeStringToExclusiveGdbCommChannel@plt>

LLVM IR (-O0):
define void @__mriGdbConsole_WriteString(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i64 (...) @__mriPlatform_CommSharingWithApplication()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = call i64 (...) @__mriCore_IsFirstException()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i8*, i8** %2
%10 = call i32 @writeStringToSharedCommChannel(i8* %9)
br label %14
11: ; preds = %5, %1
%12 = load i8*, i8** %2
%13 = call i32 @writeStringToExclusiveGdbCommChannel(i8* %12)
br label %14
14: ; preds = %11, %8
ret void
}

LLVM IR (-O2):
define void @__mriGdbConsole_WriteString(i8* %0) {
%2 = tail call i64 (...) @__mriPlatform_CommSharingWithApplication()
%3 = icmp eq i64 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = tail call i64 (...) @__mriCore_IsFirstException()
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @writeStringToSharedCommChannel(i8* %0)
br label %11
9: ; preds = %4, %1
%10 = tail call i32 @writeStringToExclusiveGdbCommChannel(i8* %0)
br label %11
11: ; preds = %9, %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int sem_unlink(char *);
void remove_it(void) {
  if ((sem_unlink("/my_sem")) == -1) {
    perror("sem_unlink");
    exit(errno);
  };
  printf("Semaphore successfully deleted\n");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<remove_it>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
call   1060 <sem_unlink@plt>
cmp    $0xffffffff,%eax
jne    1173 <remove_it+0x33>
lea    0xea8(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<remove_it>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1060 <sem_unlink@plt>
cmp    $0xffffffff,%eax
jne    116c <remove_it+0x2c>
lea    0xeaf(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"/my_sem\00"
@.str.1 = [11 x i8] c"sem_unlink\00"
@errno = global i32 0
@.str.2 = [32 x i8] c"Semaphore successfully deleted\0A\00"
@EXIT_SUCCESS = global i32 0
define void @remove_it() {
%1 = call i32 @sem_unlink(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @errno
%6 = call i32 @exit(i32 %5)
unreachable
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32, i32* @EXIT_SUCCESS
%10 = call i32 @exit(i32 %9)
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"/my_sem\00"
@.str.1 = [11 x i8] c"sem_unlink\00"
@errno = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [31 x i8] c"Semaphore successfully deleted\00"
define void @remove_it() {
%1 = tail call i32 @sem_unlink(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @errno
%6 = tail call i32 @exit(i32 %5)
unreachable
7: ; preds = %0
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%9 = load i32, i32* @EXIT_SUCCESS
%10 = tail call i32 @exit(i32 %9)
unreachable
}
void sys_putmidibyte(int portno, int byte) {}


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

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

LLVM IR (-O0):
define void @sys_putmidibyte(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 @sys_putmidibyte(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Write(int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
void unimplemented(int sockfd) {
  char msg[] = "HTTP/1.1 501 Method Not Implemented\r\n"
               "Server: Anywhere\r\n"
               "Content-Type: text/plain\r\n"
               "\r\n"
               "method not implemented\r\n";
  Write(sockfd, msg, strlen(msg));
}


x86 assembly (clang, -O0):
<unimplemented>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xeb7(%rip),%rsi
mov    $0x6c,%edx
call   1050 <memcpy@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x7c(%rbp)
lea    -0x70(%rbp),%rax
mov    %rax,-0x78(%rbp)
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x7c(%rbp),%edi
mov    -0x78(%rbp),%rsi
mov    %eax,%edx
call   1040 <Write@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unimplemented>:
push   %rbp
push   %rbx
sub    $0x78,%rsp
mov    %edi,%ebp
movups 0xf2d(%rip),%xmm0
movups %xmm0,0x5c(%rsp)
movaps 0xf15(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xef9(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xedd(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec1(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xea5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe89(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <Write@plt>
add    $0x78,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.unimplemented.msg = [108 x i8] c"HTTP/1.1 501 Method Not Implemented\0D\0AServer: Anywhere\0D\0AContent-Type: text/plain\0D\0A\0D\0Amethod not implemented\0D\0A\00"
define void @unimplemented(i32 %0) {
%2 = alloca i32
%3 = alloca [108 x i8]
store i32 %0, i32* %2
%4 = bitcast [108 x i8]* %3 to i8*
%5 = load i32, i32* %2
%6 = getelementptr inbounds [108 x i8], [108 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [108 x i8], [108 x i8]* %3, i64 0, i64 0
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @Write(i32 %5, i8* %6, i32 %8)
ret void
}

LLVM IR (-O2):
@__const.unimplemented.msg = [108 x i8] c"HTTP/1.1 501 Method Not Implemented\0D\0AServer: Anywhere\0D\0AContent-Type: text/plain\0D\0A\0D\0Amethod not implemented\0D\0A\00"
define void @unimplemented(i32 %0) {
%2 = alloca [108 x i8]
%3 = getelementptr inbounds [108 x i8], [108 x i8]* %2, i64 0, i64 0
%4 = call i32 @strlen(i8* %3)
%5 = call i32 @Write(i32 %0, i8* %3, i32 %4)
ret void
}
int test_bit(unsigned long *bitmap, unsigned int bit) {
  return (int)(bitmap[bit / (8 * sizeof(long))] >> (bit % (8 * sizeof(long)))) &
         1;
}


x86 assembly (clang, -O0):
<test_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shr    $0x6,%rcx
mov    (%rax,%rcx,8),%rax
mov    -0xc(%rbp),%ecx
and    $0x3f,%rcx
shr    %cl,%rax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_bit>:
mov    %esi,%ecx
mov    %esi,%eax
shr    $0x3,%eax
and    $0xfffffff8,%eax
mov    (%rdi,%rax,1),%rax
shr    %cl,%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @test_bit(i64* %0, i32 %1) {
%3 = alloca i64*
%4 = alloca i32
store i64* %0, i64** %3
store i32 %1, i32* %4
%5 = load i64*, i64** %3
%6 = load i32, i32* %4
%7 = zext i32 %6 to i64
%8 = udiv i64 %7, 64
%9 = getelementptr inbounds i64, i64* %5, i64 %8
%10 = load i64, i64* %9
%11 = load i32, i32* %4
%12 = zext i32 %11 to i64
%13 = urem i64 %12, 64
%14 = lshr i64 %10, %13
%15 = trunc i64 %14 to i32
%16 = and i32 %15, 1
ret i32 %16
}

LLVM IR (-O2):
define i32 @test_bit(i64* nocapture %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = lshr i64 %3, 6
%5 = getelementptr inbounds i64, i64* %0, i64 %4
%6 = load i64, i64* %5
%7 = and i64 %3, 63
%8 = lshr i64 %6, %7
%9 = trunc i64 %8 to i32
%10 = and i32 %9, 1
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ test2();
int main(int argc, char **argv) {
  test2();
  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)
mov    $0x0,%al
call   1030 <test2@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test2@plt>
xor    %eax,%eax
pop    %rcx
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 = call i32 (...) @test2()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test2()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int squarer(int);
int main(int argc, const char *argv[]) {
  int number = 5;
  int square = squarer(number);
  printf("\"%d\" squared is \"%d\".\n", number, square);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <squarer@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
call   1040 <squarer@plt>
lea    0xece(%rip),%rdi
mov    $0x5,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\22%d\22 squared is \22%d\22.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 5, i32* %5
%7 = load i32, i32* %5
%8 = call i32 @squarer(i32 %7)
store i32 %8, i32* %6
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"\22%d\22 squared is \22%d\22.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @squarer(i32 5)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 5, i32 %3)
ret i32 0
}
unsigned int umax(unsigned int a, unsigned int b) { return a > b ? a : b; }


x86 assembly (clang, -O0):
<umax>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jbe    1121 <umax+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <umax+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<umax>:
mov    %esi,%eax
cmp    %esi,%edi
cmova  %edi,%eax
ret

LLVM IR (-O0):
define i32 @umax(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 = icmp ugt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @umax(i32 %0, i32 %1) {
%3 = icmp ugt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void kmeans_error(char *msg) {
  printf("%s", msg);
  exit(-1);
}


x86 assembly (clang, -O0):
<kmeans_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<kmeans_error>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @kmeans_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @kmeans_error(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int getpid();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  char *buffer;
  printf("%d\n", getpid());
  fflush(stdout);
  buffer = (char *)0;
  buffer[1] = 'a';
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x61,0x1(%rax)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
movb   $0x61,0x1
61
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @getpid()
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @stdout
%10 = call i32 @fflush(i32 %9)
store i8* null, i8** %6
%11 = load i8*, i8** %6
%12 = getelementptr inbounds i8, i8* %11, i64 1
store i8 97, i8* %12
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @getpid()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @stdout
%6 = tail call i32 @fflush(i32 %5)
store i8 97, i8* inttoptr (i64 1 to i8*)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ tmb_unlock_semaphore();
void __attribute__((destructor)) SemaphoreRelease_(void) {
  tmb_unlock_semaphore();
}


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

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

LLVM IR (-O0):
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @SemaphoreRelease_, i8* null }]
define void @SemaphoreRelease_() {
%1 = call i32 (...) @tmb_unlock_semaphore()
ret void
}

LLVM IR (-O2):
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @SemaphoreRelease_, i8* null }]
define void @SemaphoreRelease_() {
%1 = tail call i32 (...) @tmb_unlock_semaphore()
ret void
}
void init_signals(void) {
  static int initialized = 0;
  if (!initialized) {
    initialized = 1;
  }
}


x86 assembly (clang, -O0):
<init_signals>:
push   %rbp
mov    %rsp,%rbp
cmpl   $0x0,0x2f19(%rip)
jne    111b <init_signals+0x1b>
movl   $0x1,0x2f09(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_signals>:
cmpb   $0x0,0x2f1d(%rip)
jne    1110 <init_signals+0x10>
movb   $0x1,0x2f14(%rip)
ret

LLVM IR (-O0):
@init_signals.initialized = internal global i32 0
define void @init_signals() {
%1 = load i32, i32* @init_signals.initialized
%2 = icmp ne i32 %1, 0
br i1 %2, label %4, label %3
3: ; preds = %0
store i32 1, i32* @init_signals.initialized
br label %4
4: ; preds = %3, %0
ret void
}

LLVM IR (-O2):
@init_signals.initialized = internal unnamed_addr global i1 false
define void @init_signals() {
%1 = load i1, i1* @init_signals.initialized
br i1 %1, label %3, label %2
2: ; preds = %0
store i1 true, i1* @init_signals.initialized
br label %3
3: ; preds = %2, %0
ret void
}
/* Type definitions */
typedef size_t uint64_t;

/* Variables and functions */
size_t mi_sha256_remainder_size(size_t size, uint64_t record_size) {
  if (size == 0) {
    return 0;
  }
  if (size % record_size == 0) {
    return record_size;
  } else {
    return size % record_size;
  }
}


x86 assembly (clang, -O0):
<mi_sha256_remainder_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1124 <mi_sha256_remainder_size+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1157 <mi_sha256_remainder_size+0x57>
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
cmp    $0x0,%rdx
jne    1147 <mi_sha256_remainder_size+0x47>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1157 <mi_sha256_remainder_size+0x57>
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
mov    %rdx,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mi_sha256_remainder_size>:
test   %rdi,%rdi
je     111b <mi_sha256_remainder_size+0x1b>
mov    %rdi,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     1121 <mi_sha256_remainder_size+0x21>
mov    %rdi,%rax
xor    %edx,%edx
div    %rsi
jmp    1127 <mi_sha256_remainder_size+0x27>
xor    %esi,%esi
mov    %rsi,%rax
ret
mov    %edi,%eax
xor    %edx,%edx
div    %esi
test   %rdx,%rdx
cmovne %rdx,%rsi
mov    %rsi,%rax
ret

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

LLVM IR (-O2):
define i64 @mi_sha256_remainder_size(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = urem i64 %0, %1
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i64 %1, i64 %5
br label %8
8: ; preds = %4, %2
%9 = phi i64 [ 0, %2 ], [ %7, %4 ]
ret i64 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int one() {
  printf("One called\n");
  return 1;
}


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

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

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

LLVM IR (-O2):
@str = [11 x i8] c"One called\00"
define i32 @one() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret i32 1
}
/* Variables and functions */
long long log(long long);
long long internal_log_l(long long value) { return log(value); }


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

x86 assembly (clang, -O2):
<internal_log_l>:
jmp    1030 <log@plt>

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

LLVM IR (-O2):
define i64 @internal_log_l(i64 %0) {
%2 = tail call i64 @log(i64 %0)
ret i64 %2
}
void security_sb_post_mountroot(void) {}


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

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

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

LLVM IR (-O2):
define void @security_sb_post_mountroot() {
ret void
}
double eval_mul(double x, double y) { return x * y; }


x86 assembly (clang, -O0):
<eval_mul>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<eval_mul>:
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @eval_mul(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fmul double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @eval_mul(double %0, double %1) {
%3 = fmul double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ k_flip();
void k_init(void) { k_flip(); }


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

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

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

LLVM IR (-O2):
define void @k_init() {
%1 = tail call i32 (...) @k_flip()
ret void
}
/* Type definitions */
struct fcb {
  int dummy;
};

/* Variables and functions */
int kf_delete_ptr(struct fcb *, int /*<<< orphan*/, unsigned char *,
                  unsigned int);
int kf7_delete_ptr(struct fcb *f, unsigned char t[], unsigned key_lc) {
  return (kf_delete_ptr(f, 0, t, key_lc));
}


x86 assembly (clang, -O0):
<kf7_delete_ptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
xor    %esi,%esi
call   1030 <kf_delete_ptr@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kf7_delete_ptr>:
mov    %edx,%ecx
mov    %rsi,%rdx
xor    %esi,%esi
jmp    1030 <kf_delete_ptr@plt>

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

LLVM IR (-O2):
%struct.fcb = type { i32 }
define i32 @kf7_delete_ptr(%struct.fcb* %0, i8* %1, i32 %2) {
%4 = tail call i32 @kf_delete_ptr(%struct.fcb* %0, i32 0, i8* %1, i32 %2)
ret i32 %4
}
int lw_sock_init() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @lw_sock_init() {
ret i32 0
}
/* Variables and functions */
int boolector_main(int, char **);
int main(int argc, char **argv) { return boolector_main(argc, argv); }


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @boolector_main(i32 %0, i8** %1)
ret i32 %3
}
/* Variables and functions */
int IndexOf2_internal(char *, char *, int const, char, char);
int IndexOf2(char *input, char *target, const int count) {
  return IndexOf2_internal(input, target, count, '\0', '\0');
}


x86 assembly (clang, -O0):
<IndexOf2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %r8d,%r8d
mov    %r8d,%ecx
call   1030 <IndexOf2_internal@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IndexOf2>:
xor    %ecx,%ecx
xor    %r8d,%r8d
jmp    1030 <IndexOf2_internal@plt>

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

LLVM IR (-O2):
define i32 @IndexOf2(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @IndexOf2_internal(i8* %0, i8* %1, i32 %2, i8 signext 0, i8 signext 0)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, double const);
int /*<<< orphan*/ stdout;
double func_double_param(const double d) {
  printf("c: got double (%g)\n", d);
  fflush(stdout);
  return 233.1;
}


x86 assembly (clang, -O0):
<func_double_param>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
movsd  0xeac(%rip),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func_double_param>:
push   %rax
lea    0xee0(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
movsd  0xebd(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [20 x i8] c"c: got double (%g)\0A\00"
@stdout = global i32 0
define double @func_double_param(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double %3)
%5 = load i32, i32* @stdout
%6 = call i32 @fflush(i32 %5)
ret double 2.331000e+02
}

LLVM IR (-O2):
@.str = [20 x i8] c"c: got double (%g)\0A\00"
@stdout = global i32 0
define double @func_double_param(double %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), double %0)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
ret double 2.331000e+02
}
/* Variables and functions */
int /*<<< orphan*/ inmidi_sysex(int, int);
int libpd_sysex(int port, int byte) {
  if (port < 0 || port > 0x0fff)
    return -1;
  if (byte < 0 || byte > 0x7f)
    return -1;
  inmidi_sysex(port, byte);
  return 0;
}


x86 assembly (clang, -O0):
<libpd_sysex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1135 <libpd_sysex+0x25>
cmpl   $0xfff,-0x8(%rbp)
jle    1141 <libpd_sysex+0x31>
movl   $0xffffffff,-0x4(%rbp)
jmp    1173 <libpd_sysex+0x63>
cmpl   $0x0,-0xc(%rbp)
jl     1155 <libpd_sysex+0x45>
cmpl   $0x7f,-0xc(%rbp)
jle    1161 <libpd_sysex+0x51>
movl   $0xffffffff,-0x4(%rbp)
jmp    1173 <libpd_sysex+0x63>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <inmidi_sysex@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libpd_sysex>:
mov    $0xffffffff,%eax
cmp    $0xfff,%edi
ja     112e <libpd_sysex+0x1e>
cmp    $0x7f,%esi
ja     112e <libpd_sysex+0x1e>
push   %rax
call   1030 <inmidi_sysex@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @libpd_sysex(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 slt i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 4095
br i1 %10, label %11, label %12
11: ; preds = %8, %2
store i32 -1, i32* %3
br label %23
12: ; preds = %8
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* %5
%17 = icmp sgt i32 %16, 127
br i1 %17, label %18, label %19
18: ; preds = %15, %12
store i32 -1, i32* %3
br label %23
19: ; preds = %15
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = call i32 @inmidi_sysex(i32 %20, i32 %21)
store i32 0, i32* %3
br label %23
23: ; preds = %19, %18, %11
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @libpd_sysex(i32 %0, i32 %1) {
%3 = icmp ugt i32 %0, 4095
%4 = icmp ugt i32 %1, 127
%5 = or i1 %3, %4
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @inmidi_sysex(i32 %0, i32 %1)
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ 0, %6 ], [ -1, %2 ]
ret i32 %9
}