xunge/DecIR huggingface dataset:
/* Type definitions */
struct mg_connection {
  int dummy;
};

/* Variables and functions */
scalar_t__ mg_out(struct mg_connection *, void const *, int);
int mg_send(struct mg_connection *conn, const void *buf, int len) {
  return (int)mg_out(conn, buf, len);
}


x86 assembly (clang, -O0):
<mg_send>:
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
call   1030 <mg_out@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mg_send>:
jmp    1030 <mg_out@plt>

LLVM IR (-O0):
%struct.mg_connection = type { i32 }
define i32 @mg_send(%struct.mg_connection* %0, i8* %1, i32 %2) {
%4 = alloca %struct.mg_connection*
%5 = alloca i8*
%6 = alloca i32
store %struct.mg_connection* %0, %struct.mg_connection** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load %struct.mg_connection*, %struct.mg_connection** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i64 @mg_out(%struct.mg_connection* %7, i8* %8, i32 %9)
%11 = trunc i64 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
%struct.mg_connection = type { i32 }
define i32 @mg_send(%struct.mg_connection* %0, i8* %1, i32 %2) {
%4 = tail call i64 @mg_out(%struct.mg_connection* %0, i8* %1, i32 %2)
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Variables and functions */
int symlink(char const *, char const *);
int create_symlink(const char *oldname, const char *newname, const int is_dir) {
  return symlink(oldname, newname);
}


x86 assembly (clang, -O0):
<create_symlink>:
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
call   1030 <symlink@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_symlink>:
jmp    1030 <symlink@plt>

LLVM IR (-O0):
define i32 @create_symlink(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 = call i32 @symlink(i8* %7, i8* %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @create_symlink(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @symlink(i8* %0, i8* %1)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fread(void *, int, int, int /*<<< orphan*/ *);
int _read_file(void *ptr, int size, int n, void *arg) {
  FILE *f = (FILE *)arg;
  return fread(ptr, size, n, f);
}


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

x86 assembly (clang, -O2):
<_read_file>:
jmp    1030 <fread@plt>

LLVM IR (-O0):
define i32 @_read_file(i8* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%10 = load i8*, i8** %8
%11 = bitcast i8* %10 to i32*
store i32* %11, i32** %9
%12 = load i8*, i8** %5
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = load i32*, i32** %9
%16 = call i32 @fread(i8* %12, i32 %13, i32 %14, i32* %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @_read_file(i8* nocapture %0, i32 %1, i32 %2, i8* nocapture %3) {
%5 = bitcast i8* %3 to i32*
%6 = tail call i32 @fread(i8* %0, i32 %1, i32 %2, i32* %5)
ret i32 %6
}
/* Type definitions */
typedef scalar_t__ wint_t;

/* Variables and functions */
int isalnum(scalar_t__);
int iswalnum(wint_t wc) { return ((wc < (wint_t)0x100 ? isalnum(wc) : 0)); }


x86 assembly (clang, -O0):
<iswalnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x100,-0x8(%rbp)
jge    113b <iswalnum+0x2b>
mov    -0x8(%rbp),%rdi
call   1030 <isalnum@plt>
mov    %eax,-0xc(%rbp)
jmp    1145 <iswalnum+0x35>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    1145 <iswalnum+0x35>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iswalnum>:
cmp    $0xff,%rdi
jg     111e <iswalnum+0xe>
jmp    1030 <isalnum@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @iswalnum(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 256
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i64, i64* %2
%7 = call i32 @isalnum(i64 %6)
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %5
%10 = phi i32 [ %7, %5 ], [ 0, %8 ]
ret i32 %10
}

LLVM IR (-O2):
define i32 @iswalnum(i64 %0) {
%2 = icmp slt i64 %0, 256
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @isalnum(i64 %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
void doStuff_constStaticSizedArray(const int a[10]) {}


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

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

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

LLVM IR (-O2):
define void @doStuff_constStaticSizedArray(i32* nocapture %0) {
ret void
}
int p_worker_stat() { return -142; }


x86 assembly (clang, -O0):
<p_worker_stat>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffff72,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @p_worker_stat() {
ret i32 -142
}

LLVM IR (-O2):
define i32 @p_worker_stat() {
ret i32 -142
}
/* Variables and functions */
long time(int /*<<< orphan*/);
long gnat_time(void) { return time(0); }


x86 assembly (clang, -O0):
<gnat_time>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <time@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gnat_time>:
xor    %edi,%edi
jmp    1030 <time@plt>

LLVM IR (-O0):
define i64 @gnat_time() {
%1 = call i64 @time(i32 0)
ret i64 %1
}

LLVM IR (-O2):
define i64 @gnat_time() {
%1 = tail call i64 @time(i32 0)
ret i64 %1
}
void mstart() {}


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

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

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

LLVM IR (-O2):
define void @mstart() {
ret void
}
int wpas_wps_ssid_bss_match(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
                            struct wpa_scan_res *bss) {
  return -1;
}


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

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

LLVM IR (-O0):
%struct.wpa_supplicant = type opaque
%struct.wpa_ssid = type opaque
%struct.wpa_scan_res = type opaque
define i32 @wpas_wps_ssid_bss_match(%struct.wpa_supplicant* %0, %struct.wpa_ssid* %1, %struct.wpa_scan_res* %2) {
%4 = alloca %struct.wpa_supplicant*
%5 = alloca %struct.wpa_ssid*
%6 = alloca %struct.wpa_scan_res*
store %struct.wpa_supplicant* %0, %struct.wpa_supplicant** %4
store %struct.wpa_ssid* %1, %struct.wpa_ssid** %5
store %struct.wpa_scan_res* %2, %struct.wpa_scan_res** %6
ret i32 -1
}

LLVM IR (-O2):
%struct.wpa_supplicant = type opaque
%struct.wpa_ssid = type opaque
%struct.wpa_scan_res = type opaque
define i32 @wpas_wps_ssid_bss_match(%struct.wpa_supplicant* nocapture readnone %0, %struct.wpa_ssid* nocapture readnone %1, %struct.wpa_scan_res* nocapture readnone %2) {
ret i32 -1
}
char *sljit_get_platform_name() { return "arm-thumb2"; }


x86 assembly (clang, -O0):
<sljit_get_platform_name>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sljit_get_platform_name>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [11 x i8] c"arm-thumb2\00"
define i8* @sljit_get_platform_name() {
ret i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [11 x i8] c"arm-thumb2\00"
define i8* @sljit_get_platform_name() {
ret i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *name) {
  fprintf(stderr, "Usage: %s\n", name);
  exit(1);
}


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

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

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"Usage: %s\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage() { printf("Usage: main -c -s [IP] -p [PORT]\n"); }


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

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

LLVM IR (-O0):
@.str = [34 x i8] c"Usage: main -c -s [IP] -p [PORT]\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [33 x i8] c"Usage: main -c -s [IP] -p [PORT]\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void *fn(void *n) {
  printf("in thread\n");
  return NULL;
}


x86 assembly (clang, -O0):
<fn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@str = [10 x i8] c"in thread\00"
define noalias i8* @fn(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
ret i8* null
}
int check_substring(char s1[], char s2[]) {
  int i, j = 0, check;
  for (i = 0; s1[i] != '\0';) {
    if (s2[j] == s1[i]) {
      check = 1;
      ++i;
      ++j;
      continue;
    } else {
      check = 0;
      break;
    }
  }
  return check;
}


x86 assembly (clang, -O0):
<check_substring>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1174 <check_substring+0x74>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x8(%rbp),%rcx
movslq -0x14(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    116d <check_substring+0x6d>
movl   $0x1,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    111a <check_substring+0x1a>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_substring>:
mov    (%rdi),%cl
mov    $0x1,%eax
test   %cl,%cl
je     1122 <check_substring+0x22>
xor    %edx,%edx
nopl   (%rax)
cmp    %cl,(%rsi,%rdx,1)
jne    1123 <check_substring+0x23>
movzbl 0x1(%rdi,%rdx,1),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1110 <check_substring+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @check_substring(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %11
%6 = phi i64 [ %12, %11 ], [ 0, %2 ]
%7 = phi i8 [ %14, %11 ], [ %3, %2 ]
%8 = getelementptr inbounds i8, i8* %1, i64 %6
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, %7
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = add nuw i64 %6, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %11, %5, %2
%17 = phi i32 [ 1, %2 ], [ 0, %5 ], [ 1, %11 ]
ret i32 %17
}
int clist_unlink(const char *fname) { return ((-9)); }


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

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

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

LLVM IR (-O2):
define i32 @clist_unlink(i8* nocapture readnone %0) {
ret i32 -9
}
/* Variables and functions */
int istrlen(char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  printf("str lenth is %u\n", istrlen("this is a function\0"));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xedb(%rip),%rdi
call   1030 <istrlen@plt>
mov    %eax,%esi
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee9(%rip),%rdi
call   1030 <istrlen@plt>
lea    0xecc(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"str lenth is %u\0A\00"
@.str.1 = [20 x i8] c"this is a function\00\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @istrlen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"str lenth is %u\0A\00"
@.str.1 = [20 x i8] c"this is a function\00\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @istrlen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
unsigned char *cbor_write_type_size(unsigned char *, unsigned int, int,
                                    unsigned int);
unsigned char *cbor_write_array(unsigned char *data, unsigned int size,
                                unsigned int array_size) {
  return cbor_write_type_size(data, size, 4, array_size);
}


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

x86 assembly (clang, -O2):
<cbor_write_array>:
mov    %edx,%ecx
mov    $0x4,%edx
jmp    1030 <cbor_write_type_size@plt>

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

LLVM IR (-O2):
define i8* @cbor_write_array(i8* %0, i32 %1, i32 %2) {
%4 = tail call i8* @cbor_write_type_size(i8* %0, i32 %1, i32 4, i32 %2)
ret i8* %4
}
/* Type definitions */
struct stack {
  int dummy;
};

/* Variables and functions */
void *pop_node(struct stack *);
void unwind_stack(struct stack *stack) {
  if (stack == NULL) {
    return;
  }
  void *data = NULL;
  do {
    data = pop_node(stack);
  } while (data != NULL);
  return;
}


x86 assembly (clang, -O0):
<unwind_stack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <unwind_stack+0x1c>
jmp    1151 <unwind_stack+0x41>
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pop_node@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <unwind_stack+0x24>
jmp    1151 <unwind_stack+0x41>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unwind_stack>:
push   %rbx
test   %rdi,%rdi
je     112d <unwind_stack+0x1d>
mov    %rdi,%rbx
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <pop_node@plt>
test   %rax,%rax
jne    1120 <unwind_stack+0x10>
pop    %rbx
ret

LLVM IR (-O0):
%struct.stack = type { i32 }
define void @unwind_stack(%struct.stack* %0) {
%2 = alloca %struct.stack*
%3 = alloca i8*
store %struct.stack* %0, %struct.stack** %2
%4 = load %struct.stack*, %struct.stack** %2
%5 = icmp eq %struct.stack* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
br label %15
7: ; preds = %1
store i8* null, i8** %3
br label %8
8: ; preds = %11, %7
%9 = load %struct.stack*, %struct.stack** %2
%10 = call i8* @pop_node(%struct.stack* %9)
store i8* %10, i8** %3
br label %11
11: ; preds = %8
%12 = load i8*, i8** %3
%13 = icmp ne i8* %12, null
br i1 %13, label %8, label %14
14: ; preds = %11
br label %15
15: ; preds = %14, %6
ret void
}

LLVM IR (-O2):
%struct.stack = type { i32 }
define void @unwind_stack(%struct.stack* %0) {
%2 = icmp eq %struct.stack* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1, %3
%4 = tail call i8* @pop_node(%struct.stack* %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %3
6: ; preds = %3, %1
ret void
}
void __hlt_stackmap_done() {}


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

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

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

LLVM IR (-O2):
define void @__hlt_stackmap_done() {
ret void
}
__attribute__((section("kprobe/dummy"), used)) int
kprobe__dummy(struct pt_regs *ctx) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.pt_regs = type opaque
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 (%struct.pt_regs*)* @kprobe__dummy to i8*)], section "llvm.metadata"
define i32 @kprobe__dummy(%struct.pt_regs* %0) section "kprobe/dummy" {
%2 = alloca %struct.pt_regs*
store %struct.pt_regs* %0, %struct.pt_regs** %2
ret i32 0
}

LLVM IR (-O2):
%struct.pt_regs = type opaque
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 (%struct.pt_regs*)* @kprobe__dummy to i8*)], section "llvm.metadata"
define i32 @kprobe__dummy(%struct.pt_regs* nocapture readnone %0) section "kprobe/dummy" {
ret i32 0
}
/* Variables and functions */
int NDigits(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int n;
  printf("number n :");
  scanf("%d", &n);
  printf("Its has %d digits.\n", NDigits(n));
  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)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x14(%rbp),%edi
call   1040 <NDigits@plt>
mov    %eax,%esi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <NDigits@plt>
lea    0xeae(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"number n :\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"Its has %d digits.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%9 = load i32, i32* %6
%10 = call i32 @NDigits(i32 %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"number n :\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"Its has %d digits.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = call i32 @NDigits(i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ dump_stack();
int /*<<< orphan*/ pr_info(char *);
int myinit(void) {
  pr_info("dump_stack myinit\n");
  dump_stack();
  pr_info("dump_stack after\n");
  return 0;
}


x86 assembly (clang, -O0):
<myinit>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <pr_info@plt>
mov    $0x0,%al
call   1040 <dump_stack@plt>
lea    0xed5(%rip),%rdi
call   1030 <pr_info@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<myinit>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <pr_info@plt>
xor    %eax,%eax
call   1040 <dump_stack@plt>
lea    0xed8(%rip),%rdi
call   1030 <pr_info@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"dump_stack myinit\0A\00"
@.str.1 = [18 x i8] c"dump_stack after\0A\00"
define i32 @myinit() {
%1 = call i32 @pr_info(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @dump_stack()
%3 = call i32 @pr_info(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"dump_stack myinit\0A\00"
@.str.1 = [18 x i8] c"dump_stack after\0A\00"
define i32 @myinit() {
%1 = tail call i32 @pr_info(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @dump_stack()
%3 = tail call i32 @pr_info(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char const *, char const *);
bool hashmapStringEquals(void *key_a, void *key_b) {
  return !strcmp((const char *)key_a, (const char *)key_b);
}


x86 assembly (clang, -O0):
<hashmapStringEquals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashmapStringEquals>:
push   %rax
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @hashmapStringEquals(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @strcmp(i8* %5, i8* %6)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @hashmapStringEquals(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
scalar_t__ _mm_extract_epi16(int /*<<< orphan*/, int);
int foo16(__m128i x) { return (short)_mm_extract_epi16(x, 3); }


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

x86 assembly (clang, -O2):
<foo16>:
push   %rax
mov    $0x3,%esi
call   1030 <_mm_extract_epi16@plt>
cwtl
pop    %rcx
ret

LLVM IR (-O0):
define i32 @foo16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @_mm_extract_epi16(i32 %3, i32 3)
%5 = trunc i64 %4 to i16
%6 = sext i16 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @foo16(i32 %0) {
%2 = tail call i64 @_mm_extract_epi16(i32 %0, i32 3)
%3 = trunc i64 %2 to i32
%4 = shl i32 %3, 16
%5 = ashr exact i32 %4, 16
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char);
int /*<<< orphan*/ stderr;
void _pst_debug_hexprint(char *data, int size) {
  int i = 0;
  while (i < size) {
    fprintf(stderr, "%02hhX", data[i]);
    i++;
  }
}


x86 assembly (clang, -O0):
<_pst_debug_hexprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1161 <_pst_debug_hexprint+0x51>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
lea    0xeb6(%rip),%rsi
movsbl (%rax,%rcx,1),%edx
call   1030 <fprintf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <_pst_debug_hexprint+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_pst_debug_hexprint>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %esi,%esi
jle    115a <_pst_debug_hexprint+0x4a>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
mov    0x2eb4(%rip),%r13
lea    0xecd(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x0(%r13),%edi
movsbl (%r15,%rbx,1),%edx
mov    %r14,%rsi
call   1030 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <_pst_debug_hexprint+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [7 x i8] c"%02hhX\00"
define void @_pst_debug_hexprint(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = load i32, i32* @stderr
%9 = getelementptr inbounds i8, i8* %0, i64 %7
%10 = load i8, i8* %9
%11 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 signext %10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ foo(int, int);
int main() {
  foo(1, 2);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <foo@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <foo@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 1, i32 2)
%2 = tail call i32 @exit(i32 0)
unreachable
}
float rect(float n, float N, float a) {
  (void)a;
  return n >= 0.0 && n < N ? 1.0 : 0.0;
}


x86 assembly (clang, -O0):
<rect>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0xd(%rbp)
jb     1141 <rect+0x41>
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
seta   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
movsd  0xeb4(%rip),%xmm0
xorps  %xmm1,%xmm1
movsd  %xmm1,-0x20(%rbp)
test   $0x1,%al
movsd  %xmm0,-0x18(%rbp)
jne    116b <rect+0x6b>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rect>:
xorps  %xmm2,%xmm2
cmpless %xmm0,%xmm2
cmpltss %xmm1,%xmm0
movss  0xeeb(%rip),%xmm1
andps  %xmm1,%xmm0
andps  %xmm2,%xmm0
ret

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

LLVM IR (-O2):
define float @rect(float %0, float %1, float %2) {
%4 = fcmp oge float %0, 0.000000e+00
%5 = fcmp olt float %0, %1
%6 = and i1 %4, %5
%7 = select i1 %6, float 1.000000e+00, float 0.000000e+00
ret float %7
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void SDIO_IRQHandler() { default_handler(); }


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

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

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

LLVM IR (-O2):
define weak void @SDIO_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ echo();
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ nocbreak();
int /*<<< orphan*/ noraw();
int /*<<< orphan*/ refresh();
void limbs_disp_close(void) {
  echo();
  noraw();
  nocbreak();
  refresh();
  endwin();
  return;
}


x86 assembly (clang, -O0):
<limbs_disp_close>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <echo@plt>
mov    $0x0,%al
call   1040 <noraw@plt>
mov    $0x0,%al
call   1070 <nocbreak@plt>
mov    $0x0,%al
call   1050 <refresh@plt>
mov    $0x0,%al
call   1060 <endwin@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<limbs_disp_close>:
push   %rax
xor    %eax,%eax
call   1030 <echo@plt>
xor    %eax,%eax
call   1040 <noraw@plt>
xor    %eax,%eax
call   1070 <nocbreak@plt>
xor    %eax,%eax
call   1050 <refresh@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <endwin@plt>

LLVM IR (-O0):
define void @limbs_disp_close() {
%1 = call i32 (...) @echo()
%2 = call i32 (...) @noraw()
%3 = call i32 (...) @nocbreak()
%4 = call i32 (...) @refresh()
%5 = call i32 (...) @endwin()
ret void
}

LLVM IR (-O2):
define void @limbs_disp_close() {
%1 = tail call i32 (...) @echo()
%2 = tail call i32 (...) @noraw()
%3 = tail call i32 (...) @nocbreak()
%4 = tail call i32 (...) @refresh()
%5 = tail call i32 (...) @endwin()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ portctl(char, int, char *);
int fanoff() {
  int pin = 0;
  char mask = 0x20;
  portctl(mask, pin, "fanoff");
  return 0;
}


x86 assembly (clang, -O0):
<fanoff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x20,-0x5(%rbp)
mov    -0x5(%rbp),%al
mov    -0x4(%rbp),%esi
lea    0xed0(%rip),%rdx
movsbl %al,%edi
call   1030 <portctl@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fanoff>:
push   %rax
lea    0xee8(%rip),%rdx
mov    $0x20,%edi
xor    %esi,%esi
call   1030 <portctl@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"fanoff\00"
define i32 @fanoff() {
%1 = tail call i32 @portctl(i8 signext 32, i32 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void __fail(char *s) {}


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

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

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

LLVM IR (-O2):
define void @__fail(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
double pow(int, int);
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ puts(char *);
int main(void) {
  puts("Hello, World!");
  printf("2^2 = %f", pow(2, 2));
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%esi
mov    %esi,%edi
call   1050 <pow@plt>
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e76(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%edi
mov    $0x2,%esi
call   1050 <pow@plt>
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e81(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello, World!\00"
@.str.1 = [9 x i8] c"2^2 = %f\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = call double @pow(i32 2, i32 2)
%4 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %3)
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello, World!\00"
@.str.1 = [9 x i8] c"2^2 = %f\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = tail call double @pow(i32 2, i32 2)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double %2)
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
long extract_bd(unsigned long insn, int *invalid) {
  if ((insn & 0x8000) != 0)
    return (insn & 0xfffc) - 0x10000;
  else
    return insn & 0xfffc;
}


x86 assembly (clang, -O0):
<extract_bd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
and    $0x8000,%rax
cmp    $0x0,%rax
je     1139 <extract_bd+0x39>
mov    -0x10(%rbp),%rax
and    $0xfffc,%rax
sub    $0x10000,%rax
mov    %rax,-0x8(%rbp)
jmp    1147 <extract_bd+0x47>
mov    -0x10(%rbp),%rax
and    $0xfffc,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_bd>:
mov    %edi,%ecx
and    $0xfffc,%ecx
lea    -0x10000(%rcx),%rax
test   $0x8000,%edi
cmove  %rcx,%rax
ret

LLVM IR (-O0):
define i64 @extract_bd(i64 %0, i32* %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32*
store i64 %0, i64* %4
store i32* %1, i32** %5
%6 = load i64, i64* %4
%7 = and i64 %6, 32768
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i64, i64* %4
%11 = and i64 %10, 65532
%12 = sub i64 %11, 65536
store i64 %12, i64* %3
br label %16
13: ; preds = %2
%14 = load i64, i64* %4
%15 = and i64 %14, 65532
store i64 %15, i64* %3
br label %16
16: ; preds = %13, %9
%17 = load i64, i64* %3
ret i64 %17
}

LLVM IR (-O2):
define i64 @extract_bd(i64 %0, i32* nocapture readnone %1) {
%3 = and i64 %0, 32768
%4 = icmp eq i64 %3, 0
%5 = and i64 %0, 65532
%6 = or i64 %5, -65536
%7 = select i1 %4, i64 %5, i64 %6
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ scanf(char *, long *);
int main() {
  long n = 0;
  scanf("%ld", &n);
  printf("%ld", n * n);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0xecb(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x8(%rsp),%rsi
imul   %rsi,%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = load i64, i64* %1
%5 = mul nsw i64 %4, %4
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ iscntrl(int);
void t_iscntrl_0xe9() {
  Assert_real((iscntrl(233) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_iscntrl.c",
              1170, ("iscntrl should be 0 for 0xe9"));
}


x86 assembly (clang, -O0):
<t_iscntrl_0xe9>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe9,%edi
call   1030 <iscntrl@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x492,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_iscntrl_0xe9>:
push   %rax
mov    $0xe9,%edi
call   1030 <iscntrl@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x492,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 0 for 0xe9\00"
define void @t_iscntrl_0xe9() {
%1 = call i64 @iscntrl(i32 233)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1170, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 0 for 0xe9\00"
define void @t_iscntrl_0xe9() {
%1 = tail call i64 @iscntrl(i32 233)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1170, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, char const *);
void createBranchAndSwitch(const char *branchName, const char *offFromBranch) {
  printf("git checkout -b %s %s\n", branchName, offFromBranch);
}


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

x86 assembly (clang, -O2):
<createBranchAndSwitch>:
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"git checkout -b %s %s\0A\00"
define void @createBranchAndSwitch(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"git checkout -b %s %s\0A\00"
define void @createBranchAndSwitch(i8* %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SYS_close;
int /*<<< orphan*/ syscall_2(int /*<<< orphan*/, long, int /*<<< orphan*/);
int fclose(FILE *fp) {
  syscall_2(SYS_close, (long int)fp, 0);
  return 0;
}


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

x86 assembly (clang, -O2):
<fclose>:
push   %rax
mov    %rdi,%rsi
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
xor    %edx,%edx
call   1030 <syscall_2@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SYS_close = global i32 0
define i32 @fclose(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @SYS_close
%4 = load i32*, i32** %2
%5 = ptrtoint i32* %4 to i64
%6 = call i32 @syscall_2(i32 %3, i64 %5, i32 0)
ret i32 0
}

LLVM IR (-O2):
@SYS_close = global i32 0
define i32 @fclose(i32* %0) {
%2 = load i32, i32* @SYS_close
%3 = ptrtoint i32* %0 to i64
%4 = tail call i32 @syscall_2(i32 %2, i64 %3, i32 0)
ret i32 0
}
/* Variables and functions */
int char_to_bitmap(char);
int compatible(char x, char y) {
  return (char_to_bitmap(x) & char_to_bitmap(y)) != 0;
}


x86 assembly (clang, -O0):
<compatible>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <char_to_bitmap@plt>
mov    %eax,-0x8(%rbp)
movsbl -0x2(%rbp),%edi
call   1030 <char_to_bitmap@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compatible>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
call   1030 <char_to_bitmap@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1030 <char_to_bitmap@plt>
xor    %ecx,%ecx
test   %ebp,%eax
setne  %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @compatible(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = call i32 @char_to_bitmap(i8 signext %5)
%7 = load i8, i8* %4
%8 = call i32 @char_to_bitmap(i8 signext %7)
%9 = and i32 %6, %8
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @compatible(i8 signext %0, i8 signext %1) {
%3 = tail call i32 @char_to_bitmap(i8 signext %0)
%4 = tail call i32 @char_to_bitmap(i8 signext %1)
%5 = and i32 %4, %3
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ puts(char *);
void print_usage(const char *prog) {
  printf("Usage: %s [-tfb]\n", prog);
  puts("  -t --tty      device to use (default /dev/ttyAMA0)\n"
       "  -f --file     file containing ihex binary\n"
       "  -b --baud     baud rate (default 9600)\n"
       "  -v --verbose  Enable verbose output\n");
  exit(1);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O0):
@.str = [18 x i8] c"Usage: %s [-tfb]\0A\00"
@.str.1 = [177 x i8] c" -t --tty device to use (default /dev/ttyAMA0)\0A -f --file file containing ihex binary\0A -b --baud baud rate (default 9600)\0A -v --verbose Enable verbose output\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @puts(i8* getelementptr inbounds ([177 x i8], [177 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [18 x i8] c"Usage: %s [-tfb]\0A\00"
@.str.1 = [177 x i8] c" -t --tty device to use (default /dev/ttyAMA0)\0A -f --file file containing ihex binary\0A -b --baud baud rate (default 9600)\0A -v --verbose Enable verbose output\0A\00"
define void @print_usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([177 x i8], [177 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @exit(i32 1)
unreachable
}