xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void libtest() { puts("libtest: calls the original puts()"); }


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

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

LLVM IR (-O0):
@.str = [35 x i8] c"libtest: calls the original puts()\00"
define void @libtest() {
%1 = call i32 @puts(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"libtest: calls the original puts()\00"
define void @libtest() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
ret void
}
unsigned mexpdrv_num_chunks(const unsigned vector_length) {
  unsigned num_chunks = vector_length / 1024 + (vector_length % 1024 ? 1 : 0);
  return num_chunks;
}


x86 assembly (clang, -O0):
<mexpdrv_num_chunks>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0xa,%eax
mov    -0x4(%rbp),%esi
and    $0x3ff,%esi
xor    %ecx,%ecx
mov    $0x1,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mexpdrv_num_chunks>:
mov    %edi,%eax
shr    $0xa,%eax
and    $0x3ff,%edi
cmp    $0x1,%edi
sbb    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @mexpdrv_num_chunks(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = udiv i32 %4, 1024
%6 = load i32, i32* %2
%7 = urem i32 %6, 1024
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 1, i32 0
%11 = add i32 %5, %10
store i32 %11, i32* %3
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @mexpdrv_num_chunks(i32 %0) {
%2 = lshr i32 %0, 10
%3 = and i32 %0, 1023
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
%6 = add nuw nsw i32 %2, %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, char);
void print() {
  char str[20] = "hello world\0";
  int i = 0;
  while (str[i] != '\0') {
    printf("%c", str[i]);
    i++;
    str[i] = str[i - 1];
    getchar();
  }
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     119e <print+0x7e>
movslq -0x24(%rbp),%rax
lea    0xea9(%rip),%rdi
movsbl -0x20(%rbp,%rax,1),%esi
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x20(%rbp,%rax,1),%cl
movslq -0x24(%rbp),%rax
mov    %cl,-0x20(%rbp,%rax,1)
mov    $0x0,%al
call   1040 <getchar@plt>
jmp    114e <print+0x2e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %rbx
lea    0xed8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x68,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
jmp    1130 <print+0x10>

LLVM IR (-O0):
@__const.print.str = [20 x i8] c"hello world\00\00\00\00\00\00\00\00\00"
@.str = [3 x i8] c"%c\00"
define void @print() {
%1 = alloca [20 x i8]
%2 = alloca i32
%3 = bitcast [20 x i8]* %1 to i8*
store i32 0, i32* %2
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %6
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %28
11: ; preds = %4
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %15)
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = sub nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %25
store i8 %23, i8* %26
%27 = call i32 (...) @getchar()
br label %4
28: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @print() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext 104)
%3 = tail call i32 (...) @getchar()
br label %1
}
char *getstr(id, cpp)
char *id, **cpp;
{ return (0); }


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

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

LLVM IR (-O0):
define i8* @getstr(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
store i8* %0, i8** %3
store i8** %1, i8*** %4
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @getstr(i8* nocapture readnone %0, i8** nocapture readnone %1) {
ret i8* null
}
sswrite(a, b, c) { return write_real(a, b, c); }


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

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

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

LLVM IR (-O2):
define i32 @sswrite(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @write_real to i32 (i32, i32, i32, ...)*)(i32 %0, i32 %1, i32 %2)
ret i32 %4
}
float returnf10() { return (float)10.; }


x86 assembly (clang, -O0):
<returnf10>:
push   %rbp
mov    %rsp,%rbp
movss  0xef4(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<returnf10>:
movss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @returnf10() {
ret float 1.000000e+01
}

LLVM IR (-O2):
define float @returnf10() {
ret float 1.000000e+01
}
/* Variables and functions */
unsigned int fetch_int();
int /*<<< orphan*/ fetch_long();
int /*<<< orphan*/ fetch_skip(int);
int /*<<< orphan*/ fetch_skip_photo_size();
int /*<<< orphan*/ fetch_str(int);
int prefetch_strlen();
void fetch_skip_video(void) {
  unsigned x = fetch_int();
  fetch_long();
  if (x == 0xc10658a8) {
    return;
  }
  fetch_skip(4);
  int l = prefetch_strlen();
  fetch_str(l);
  fetch_skip(2);
  fetch_skip_photo_size();
  fetch_skip(3);
}


x86 assembly (clang, -O0):
<fetch_skip_video>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1080 <fetch_int@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1060 <fetch_long@plt>
cmpl   $0xc10658a8,-0x4(%rbp)
jne    118b <fetch_skip_video+0x2b>
jmp    11c2 <fetch_skip_video+0x62>
mov    $0x4,%edi
call   1070 <fetch_skip@plt>
mov    $0x0,%al
call   1030 <prefetch_strlen@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <fetch_str@plt>
mov    $0x2,%edi
call   1070 <fetch_skip@plt>
mov    $0x0,%al
call   1050 <fetch_skip_photo_size@plt>
mov    $0x3,%edi
call   1070 <fetch_skip@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fetch_skip_video>:
push   %rbx
xor    %eax,%eax
call   1080 <fetch_int@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <fetch_long@plt>
cmp    $0xc10658a8,%ebx
jne    117b <fetch_skip_video+0x1b>
pop    %rbx
ret
mov    $0x4,%edi
call   1070 <fetch_skip@plt>
xor    %eax,%eax
call   1030 <prefetch_strlen@plt>
mov    %eax,%edi
call   1040 <fetch_str@plt>
mov    $0x2,%edi
call   1070 <fetch_skip@plt>
xor    %eax,%eax
call   1050 <fetch_skip_photo_size@plt>
mov    $0x3,%edi
pop    %rbx
jmp    1070 <fetch_skip@plt>

LLVM IR (-O0):
define void @fetch_skip_video() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @fetch_int()
store i32 %3, i32* %1
%4 = call i32 (...) @fetch_long()
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, -1056548696
br i1 %6, label %7, label %8
7: ; preds = %0
br label %16
8: ; preds = %0
%9 = call i32 @fetch_skip(i32 4)
%10 = call i32 (...) @prefetch_strlen()
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = call i32 @fetch_str(i32 %11)
%13 = call i32 @fetch_skip(i32 2)
%14 = call i32 (...) @fetch_skip_photo_size()
%15 = call i32 @fetch_skip(i32 3)
br label %16
16: ; preds = %8, %7
ret void
}

LLVM IR (-O2):
define void @fetch_skip_video() {
%1 = tail call i32 (...) @fetch_int()
%2 = tail call i32 (...) @fetch_long()
%3 = icmp eq i32 %1, -1056548696
br i1 %3, label %11, label %4
4: ; preds = %0
%5 = tail call i32 @fetch_skip(i32 4)
%6 = tail call i32 (...) @prefetch_strlen()
%7 = tail call i32 @fetch_str(i32 %6)
%8 = tail call i32 @fetch_skip(i32 2)
%9 = tail call i32 (...) @fetch_skip_photo_size()
%10 = tail call i32 @fetch_skip(i32 3)
br label %11
11: ; preds = %0, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ASN1_STRING_TABLE_cleanup();
int /*<<< orphan*/ CRYPTO_cleanup_all_ex_data();
int /*<<< orphan*/ ENGINE_cleanup();
int /*<<< orphan*/ ERR_free_strings();
void free_tls_memory() {
  ENGINE_cleanup();
  CRYPTO_cleanup_all_ex_data();
  ASN1_STRING_TABLE_cleanup();
  ERR_free_strings();
}


x86 assembly (clang, -O0):
<free_tls_memory>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <ENGINE_cleanup@plt>
mov    $0x0,%al
call   1030 <CRYPTO_cleanup_all_ex_data@plt>
mov    $0x0,%al
call   1060 <ASN1_STRING_TABLE_cleanup@plt>
mov    $0x0,%al
call   1050 <ERR_free_strings@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_tls_memory>:
push   %rax
xor    %eax,%eax
call   1040 <ENGINE_cleanup@plt>
xor    %eax,%eax
call   1030 <CRYPTO_cleanup_all_ex_data@plt>
xor    %eax,%eax
call   1060 <ASN1_STRING_TABLE_cleanup@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <ERR_free_strings@plt>

LLVM IR (-O0):
define void @free_tls_memory() {
%1 = call i32 (...) @ENGINE_cleanup()
%2 = call i32 (...) @CRYPTO_cleanup_all_ex_data()
%3 = call i32 (...) @ASN1_STRING_TABLE_cleanup()
%4 = call i32 (...) @ERR_free_strings()
ret void
}

LLVM IR (-O2):
define void @free_tls_memory() {
%1 = tail call i32 (...) @ENGINE_cleanup()
%2 = tail call i32 (...) @CRYPTO_cleanup_all_ex_data()
%3 = tail call i32 (...) @ASN1_STRING_TABLE_cleanup()
%4 = tail call i32 (...) @ERR_free_strings()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ emit_andimm(int, int, int);
int /*<<< orphan*/ emit_orreq_imm(int, int, int);
int /*<<< orphan*/ emit_testimm(int, int);
void emit_sh2tstimm(int s, int imm, int sr, int temp) {
  emit_andimm(sr, ~1, sr);
  emit_testimm(s, imm);
  emit_orreq_imm(sr, 1, sr);
}


x86 assembly (clang, -O0):
<emit_sh2tstimm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0xc(%rbp),%edi
mov    -0xc(%rbp),%edx
mov    $0xfffffffe,%esi
call   1050 <emit_andimm@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <emit_testimm@plt>
mov    -0xc(%rbp),%edi
mov    -0xc(%rbp),%edx
mov    $0x1,%esi
call   1040 <emit_orreq_imm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_sh2tstimm>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %edi,%ebp
mov    %edx,%edi
mov    $0xfffffffe,%esi
call   1050 <emit_andimm@plt>
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <emit_testimm@plt>
mov    %ebx,%edi
mov    $0x1,%esi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <emit_orreq_imm@plt>

LLVM IR (-O0):
define void @emit_sh2tstimm(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %7
%10 = load i32, i32* %7
%11 = call i32 @emit_andimm(i32 %9, i32 -2, i32 %10)
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = call i32 @emit_testimm(i32 %12, i32 %13)
%15 = load i32, i32* %7
%16 = load i32, i32* %7
%17 = call i32 @emit_orreq_imm(i32 %15, i32 1, i32 %16)
ret void
}

LLVM IR (-O2):
define void @emit_sh2tstimm(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @emit_andimm(i32 %2, i32 -2, i32 %2)
%6 = tail call i32 @emit_testimm(i32 %0, i32 %1)
%7 = tail call i32 @emit_orreq_imm(i32 %2, i32 1, i32 %2)
ret void
}
/* Type definitions */
typedef int socklen_t;
typedef int /*<<< orphan*/ size;

/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_SNDBUF;
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int);
int hi_set_sndbuf(int sd, int size) {
  socklen_t len;
  len = sizeof(size);
  return setsockopt(sd, SOL_SOCKET, SO_SNDBUF, &size, len);
}


x86 assembly (clang, -O0):
<hi_set_sndbuf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x4,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
mov    0x2ea8(%rip),%rax
mov    (%rax),%edx
mov    -0xc(%rbp),%r8d
lea    -0x8(%rbp),%rcx
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hi_set_sndbuf>:
push   %rax
mov    %esi,0x4(%rsp)
mov    0x2ecc(%rip),%rax
mov    (%rax),%esi
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
pop    %rcx
ret

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
@SO_SNDBUF = global i32 0
define i32 @hi_set_sndbuf(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 4, i32* %5
%6 = load i32, i32* %3
%7 = load i32, i32* @SOL_SOCKET
%8 = load i32, i32* @SO_SNDBUF
%9 = load i32, i32* %5
%10 = call i32 @setsockopt(i32 %6, i32 %7, i32 %8, i32* %4, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_SNDBUF = global i32 0
define i32 @hi_set_sndbuf(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = load i32, i32* @SOL_SOCKET
%5 = load i32, i32* @SO_SNDBUF
%6 = call i32 @setsockopt(i32 %0, i32 %4, i32 %5, i32* %3, i32 4)
ret i32 %6
}
int wlan_hdd_cfg80211_process_ndp_cmd(struct wiphy *wiphy,
                                      struct wireless_dev *wdev,
                                      const void *data, int data_len) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.wiphy = type opaque
%struct.wireless_dev = type opaque
define i32 @wlan_hdd_cfg80211_process_ndp_cmd(%struct.wiphy* %0, %struct.wireless_dev* %1, i8* %2, i32 %3) {
%5 = alloca %struct.wiphy*
%6 = alloca %struct.wireless_dev*
%7 = alloca i8*
%8 = alloca i32
store %struct.wiphy* %0, %struct.wiphy** %5
store %struct.wireless_dev* %1, %struct.wireless_dev** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
ret i32 0
}

LLVM IR (-O2):
%struct.wiphy = type opaque
%struct.wireless_dev = type opaque
define i32 @wlan_hdd_cfg80211_process_ndp_cmd(%struct.wiphy* nocapture readnone %0, %struct.wireless_dev* nocapture readnone %1, i8* nocapture readnone %2, i32 %3) {
ret i32 0
}
/* Type definitions */
typedef int time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
scalar_t__ RtcRead(struct tm *);
int mktime(struct tm *);
time_t time(time_t *timeptr) {
  struct tm now;
  time_t t = -1;
  if (RtcRead(&now)) {
    t = mktime(&now);
  }
  if (timeptr) {
    *timeptr = t;
  }
  return t;
}


x86 assembly (clang, -O0):
<time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0xffffffff,-0x14(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <RtcRead@plt>
cmp    $0x0,%rax
je     1152 <time+0x32>
lea    -0x10(%rbp),%rdi
call   1040 <mktime@plt>
mov    %eax,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1166 <time+0x46>
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
call   1030 <RtcRead@plt>
test   %rax,%rax
je     114e <time+0x2e>
lea    0x8(%rsp),%rdi
call   1040 <mktime@plt>
test   %rbx,%rbx
je     1148 <time+0x28>
mov    %eax,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret
mov    $0xffffffff,%eax
test   %rbx,%rbx
jne    1146 <time+0x26>
jmp    1148 <time+0x28>

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

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @time(i32* writeonly %0) {
%2 = alloca %struct.tm
%3 = bitcast %struct.tm* %2 to i8*
%4 = call i64 @RtcRead(%struct.tm* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 @mktime(%struct.tm* %2)
br label %8
8: ; preds = %6, %1
%9 = phi i32 [ %7, %6 ], [ -1, %1 ]
%10 = icmp eq i32* %0, null
br i1 %10, label %12, label %11
11: ; preds = %8
store i32 %9, i32* %0
br label %12
12: ; preds = %11, %8
ret i32 %9
}
/* Type definitions */
struct scale {
  int dummy;
};

/* Variables and functions */
int scale_get_orient_bit(struct scale *);
char *scale_get_orient(struct scale *s) {
  if (scale_get_orient_bit(s) & 0x1)
    return "vertical";
  else
    return "horizontal";
}


x86 assembly (clang, -O0):
<scale_get_orient>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <scale_get_orient_bit@plt>
and    $0x1,%eax
cmp    $0x0,%eax
je     1141 <scale_get_orient+0x31>
lea    0xec8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    114c <scale_get_orient+0x3c>
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scale_get_orient>:
push   %rax
call   1030 <scale_get_orient_bit@plt>
test   $0x1,%al
lea    0xeea(%rip),%rcx
lea    0xeda(%rip),%rax
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.scale = type { i32 }
@.str = [9 x i8] c"vertical\00"
@.str.1 = [11 x i8] c"horizontal\00"
define i8* @scale_get_orient(%struct.scale* %0) {
%2 = alloca i8*
%3 = alloca %struct.scale*
store %struct.scale* %0, %struct.scale** %3
%4 = load %struct.scale*, %struct.scale** %3
%5 = call i32 @scale_get_orient_bit(%struct.scale* %4)
%6 = and i32 %5, 1
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %2
br label %10
9: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %10
10: ; preds = %9, %8
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
%struct.scale = type { i32 }
@.str = [9 x i8] c"vertical\00"
@.str.1 = [11 x i8] c"horizontal\00"
define i8* @scale_get_orient(%struct.scale* %0) {
%2 = tail call i32 @scale_get_orient_bit(%struct.scale* %0)
%3 = and i32 %2, 1
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
ret i8* %5
}
void RTAssertSetQuiet(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAssertSetQuiet() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ disp_color_str(char *, int);
int /*<<< orphan*/ disp_str(char *);
void kinfo(char *msg) {
  disp_color_str("INFO: ", 5);
  disp_str(msg);
  disp_str("       \n");
}


x86 assembly (clang, -O0):
<kinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
mov    $0x5,%esi
call   1040 <disp_color_str@plt>
mov    -0x8(%rbp),%rdi
call   1030 <disp_str@plt>
lea    0xeba(%rip),%rdi
call   1030 <disp_str@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kinfo>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
mov    $0x5,%esi
call   1040 <disp_color_str@plt>
mov    %rbx,%rdi
call   1030 <disp_str@plt>
lea    0xec3(%rip),%rdi
pop    %rbx
jmp    1030 <disp_str@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"INFO: \00"
@.str.1 = [9 x i8] c" \0A\00"
define void @kinfo(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @disp_color_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 5)
%4 = load i8*, i8** %2
%5 = call i32 @disp_str(i8* %4)
%6 = call i32 @disp_str(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"INFO: \00"
@.str.1 = [9 x i8] c" \0A\00"
define void @kinfo(i8* %0) {
%2 = tail call i32 @disp_color_str(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 5)
%3 = tail call i32 @disp_str(i8* %0)
%4 = tail call i32 @disp_str(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int bit_fit(uint32_t v, int bits) {
  return bits > 0 ? (bits < 32 ? (v >> bits ? 0 : 1) : 1) : 0;
}


x86 assembly (clang, -O0):
<bit_fit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1153 <bit_fit+0x53>
cmpl   $0x20,-0x8(%rbp)
jge    113b <bit_fit+0x3b>
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
sar    %cl,%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <bit_fit+0x48>
mov    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <bit_fit+0x48>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    115d <bit_fit+0x5d>
xor    %eax,%eax
mov    %eax,-0x10(%rbp)
jmp    115d <bit_fit+0x5d>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_fit>:
test   %esi,%esi
jle    111a <bit_fit+0x1a>
mov    $0x1,%eax
cmp    $0x1f,%esi
ja     1119 <bit_fit+0x19>
mov    %esi,%ecx
sar    %cl,%edi
xor    %eax,%eax
test   %edi,%edi
sete   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @bit_fit(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %20
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 32
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = ashr i32 %11, %12
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 0, i32 1
br label %18
17: ; preds = %7
br label %18
18: ; preds = %17, %10
%19 = phi i32 [ %16, %10 ], [ 1, %17 ]
br label %21
20: ; preds = %2
br label %21
21: ; preds = %20, %18
%22 = phi i32 [ %19, %18 ], [ 0, %20 ]
ret i32 %22
}

LLVM IR (-O2):
define i32 @bit_fit(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = icmp ult i32 %1, 32
br i1 %5, label %6, label %10
6: ; preds = %4
%7 = ashr i32 %0, %1
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %2, %6, %4
%11 = phi i32 [ %9, %6 ], [ 1, %4 ], [ 0, %2 ]
ret i32 %11
}
double elapsed_session_time() { return 0.0; }


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

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

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

LLVM IR (-O2):
define double @elapsed_session_time() {
ret double 0.000000e+00
}
void no_op(void *arg __attribute__((unused))) {}


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

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

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

LLVM IR (-O2):
define void @no_op(i8* nocapture %0) {
ret void
}
int inverse_bit(int reg, int bit) { return reg ^= (1 << bit); }


x86 assembly (clang, -O0):
<inverse_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @inverse_bit(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = xor i32 %3, %0
ret i32 %4
}
/* Variables and functions */
double M_PI;
double sin(double);
double _rrc(double x) { return (x == 0 ? 1 : sin(M_PI * x) / (M_PI * x)); }


x86 assembly (clang, -O0):
<_rrc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1147 <_rrc+0x37>
jp     1147 <_rrc+0x37>
movsd  0xec3(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1175 <_rrc+0x65>
mov    0x2e9a(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
mov    0x2e85(%rip),%rax
movsd  (%rax),%xmm1
mulsd  -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_rrc>:
push   %rbx
sub    $0x10,%rsp
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    112f <_rrc+0x1f>
jp     112f <_rrc+0x1f>
movsd  0xed3(%rip),%xmm0
jmp    1157 <_rrc+0x47>
mov    0x2eb2(%rip),%rbx
movsd  (%rbx),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm1,0x8(%rsp)
call   1030 <sin@plt>
movsd  0x8(%rsp),%xmm1
mulsd  (%rbx),%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @_rrc(double %0) {
%2 = fcmp oeq double %0, 0.000000e+00
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = load double, double* @M_PI
%5 = fmul double %4, %0
%6 = tail call double @sin(double %5)
%7 = load double, double* @M_PI
%8 = fmul double %7, %0
%9 = fdiv double %6, %8
br label %10
10: ; preds = %1, %3
%11 = phi double [ %9, %3 ], [ 1.000000e+00, %1 ]
ret double %11
}
unsigned xrop3_113_0_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk2 = S ^ D;
  stk3 = T ^ D;
  stk2 = stk2 & stk3;
  stk1 = S ^ stk2;
  stk1 = ~stk1;
  return stk1;
}


x86 assembly (clang, -O0):
<xrop3_113_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_113_0_0>:
mov    %edi,%ecx
shl    $0x8,%ecx
or     %edi,%ecx
mov    %esi,%eax
shl    $0x8,%eax
or     %esi,%eax
mov    %ecx,%edx
xor    $0xff,%edx
xor    $0xff,%eax
and    %edx,%eax
xor    %ecx,%eax
not    %eax
ret

LLVM IR (-O0):
define i32 @xrop3_113_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %6
%24 = load i32, i32* %5
%25 = xor i32 %23, %24
store i32 %25, i32* %9
%26 = load i32, i32* %7
%27 = load i32, i32* %5
%28 = xor i32 %26, %27
store i32 %28, i32* %10
%29 = load i32, i32* %9
%30 = load i32, i32* %10
%31 = and i32 %29, %30
store i32 %31, i32* %9
%32 = load i32, i32* %6
%33 = load i32, i32* %9
%34 = xor i32 %32, %33
store i32 %34, i32* %8
%35 = load i32, i32* %8
%36 = xor i32 %35, -1
store i32 %36, i32* %8
%37 = load i32, i32* %8
ret i32 %37
}

LLVM IR (-O2):
define i32 @xrop3_113_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = xor i32 %4, 255
%8 = xor i32 %6, 255
%9 = and i32 %8, %7
%10 = xor i32 %4, %9
%11 = xor i32 %10, -1
ret i32 %11
}
/* Variables and functions */
int rand();
short rand_bool_prob(const int prob) { return rand() % 100 < prob; }


x86 assembly (clang, -O0):
<rand_bool_prob>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    -0x4(%rbp),%edx
setl   %al
and    $0x1,%al
movzbl %al,%eax
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_bool_prob>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
movslq %eax,%rcx
imul   $0x51eb851f,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rax
add    %edx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ecx
xor    %eax,%eax
cmp    %ebx,%ecx
setl   %al
pop    %rbx
ret

LLVM IR (-O0):
define signext i16 @rand_bool_prob(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = srem i32 %3, 100
%5 = load i32, i32* %2
%6 = icmp slt i32 %4, %5
%7 = zext i1 %6 to i32
%8 = trunc i32 %7 to i16
ret i16 %8
}

LLVM IR (-O2):
define signext i16 @rand_bool_prob(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 100
%4 = icmp slt i32 %3, %0
%5 = zext i1 %4 to i16
ret i16 %5
}
/* Variables and functions */
void *malloc(size_t);
void *bm(size_t n) { return malloc(n); }


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

x86 assembly (clang, -O2):
<bm>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @bm(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void Usage(void) {
  {
    printf("Usage: LZX command filename [filename [...]]\n"
           "\n"
           "command:\n"
           "  -d ..... decode 'filename'\n"
           "  -evb ... encode 'filename', VRAM compatible, big endian mode "
           "(LZ11)\n"
           "  -ewb ... encode 'filename', WRAM compatbile, big endian mode\n"
           "  -evl ... encode 'filename', VRAM compatible, low endian mode\n"
           "  -ewl ... encode 'filename', WRAM compatbile, low endian mode "
           "(LZ40)\n"
           "\n"
           "* multiple filenames and wildcards are permitted\n"
           "* the original file is overwritten with the new file\n"
           "* this codification is an updated version of the 'Yaz0' "
           "compression\n");
    exit(-1);
  };
}


x86 assembly (clang, -O0):
<Usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@.str = [522 x i8] c"Usage: LZX command filename [filename [...]]\0A\0Acommand:\0A -d ..... decode 'filename'\0A -evb ... encode 'filename', VRAM compatible, big endian mode (LZ11)\0A -ewb ... encode 'filename', WRAM compatbile, big endian mode\0A -evl ... encode 'filename', VRAM compatible, low endian mode\0A -ewl ... encode 'filename', WRAM compatbile, low endian mode (LZ40)\0A\0A* multiple filenames and wildcards are permitted\0A* the original file is overwritten with the new file\0A* this codification is an updated version of the 'Yaz0' compression\0A\00"
define void @Usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([522 x i8], [522 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@str = [521 x i8] c"Usage: LZX command filename [filename [...]]\0A\0Acommand:\0A -d ..... decode 'filename'\0A -evb ... encode 'filename', VRAM compatible, big endian mode (LZ11)\0A -ewb ... encode 'filename', WRAM compatbile, big endian mode\0A -evl ... encode 'filename', VRAM compatible, low endian mode\0A -ewl ... encode 'filename', WRAM compatbile, low endian mode (LZ40)\0A\0A* multiple filenames and wildcards are permitted\0A* the original file is overwritten with the new file\0A* this codification is an updated version of the 'Yaz0' compression\00"
define void @Usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([521 x i8], [521 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int symlink(char *, char *);
void cmd_symlink(int argc, char *argv[]) {
  if (symlink(argv[1], argv[2]) == -1)
    perror("symlink");
}


x86 assembly (clang, -O0):
<cmd_symlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <symlink@plt>
cmp    $0xffffffff,%eax
jne    1159 <cmd_symlink+0x39>
lea    0xeac(%rip),%rdi
call   1040 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_symlink>:
push   %rax
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1030 <symlink@plt>
cmp    $0xffffffff,%eax
je     1135 <cmd_symlink+0x15>
pop    %rax
ret
lea    0xec4(%rip),%rdi
pop    %rax
jmp    1040 <perror@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"symlink\00"
define void @cmd_symlink(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8*, i8** %1, i64 2
%6 = load i8*, i8** %5
%7 = tail call i32 @symlink(i8* %4, i8* %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
ret void
}
/* Type definitions */
struct buff {
  int dummy;
};

/* Variables and functions */
int buff_copy_to(struct buff *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
int buff_append_str(struct buff *dst, const char *src) {
  if (src == NULL) {
    return 0;
  }
  return buff_copy_to(dst, src, strlen(src));
}


x86 assembly (clang, -O0):
<buff_append_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1147 <buff_append_str+0x27>
movl   $0x0,-0x4(%rbp)
jmp    1172 <buff_append_str+0x52>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1040 <buff_copy_to@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buff_append_str>:
test   %rsi,%rsi
je     114b <buff_append_str+0x2b>
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <buff_copy_to@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
%struct.buff = type { i32 }
define i32 @buff_append_str(%struct.buff* %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @strlen(i8* %1)
%6 = tail call i32 @buff_copy_to(%struct.buff* %0, i8* %1, i32 %5)
br label %7
7: ; preds = %2, %4
%8 = phi i32 [ %6, %4 ], [ 0, %2 ]
ret i32 %8
}
/* Type definitions */
struct mg_connection {
  int dummy;
};
struct connection {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ terminate_headers(struct mg_connection *);
int /*<<< orphan*/ write_chunk(struct connection *, char const *, int);
void mg_send_data(struct mg_connection *c, const void *data, int data_len) {
  terminate_headers(c);
  write_chunk((struct connection *)c, (const char *)data, data_len);
}


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

x86 assembly (clang, -O2):
<mg_send_data>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1030 <terminate_headers@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <write_chunk@plt>

LLVM IR (-O0):
%struct.mg_connection = type { i32 }
%struct.connection = type { i32 }
define void @mg_send_data(%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 = call i32 @terminate_headers(%struct.mg_connection* %7)
%9 = load %struct.mg_connection*, %struct.mg_connection** %4
%10 = bitcast %struct.mg_connection* %9 to %struct.connection*
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = call i32 @write_chunk(%struct.connection* %10, i8* %11, i32 %12)
ret void
}

LLVM IR (-O2):
%struct.mg_connection = type { i32 }
%struct.connection = type { i32 }
define void @mg_send_data(%struct.mg_connection* %0, i8* %1, i32 %2) {
%4 = tail call i32 @terminate_headers(%struct.mg_connection* %0)
%5 = bitcast %struct.mg_connection* %0 to %struct.connection*
%6 = tail call i32 @write_chunk(%struct.connection* %5, i8* %1, i32 %2)
ret void
}
/* Variables and functions */
double exp(double const);
void vas_value(const double r, const double *p, double *f) {
  *f = exp(p[0] / (r - p[1]));
}


x86 assembly (clang, -O0):
<vas_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x8(%rbp),%xmm1
mov    -0x10(%rbp),%rax
subsd  0x8(%rax),%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vas_value>:
push   %rbx
mov    %rsi,%rbx
movsd  (%rdi),%xmm1
subsd  0x8(%rdi),%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @vas_value(double %0, double* %1, double* %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca double*
store double %0, double* %4
store double* %1, double** %5
store double* %2, double** %6
%7 = load double*, double** %5
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = load double, double* %4
%11 = load double*, double** %5
%12 = getelementptr inbounds double, double* %11, i64 1
%13 = load double, double* %12
%14 = fsub double %10, %13
%15 = fdiv double %9, %14
%16 = call double @exp(double %15)
%17 = load double*, double** %6
store double %16, double* %17
ret void
}

LLVM IR (-O2):
define void @vas_value(double %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = load double, double* %1
%5 = getelementptr inbounds double, double* %1, i64 1
%6 = load double, double* %5
%7 = fsub double %0, %6
%8 = fdiv double %4, %7
%9 = tail call double @exp(double %8)
store double %9, double* %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ write_named_array_ui32(int /*<<< orphan*/ *, char *,
                                          unsigned int const *,
                                          unsigned int const);
void write_data_as_json_ui32(FILE *f, const unsigned int *y,
                             const unsigned int len) {
  fprintf(f, "{");
  write_named_array_ui32(f, "expected", y, len);
  fprintf(f, "}");
}


x86 assembly (clang, -O0):
<write_data_as_json_ui32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
lea    0xead(%rip),%rsi
call   1040 <write_named_array_ui32@plt>
mov    -0x8(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_data_as_json_ui32>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    $0x7b,%edi
mov    %rbp,%rsi
call   1030 <fputc@plt>
lea    0xebf(%rip),%rsi
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %r14d,%ecx
call   1040 <write_named_array_ui32@plt>
mov    $0x7d,%edi
mov    %rbp,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"{\00"
@.str.1 = [9 x i8] c"expected\00"
@.str.2 = [2 x i8] c"}\00"
define void @write_data_as_json_ui32(i32* %0, i32* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = load i32*, i32** %4
%10 = load i32*, i32** %5
%11 = load i32, i32* %6
%12 = call i32 @write_named_array_ui32(i32* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %10, i32 %11)
%13 = load i32*, i32** %4
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"expected\00"
define void @write_data_as_json_ui32(i32* %0, i32* %1, i32 %2) {
%4 = tail call i32 @fputc(i32 123, i32* %0)
%5 = tail call i32 @write_named_array_ui32(i32* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32 %2)
%6 = tail call i32 @fputc(i32 125, i32* %0)
ret void
}
int suzerain_gbmatrix_in_band(int kl, int ku, int i, int j) {
  return j - ku <= i && i <= j + kl;
}


x86 assembly (clang, -O0):
<suzerain_gbmatrix_in_band>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
sub    -0x8(%rbp),%ecx
xor    %eax,%eax
cmp    -0xc(%rbp),%ecx
mov    %al,-0x11(%rbp)
jg     1135 <suzerain_gbmatrix_in_band+0x35>
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
add    -0x4(%rbp),%ecx
cmp    %ecx,%eax
setle  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<suzerain_gbmatrix_in_band>:
mov    %ecx,%eax
sub    %esi,%eax
cmp    %edx,%eax
setle  %al
add    %ecx,%edi
cmp    %edx,%edi
setge  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @suzerain_gbmatrix_in_band(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = load i32, i32* %6
%11 = sub nsw i32 %9, %10
%12 = load i32, i32* %7
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %20
14: ; preds = %4
%15 = load i32, i32* %7
%16 = load i32, i32* %8
%17 = load i32, i32* %5
%18 = add nsw i32 %16, %17
%19 = icmp sle i32 %15, %18
br label %20
20: ; preds = %14, %4
%21 = phi i1 [ false, %4 ], [ %19, %14 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @suzerain_gbmatrix_in_band(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %3, %1
%6 = icmp sle i32 %5, %2
%7 = add nsw i32 %3, %0
%8 = icmp sge i32 %7, %2
%9 = select i1 %6, i1 %8, i1 false
%10 = zext i1 %9 to i32
ret i32 %10
}
void abc(int a, int b, int c) {
  int d = a + b + c;
  return;
}


x86 assembly (clang, -O0):
<abc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @abc(i32 %0, i32 %1, i32 %2) {
ret void
}