xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *);
int /*<<< orphan*/ stderr;
void error(const char *routine, const char *text) {
  fprintf(stderr, " error (isinusinv.c/%s) : %s\n", routine, text);
}


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

x86 assembly (clang, -O2):
<error>:
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2ec3(%rip),%rax
mov    (%rax),%edi
lea    0xeda(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c" error (isinusinv.c/%s) : %s\0A\00"
define void @error(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c" error (isinusinv.c/%s) : %s\0A\00"
define void @error(i8* %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ err(int, char *, size_t);
void *realloc(void *, size_t);
void *xmalloc(size_t);
void *xrealloc(void *p, size_t size) {
  if (p == NULL)
    return (xmalloc(size));
  if ((p = realloc(p, size)) == NULL)
    err(1, "realloc(%zu)", size);
  return p;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115d <xrealloc+0x2d>
mov    -0x18(%rbp),%rdi
call   1030 <xmalloc@plt>
mov    %rax,-0x8(%rbp)
jmp    1195 <xrealloc+0x65>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <realloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    118d <xrealloc+0x5d>
mov    -0x18(%rbp),%rdx
mov    $0x1,%edi
lea    0xe78(%rip),%rsi
call   1040 <err@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rbx
mov    %rsi,%rbx
test   %rdi,%rdi
je     1148 <xrealloc+0x18>
mov    %rbx,%rsi
call   1050 <realloc@plt>
test   %rax,%rax
je     1151 <xrealloc+0x21>
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <xmalloc@plt>
lea    0xea8(%rip),%rsi
mov    $0x1,%edi
mov    %rbx,%rdx
call   1040 <err@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"realloc(%zu)\00"
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
%6 = load i8*, i8** %4
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i64, i64* %5
%10 = call i8* @xmalloc(i64 %9)
store i8* %10, i8** %3
br label %21
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = load i64, i64* %5
%14 = call i8* @realloc(i8* %12, i64 %13)
store i8* %14, i8** %4
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i64, i64* %5
%18 = call i32 @err(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 %17)
br label %19
19: ; preds = %16, %11
%20 = load i8*, i8** %4
store i8* %20, i8** %3
br label %21
21: ; preds = %19, %8
%22 = load i8*, i8** %3
ret i8* %22
}

LLVM IR (-O2):
@.str = [13 x i8] c"realloc(%zu)\00"
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i8* @xmalloc(i64 %1)
br label %11
6: ; preds = %2
%7 = tail call i8* @realloc(i8* %0, i64 %1)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 %1)
br label %11
11: ; preds = %6, %9, %4
%12 = phi i8* [ %5, %4 ], [ null, %9 ], [ %7, %6 ]
ret i8* %12
}
void fail_marker_detected(void) {}


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

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

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

LLVM IR (-O2):
define void @fail_marker_detected() {
ret void
}
putstk(typeobj) char typeobj;
{
  pop();
  if (typeobj == 1)
    call("ccpchar");
  else
    call("ccpint");
}


x86 assembly (clang, -O0):
<putstk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    $0x0,%al
call   1030 <pop@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x1,%eax
jne    1155 <putstk+0x35>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1040 <call@plt>
jmp    1163 <putstk+0x43>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <call@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putstk>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <pop@plt>
cmp    $0x1,%bl
lea    0xecc(%rip),%rax
lea    0xecd(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
pop    %rbx
jmp    1040 <call@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"ccpchar\00"
@.str.1 = [7 x i8] c"ccpint\00"
define i32 @putstk(i32 %0) {
%2 = alloca i32
%3 = alloca i8
%4 = trunc i32 %0 to i8
store i8 %4, i8* %3
%5 = call i32 (...) @pop()
%6 = load i8, i8* %3
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @call to i32 (i8*, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %13
11: ; preds = %1
%12 = call i32 (i8*, ...) bitcast (i32 (...)* @call to i32 (i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %9
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [8 x i8] c"ccpchar\00"
@.str.1 = [7 x i8] c"ccpint\00"
define i32 @putstk(i32 %0) {
%2 = tail call i32 (...) @pop()
%3 = and i32 %0, 255
%4 = icmp eq i32 %3, 1
%5 = select i1 %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0)
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @call to i32 (i8*, ...)*)(i8* %5)
ret i32 undef
}
/* Variables and functions */
int read(int, char *, int);
int pcsl_serial_readchar(int port, char *buffer, int size) {
  int result;
  result = read(port, buffer, size);
  return result;
}


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

x86 assembly (clang, -O2):
<pcsl_serial_readchar>:
jmp    1030 <read@plt>

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

LLVM IR (-O2):
define i32 @pcsl_serial_readchar(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @read(i32 %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int another_function_call(int, char *);
int /*<<< orphan*/ this_is_a_function_call(int, char *);
int this_is_a_function_def(int a, char *b) {
  this_is_a_function_call(a, b);
  a = another_function_call(a, b);
}


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

x86 assembly (clang, -O2):
<this_is_a_function_def>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
call   1040 <this_is_a_function_call@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <another_function_call@plt>

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

LLVM IR (-O2):
define i32 @this_is_a_function_def(i32 %0, i8* %1) {
%3 = tail call i32 @this_is_a_function_call(i32 %0, i8* %1)
%4 = tail call i32 @another_function_call(i32 %0, i8* %1)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ F_OK;
scalar_t__ access(char const *, int /*<<< orphan*/);
int os_fexists(const char *fname) {
  if (!fname)
    return (0);
  return ((0 == access(fname, F_OK)) ? 1 : 0);
}


x86 assembly (clang, -O0):
<os_fexists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <os_fexists+0x23>
movl   $0x0,-0x4(%rbp)
jmp    115c <os_fexists+0x4c>
mov    -0x10(%rbp),%rdi
mov    0x2e9a(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
mov    %rax,%rsi
xor    %eax,%eax
mov    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %rsi,%rdx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_fexists>:
test   %rdi,%rdi
je     1134 <os_fexists+0x24>
push   %rax
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@F_OK = global i32 0
define i32 @os_fexists(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
store i32 0, i32* %2
br label %14
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = load i32, i32* @F_OK
%10 = call i64 @access(i8* %8, i32 %9)
%11 = icmp eq i64 0, %10
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 1, i32 0
store i32 %13, i32* %2
br label %14
14: ; preds = %7, %6
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@F_OK = global i32 0
define i32 @os_fexists(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = load i32, i32* @F_OK
%5 = tail call i64 @access(i8* %0, i32 %4)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %1, %3
%9 = phi i32 [ %7, %3 ], [ 0, %1 ]
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
void out_null_member(FILE *out, const char *key) {
  fprintf(out, "\t/* %s is NULL */\n", key);
}


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

x86 assembly (clang, -O2):
<out_null_member>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"\09/* %s is NULL */\0A\00"
define void @out_null_member(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 = load i8*, i8** %4
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"\09/* %s is NULL */\0A\00"
define void @out_null_member(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
extern int baz(int a) { return a; }


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

x86 assembly (clang, -O2):
<baz>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @baz(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
char *writeBytes(char *, char *, int /*<<< orphan*/);
char *writeInt(char *, int /*<<< orphan*/);
char *writeString(char *buf, char *in, uint32_t len) {
  buf = writeInt(buf, len);
  buf = writeBytes(buf, in, len);
  return buf;
}


x86 assembly (clang, -O0):
<writeString>:
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    -0x14(%rbp),%esi
call   1030 <writeInt@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <writeBytes@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeString>:
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r14
mov    %edx,%esi
call   1030 <writeInt@plt>
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <writeBytes@plt>

LLVM IR (-O0):
define i8* @writeString(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 i32, i32* %6
%9 = call i8* @writeInt(i8* %7, i32 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = call i8* @writeBytes(i8* %10, i8* %11, i32 %12)
store i8* %13, i8** %4
%14 = load i8*, i8** %4
ret i8* %14
}

LLVM IR (-O2):
define i8* @writeString(i8* %0, i8* %1, i32 %2) {
%4 = tail call i8* @writeInt(i8* %0, i32 %2)
%5 = tail call i8* @writeBytes(i8* %4, i8* %1, i32 %2)
ret i8* %5
}
void page_tracker_wake_up(void) {}


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

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

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

LLVM IR (-O2):
define void @page_tracker_wake_up() {
ret void
}
int temp_to_eis5(int temp) {
  int eis5temp;
  eis5temp = (temp >> 3) & 0x07FF;
  eis5temp = eis5temp + (0x18 << 8);
  if (temp < 0) {
    eis5temp += 0x8000;
  }
  return eis5temp;
}


x86 assembly (clang, -O0):
<temp_to_eis5>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x3,%eax
and    $0x7ff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1800,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1135 <temp_to_eis5+0x35>
mov    -0x8(%rbp),%eax
add    $0x8000,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<temp_to_eis5>:
mov    %edi,%eax
shr    $0x3,%eax
and    $0x7ff,%eax
shr    $0x10,%edi
and    $0x8000,%edi
add    %edi,%eax
add    $0x1800,%eax
ret

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

LLVM IR (-O2):
define i32 @temp_to_eis5(i32 %0) {
%2 = lshr i32 %0, 3
%3 = and i32 %2, 2047
%4 = icmp slt i32 %0, 0
%5 = select i1 %4, i32 38912, i32 6144
%6 = or i32 %3, %5
ret i32 %6
}
__attribute__((visibility("default"))) void __ceylon_language_Basic_setup() {}


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

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

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

LLVM IR (-O2):
define void @__ceylon_language_Basic_setup() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void c64_set_freq_cia_a_irq(uint32_t hz) {}


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

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

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

LLVM IR (-O2):
define void @c64_set_freq_cia_a_irq(i32 %0) {
ret void
}
/* Type definitions */
struct timeval {
  int tv_usec;
  int /*<<< orphan*/ tv_sec;
};
struct timespec {
  int tv_nsec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
void timeval_to_timespec(struct timespec *ts, const struct timeval *tv) {
  ts->tv_sec = tv->tv_sec;
  ts->tv_nsec = tv->tv_usec * 1000;
}


x86 assembly (clang, -O0):
<timeval_to_timespec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%rax
imul   $0x3e8,(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeval_to_timespec>:
mov    0x4(%rsi),%eax
mov    %eax,0x4(%rdi)
imul   $0x3e8,(%rsi),%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
%struct.timeval = type { i32, i32 }
define void @timeval_to_timespec(%struct.timespec* %0, %struct.timeval* %1) {
%3 = alloca %struct.timespec*
%4 = alloca %struct.timeval*
store %struct.timespec* %0, %struct.timespec** %3
store %struct.timeval* %1, %struct.timeval** %4
%5 = load %struct.timeval*, %struct.timeval** %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
%7 = load i32, i32* %6
%8 = load %struct.timespec*, %struct.timespec** %3
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 1
store i32 %7, i32* %9
%10 = load %struct.timeval*, %struct.timeval** %4
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = mul nsw i32 %12, 1000
%14 = load %struct.timespec*, %struct.timespec** %3
%15 = getelementptr inbounds %struct.timespec, %struct.timespec* %14, i32 0, i32 0
store i32 %13, i32* %15
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
%struct.timeval = type { i32, i32 }
define void @timeval_to_timespec(%struct.timespec* nocapture writeonly %0, %struct.timeval* nocapture %1) {
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%4 = load i32, i32* %3
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
store i32 %4, i32* %5
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 1000
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
store i32 %8, i32* %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ create_command(int, int, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ send_command();
int wait_for_ack(int, int);
int camera_package_size(int bytes) {
  create_command(0x06, 0x08, bytes & 0xff, (bytes >> 8), 0);
  send_command();
  int result = wait_for_ack(100000, 0x06);
  printf("camera_package_size %d result=%d\n", 481, result);
  return result;
}


x86 assembly (clang, -O0):
<camera_package_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xff,%edx
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
mov    $0x6,%edi
mov    $0x8,%esi
xor    %r8d,%r8d
call   1060 <create_command@plt>
mov    $0x0,%al
call   1050 <send_command@plt>
mov    $0x186a0,%edi
mov    $0x6,%esi
call   1040 <wait_for_ack@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
lea    0xe71(%rip),%rdi
mov    $0x1e1,%esi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<camera_package_size>:
push   %rbx
mov    %edi,%ecx
movzbl %cl,%edx
sar    $0x8,%ecx
mov    $0x6,%edi
mov    $0x8,%esi
xor    %r8d,%r8d
call   1060 <create_command@plt>
xor    %eax,%eax
call   1050 <send_command@plt>
mov    $0x186a0,%edi
mov    $0x6,%esi
call   1040 <wait_for_ack@plt>
mov    %eax,%ebx
lea    0xe86(%rip),%rdi
mov    $0x1e1,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"camera_package_size %d result=%d\0A\00"
define i32 @camera_package_size(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 255
%6 = load i32, i32* %2
%7 = ashr i32 %6, 8
%8 = call i32 @create_command(i32 6, i32 8, i32 %5, i32 %7, i32 0)
%9 = call i32 (...) @send_command()
%10 = call i32 @wait_for_ack(i32 100000, i32 6)
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 481, i32 %11)
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@.str = [34 x i8] c"camera_package_size %d result=%d\0A\00"
define i32 @camera_package_size(i32 %0) {
%2 = and i32 %0, 255
%3 = ashr i32 %0, 8
%4 = tail call i32 @create_command(i32 6, i32 8, i32 %2, i32 %3, i32 0)
%5 = tail call i32 (...) @send_command()
%6 = tail call i32 @wait_for_ack(i32 100000, i32 6)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 481, i32 %6)
ret i32 %6
}
int ft_isascii(int c) {
  if ((c >= 0) && (c <= 127))
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<ft_isascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1127 <ft_isascii+0x27>
cmpl   $0x7f,-0x8(%rbp)
jg     1127 <ft_isascii+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <ft_isascii+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isascii>:
xor    %eax,%eax
cmp    $0x80,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @ft_isascii(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 127
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %11
10: ; preds = %6, %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @ft_isascii(i32 %0) {
%2 = icmp ult i32 %0, 128
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ glNormal3dv(double *);
void Normal3dv(double v[3]) { glNormal3dv(v); }


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

x86 assembly (clang, -O2):
<Normal3dv>:
jmp    1030 <glNormal3dv@plt>

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

LLVM IR (-O2):
define void @Normal3dv(double* %0) {
%2 = tail call i32 @glNormal3dv(double* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *, char *);
char *strerror(int /*<<< orphan*/);
void perror_exit(char *str, int code) {
  printf("%s: %s\n", str, strerror(errno));
  exit(code);
}


x86 assembly (clang, -O0):
<perror_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    -0x18(%rbp),%rsi
mov    %rax,%rdx
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<perror_exit>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xeb3(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1030 <printf@plt>
mov    %ebp,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"%s: %s\0A\00"
@errno = global i32 0
define void @perror_exit(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* @errno
%7 = call i8* @strerror(i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %7)
%9 = load i32, i32* %4
%10 = call i32 @exit(i32 %9)
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"%s: %s\0A\00"
@errno = global i32 0
define void @perror_exit(i8* %0, i32 %1) {
%3 = load i32, i32* @errno
%4 = tail call i8* @strerror(i32 %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %4)
%6 = tail call i32 @exit(i32 %1)
unreachable
}
/* Variables and functions */
int fatfs_fsync(int);
int fsync(int fd) { return fatfs_fsync(fd); }


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

x86 assembly (clang, -O2):
<fsync>:
jmp    1030 <fatfs_fsync@plt>

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

LLVM IR (-O2):
define i32 @fsync(i32 %0) {
%2 = tail call i32 @fatfs_fsync(i32 %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ atomic_long;

/* Variables and functions */
int /*<<< orphan*/ my_atomic_compare_exchange_strong(int /*<<< orphan*/ *,
                                                     long *,
                                                     int /*<<< orphan*/);
long readV(atomic_long *v) {
  long expected = 0;
  my_atomic_compare_exchange_strong(v, &expected, 0);
  return expected;
}


x86 assembly (clang, -O0):
<readV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1030 <my_atomic_compare_exchange_strong@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readV>:
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%rsi
xor    %edx,%edx
call   1030 <my_atomic_compare_exchange_strong@plt>
mov    (%rsp),%rax
pop    %rcx
ret

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

LLVM IR (-O2):
define i64 @readV(i32* %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%4 = call i32 @my_atomic_compare_exchange_strong(i32* %0, i64* %2, i32 0)
%5 = load i64, i64* %2
ret i64 %5
}
void f_empty() { return; }


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

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

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

LLVM IR (-O2):
define void @f_empty() {
ret void
}
int is_nop(unsigned int inst) { return (inst == 0xe1a00000); }


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

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

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

LLVM IR (-O2):
define i32 @is_nop(i32 %0) {
%2 = icmp eq i32 %0, -509607936
%3 = zext i1 %2 to i32
ret i32 %3
}
void gtk_text_tag_table_foreach() {}


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

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

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

LLVM IR (-O2):
define void @gtk_text_tag_table_foreach() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ PKCS12_MAC_DATA;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
int /*<<< orphan*/ ASN1_item_free(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ PKCS12_MAC_DATA_it;
void PKCS12_MAC_DATA_free(PKCS12_MAC_DATA *a) {
  ASN1_item_free((ASN1_VALUE *)a, &PKCS12_MAC_DATA_it);
}


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

x86 assembly (clang, -O2):
<PKCS12_MAC_DATA_free>:
mov    0x2ed1(%rip),%rsi
jmp    1030 <ASN1_item_free@plt>

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

LLVM IR (-O2):
@PKCS12_MAC_DATA_it = global i32 0
define void @PKCS12_MAC_DATA_free(i32* %0) {
%2 = tail call i32 @ASN1_item_free(i32* %0, i32* @PKCS12_MAC_DATA_it)
ret void
}
void __flush_tlb_single(unsigned long addr) {
  asm volatile("invlpg (%0)" : : "r"(addr) : "memory");
}


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

x86 assembly (clang, -O2):
<__flush_tlb_single>:
invlpg (%rdi)
ret

LLVM IR (-O0):
define void @__flush_tlb_single(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
ret void
}

LLVM IR (-O2):
define void @__flush_tlb_single(i64 %0) {
tail call void asm sideeffect "invlpg ($0)", "r,~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret void
}
/* Variables and functions */
int strcasecmp(char const *, char const *);
int cgi_cmp_str(const char **aa, const char **bb) {
  return (strcasecmp((*aa), (*bb)));
}


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

x86 assembly (clang, -O2):
<cgi_cmp_str>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcasecmp@plt>

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

LLVM IR (-O2):
define i32 @cgi_cmp_str(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
%5 = tail call i32 @strcasecmp(i8* %3, i8* %4)
ret i32 %5
}
/* Variables and functions */
int f();
int g();
int h();
main() { return f() + g() + h(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <f@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1050 <g@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <h@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <f@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <g@plt>
mov    %eax,%ebp
add    %ebx,%ebp
xor    %eax,%eax
call   1030 <h@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @f()
%3 = call i32 (...) @g()
%4 = add nsw i32 %2, %3
%5 = call i32 (...) @h()
%6 = add nsw i32 %4, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @f()
%2 = tail call i32 (...) @g()
%3 = add nsw i32 %2, %1
%4 = tail call i32 (...) @h()
%5 = add nsw i32 %3, %4
ret i32 %5
}
int get_com(prompt, command)
char *prompt;
char *command;
{
  int res;
  if (prompt)
    prt(prompt, 0, 0);
  *command = inkey();
  if (*command == '\033')
    res = 0;
  else
    res = 1;
  erase_line(0, 0);
  return (res);
}


x86 assembly (clang, -O0):
<get_com>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     115a <get_com+0x2a>
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1030 <prt@plt>
mov    $0x0,%al
call   1050 <inkey@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x1b,%eax
jne    1185 <get_com+0x55>
movl   $0x0,-0x14(%rbp)
jmp    118c <get_com+0x5c>
movl   $0x1,-0x14(%rbp)
xor    %esi,%esi
mov    %esi,%edi
mov    $0x0,%al
call   1040 <erase_line@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_com>:
push   %rbx
mov    %rsi,%rbx
test   %rdi,%rdi
je     1144 <get_com+0x14>
xor    %esi,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1030 <prt@plt>
xor    %eax,%eax
call   1050 <inkey@plt>
mov    %al,(%rbx)
xor    %ebx,%ebx
cmp    $0x1b,%al
setne  %bl
xor    %edi,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <erase_line@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get_com(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** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @prt to i32 (i8*, i32, i32, ...)*)(i8* %9, i32 0, i32 0)
br label %11
11: ; preds = %8, %2
%12 = call i32 (...) @inkey()
%13 = trunc i32 %12 to i8
%14 = load i8*, i8** %4
store i8 %13, i8* %14
%15 = load i8*, i8** %4
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 27
br i1 %18, label %19, label %20
19: ; preds = %11
store i32 0, i32* %5
br label %21
20: ; preds = %11
store i32 1, i32* %5
br label %21
21: ; preds = %20, %19
%22 = call i32 (i32, i32, ...) bitcast (i32 (...)* @erase_line to i32 (i32, i32, ...)*)(i32 0, i32 0)
%23 = load i32, i32* %5
ret i32 %23
}

LLVM IR (-O2):
define i32 @get_com(i8* %0, i8* nocapture writeonly %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @prt to i32 (i8*, i32, i32, ...)*)(i8* %0, i32 0, i32 0)
br label %6
6: ; preds = %4, %2
%7 = tail call i32 (...) @inkey()
%8 = trunc i32 %7 to i8
store i8 %8, i8* %1
%9 = and i32 %7, 255
%10 = icmp ne i32 %9, 27
%11 = zext i1 %10 to i32
%12 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @erase_line to i32 (i32, i32, ...)*)(i32 0, i32 0)
ret i32 %11
}
toupper(int c) {
  if (c < 'a' || c > 'z')
    return c;
  return (c - 'a' + 'A');
}


x86 assembly (clang, -O0):
<toupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x61,-0x8(%rbp)
jl     111b <toupper+0x1b>
cmpl   $0x7a,-0x8(%rbp)
jle    1126 <toupper+0x26>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1132 <toupper+0x32>
mov    -0x8(%rbp),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toupper>:
lea    -0x7b(%rdi),%ecx
lea    -0x20(%rdi),%eax
cmp    $0xffffffe6,%ecx
cmovb  %edi,%eax
ret

LLVM IR (-O0):
define i32 @toupper(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 97
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, 122
br i1 %8, label %9, label %11
9: ; preds = %6, %1
%10 = load i32, i32* %3
store i32 %10, i32* %2
br label %15
11: ; preds = %6
%12 = load i32, i32* %3
%13 = sub nsw i32 %12, 97
%14 = add nsw i32 %13, 65
store i32 %14, i32* %2
br label %15
15: ; preds = %11, %9
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @toupper(i32 %0) {
%2 = add i32 %0, -123
%3 = icmp ult i32 %2, -26
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ swap(char *, int, int);
void reverse(char *str, size_t n) {
  int left = 0;
  int right = n - 1;
  while (left < right) {
    swap(str, left, right);
    ++left;
    --right;
  }
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
sub    $0x1,%rax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1164 <reverse+0x54>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <swap@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1132 <reverse+0x22>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
add    $0xffffffff,%ebx
test   %ebx,%ebx
jle    114d <reverse+0x3d>
mov    %rdi,%r14
mov    $0x1,%r15d
nopl   0x0(%rax,%rax,1)
lea    -0x1(%r15),%esi
mov    %r14,%rdi
mov    %ebx,%edx
call   1030 <swap@plt>
add    $0xffffffff,%ebx
lea    0x1(%r15),%eax
cmp    %ebx,%r15d
mov    %eax,%r15d
jl     1130 <reverse+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @reverse(i8* %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = add i32 %3, -1
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %2, %6
%7 = phi i32 [ %11, %6 ], [ %4, %2 ]
%8 = phi i32 [ %10, %6 ], [ 0, %2 ]
%9 = tail call i32 @swap(i8* %0, i32 %8, i32 %7)
%10 = add nuw nsw i32 %8, 1
%11 = add nsw i32 %7, -1
%12 = icmp slt i32 %10, %11
br i1 %12, label %6, label %13
13: ; preds = %6, %2
ret void
}
void h(int y) {}


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

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

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

LLVM IR (-O2):
define void @h(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *);
void fail(const char *msg) {
  printf("ERROR: %s\n", msg);
  exit(1);
}


x86 assembly (clang, -O0):
<fail>:
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    $0x1,%edi
call   1040 <exit@plt>

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"ERROR: %s\0A\00"
define void @fail(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
_Bool or (_Bool x, _Bool y) { return x || y; }


x86 assembly (clang, -O0):
<or>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
and    $0x1,%cl
mov    %cl,-0x1(%rbp)
and    $0x1,%al
mov    %al,-0x2(%rbp)
mov    $0x1,%al
testb  $0x1,-0x1(%rbp)
mov    %al,-0x3(%rbp)
jne    112a <or+0x2a>
mov    -0x2(%rbp),%al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i1 @or(i1 zeroext %0, i1 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = zext i1 %0 to i8
store i8 %5, i8* %3
%6 = zext i1 %1 to i8
store i8 %6, i8* %4
%7 = load i8, i8* %3
%8 = trunc i8 %7 to i1
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = load i8, i8* %4
%11 = trunc i8 %10 to i1
br label %12
12: ; preds = %9, %2
%13 = phi i1 [ true, %2 ], [ %11, %9 ]
ret i1 %13
}

LLVM IR (-O2):
define zeroext i1 @or(i1 zeroext %0, i1 zeroext %1) {
%3 = or i1 %0, %1
ret i1 %3
}
/* Variables and functions */
int /*<<< orphan*/ lcd44780_command(int);
void lcd44780_init(void) {
  lcd44780_command(0x38);
  lcd44780_command(0x06);
  lcd44780_command(0x0f);
  lcd44780_command(0x01);
}


x86 assembly (clang, -O0):
<lcd44780_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x38,%edi
call   1030 <lcd44780_command@plt>
mov    $0x6,%edi
call   1030 <lcd44780_command@plt>
mov    $0xf,%edi
call   1030 <lcd44780_command@plt>
mov    $0x1,%edi
call   1030 <lcd44780_command@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd44780_init>:
push   %rax
mov    $0x38,%edi
call   1030 <lcd44780_command@plt>
mov    $0x6,%edi
call   1030 <lcd44780_command@plt>
mov    $0xf,%edi
call   1030 <lcd44780_command@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <lcd44780_command@plt>

LLVM IR (-O0):
define void @lcd44780_init() {
%1 = call i32 @lcd44780_command(i32 56)
%2 = call i32 @lcd44780_command(i32 6)
%3 = call i32 @lcd44780_command(i32 15)
%4 = call i32 @lcd44780_command(i32 1)
ret void
}

LLVM IR (-O2):
define void @lcd44780_init() {
%1 = tail call i32 @lcd44780_command(i32 56)
%2 = tail call i32 @lcd44780_command(i32 6)
%3 = tail call i32 @lcd44780_command(i32 15)
%4 = tail call i32 @lcd44780_command(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void pb_overflow(void) {
  (1 || 1 ? printf("\x1b[31;1m[SBMP][E] "
                   "PayloadBuilder overflow."
                   "\x1b[0m\n")
          : 0);
}


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

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

LLVM IR (-O0):
@.str = [47 x i8] c"\1B[31;1m[SBMP][E] PayloadBuilder overflow.\1B[0m\0A\00"
define void @pb_overflow() {
%1 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [46 x i8] c"\1B[31;1m[SBMP][E] PayloadBuilder overflow.\1B[0m\00"
define void @pb_overflow() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ generateString(int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int lineCount;
  scanf("%d", &lineCount);
  generateString(lineCount);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1030 <generateString@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @generateString(i32 %4)
ret i32 0
}
/* Variables and functions */
scalar_t__ BLKGETSIZE64;
int /*<<< orphan*/ ioctl(int const, int, size_t *);
size_t blockDeviceSizeFromFD(const int fd) {
  size_t file_size_in_bytes = 0;
  ioctl(fd, (int)(BLKGETSIZE64), &file_size_in_bytes);
  return file_size_in_bytes;
}


x86 assembly (clang, -O0):
<blockDeviceSizeFromFD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%rax
mov    %eax,%esi
lea    -0x10(%rbp),%rdx
call   1030 <ioctl@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blockDeviceSizeFromFD>:
push   %rax
movq   $0x0,(%rsp)
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
call   1030 <ioctl@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
@BLKGETSIZE64 = global i64 0
define i64 @blockDeviceSizeFromFD(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
store i64 0, i64* %3
%4 = load i32, i32* %2
%5 = load i64, i64* @BLKGETSIZE64
%6 = trunc i64 %5 to i32
%7 = call i32 @ioctl(i32 %4, i32 %6, i64* %3)
%8 = load i64, i64* %3
ret i64 %8
}

LLVM IR (-O2):
@BLKGETSIZE64 = global i64 0
define i64 @blockDeviceSizeFromFD(i32 %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%4 = load i64, i64* @BLKGETSIZE64
%5 = trunc i64 %4 to i32
%6 = call i32 @ioctl(i32 %0, i32 %5, i64* %2)
%7 = load i64, i64* %2
ret i64 %7
}