xunge/DecIR huggingface dataset:
__float128 from_sign_short_load_4(short *a) { return (__float128)a[4]; }


x86 assembly (clang, -O0):
<from_sign_short_load_4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ax
movswl %ax,%edi
call   1130 <__floatsitf>
add    $0x10,%rsp
pop    %rbp
ret
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)

x86 assembly (clang, -O2):
<from_sign_short_load_4>:
push   %rax
movswl 0x8(%rdi),%edi
call   1110 <__floatsitf>
pop    %rax
ret
nopl   0x0(%rax)

LLVM IR (-O0):
define fp128 @from_sign_short_load_4(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = getelementptr inbounds i16, i16* %3, i64 4
%5 = load i16, i16* %4
%6 = sitofp i16 %5 to fp128
ret fp128 %6
}

LLVM IR (-O2):
define fp128 @from_sign_short_load_4(i16* nocapture %0) {
%2 = getelementptr inbounds i16, i16* %0, i64 4
%3 = load i16, i16* %2
%4 = sitofp i16 %3 to fp128
ret fp128 %4
}
/* Variables and functions */
int /*<<< orphan*/ ldo_power_off();
int /*<<< orphan*/ operation_sleep();
int /*<<< orphan*/ set_wakeup_timer(int /*<<< orphan*/, int /*<<< orphan*/,
                                    int /*<<< orphan*/);
void operation_sleep_notimer(void) {
  ldo_power_off();
  set_wakeup_timer(0, 0, 0);
  operation_sleep();
}


x86 assembly (clang, -O0):
<operation_sleep_notimer>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <ldo_power_off@plt>
xor    %edx,%edx
mov    %edx,%edi
mov    %edx,%esi
call   1040 <set_wakeup_timer@plt>
mov    $0x0,%al
call   1030 <operation_sleep@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<operation_sleep_notimer>:
push   %rax
xor    %eax,%eax
call   1050 <ldo_power_off@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <set_wakeup_timer@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <operation_sleep@plt>

LLVM IR (-O0):
define void @operation_sleep_notimer() {
%1 = call i32 (...) @ldo_power_off()
%2 = call i32 @set_wakeup_timer(i32 0, i32 0, i32 0)
%3 = call i32 (...) @operation_sleep()
ret void
}

LLVM IR (-O2):
define void @operation_sleep_notimer() {
%1 = tail call i32 (...) @ldo_power_off()
%2 = tail call i32 @set_wakeup_timer(i32 0, i32 0, i32 0)
%3 = tail call i32 (...) @operation_sleep()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ cbreak();
int /*<<< orphan*/ initscr();
int /*<<< orphan*/ keypad(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ noecho();
int /*<<< orphan*/ start_color();
int /*<<< orphan*/ stdscr;
void *init_curses() {
  initscr();
  cbreak();
  noecho();
  start_color();
  keypad(stdscr, TRUE);
}


x86 assembly (clang, -O0):
<init_curses>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <initscr@plt>
mov    $0x0,%al
call   1030 <cbreak@plt>
mov    $0x0,%al
call   1070 <noecho@plt>
mov    $0x0,%al
call   1060 <start_color@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
mov    0x2e5c(%rip),%rax
mov    (%rax),%esi
call   1040 <keypad@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_curses>:
push   %rax
xor    %eax,%eax
call   1050 <initscr@plt>
xor    %eax,%eax
call   1030 <cbreak@plt>
xor    %eax,%eax
call   1070 <noecho@plt>
xor    %eax,%eax
call   1060 <start_color@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
mov    0x2e63(%rip),%rax
mov    (%rax),%esi
pop    %rax
jmp    1040 <keypad@plt>

LLVM IR (-O0):
@stdscr = global i32 0
@TRUE = global i32 0
define i8* @init_curses() {
%1 = alloca i8*
%2 = call i32 (...) @initscr()
%3 = call i32 (...) @cbreak()
%4 = call i32 (...) @noecho()
%5 = call i32 (...) @start_color()
%6 = load i32, i32* @stdscr
%7 = load i32, i32* @TRUE
%8 = call i32 @keypad(i32 %6, i32 %7)
%9 = load i8*, i8** %1
ret i8* %9
}

LLVM IR (-O2):
@stdscr = global i32 0
@TRUE = global i32 0
define noalias i8* @init_curses() {
%1 = tail call i32 (...) @initscr()
%2 = tail call i32 (...) @cbreak()
%3 = tail call i32 (...) @noecho()
%4 = tail call i32 (...) @start_color()
%5 = load i32, i32* @stdscr
%6 = load i32, i32* @TRUE
%7 = tail call i32 @keypad(i32 %5, i32 %6)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void usage(const char *cmd) {
  fprintf(stderr,
          "Usage: %s [ -w | -W ] [ -p | -m ] [ -h ] pid\n"
          "    -w  Displays statistics for the working set only.\n"
          "    -W  Resets the working set of the process.\n"
          "    -p  Sort by PSS.\n"
          "    -m  Sort by mapping order (as read from /proc).\n"
          "    -h  Hide maps with no RSS.\n",
          cmd);
}


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

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [251 x i8] c"Usage: %s [ -w | -W ] [ -p | -m ] [ -h ] pid\0A -w Displays statistics for the working set only.\0A -W Resets the working set of the process.\0A -p Sort by PSS.\0A -m Sort by mapping order (as read from /proc).\0A -h Hide maps with no RSS.\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 ([251 x i8], [251 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [251 x i8] c"Usage: %s [ -w | -W ] [ -p | -m ] [ -h ] pid\0A -w Displays statistics for the working set only.\0A -W Resets the working set of the process.\0A -p Sort by PSS.\0A -m Sort by mapping order (as read from /proc).\0A -h Hide maps with no RSS.\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([251 x i8], [251 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ swap(int *, size_t, size_t);
void reverse(int arr[], size_t len) {
  if (len == 0)
    return;
  size_t i, j;
  for (i = 0, j = len - 1; i < j; i++, j--)
    swap(arr, i, j);
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1130 <reverse+0x20>
jmp    1180 <reverse+0x70>
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1180 <reverse+0x70>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <swap@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    1144 <reverse+0x34>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%rsi
jb     114f <reverse+0x3f>
mov    %rsi,%rbx
mov    %rdi,%r14
add    $0xffffffffffffffff,%rbx
mov    $0x1,%r15d
nopl   0x0(%rax,%rax,1)
lea    -0x1(%r15),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1030 <swap@plt>
add    $0xffffffffffffffff,%rbx
lea    0x1(%r15),%rax
cmp    %rbx,%r15
mov    %rax,%r15
jb     1130 <reverse+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @reverse(i32* %0, i64 %1) {
%3 = icmp ugt i64 %1, 1
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = add i64 %1, -1
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ %11, %6 ], [ %5, %4 ]
%8 = phi i64 [ %10, %6 ], [ 0, %4 ]
%9 = tail call i32 @swap(i32* %0, i64 %8, i64 %7)
%10 = add nuw i64 %8, 1
%11 = add i64 %7, -1
%12 = icmp ult i64 %10, %11
br i1 %12, label %6, label %13
13: ; preds = %6, %2
ret void
}
long LIMIT(cat, id, res, nl)
long *cat, *id, *res, *nl;
{ return ((long)limit(*cat, *id, *res, *nl)); }


x86 assembly (clang, -O0):
<LIMIT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
mov    -0x20(%rbp),%rax
mov    (%rax),%rcx
mov    $0x0,%al
call   1030 <limit@plt>
cltq
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LIMIT>:
push   %rax
mov    (%rdi),%rdi
mov    (%rsi),%rsi
mov    (%rdx),%rdx
mov    (%rcx),%rcx
xor    %eax,%eax
call   1030 <limit@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i64 @LIMIT(i64* %0, i64* %1, i64* %2, i64* %3) {
%5 = alloca i64*
%6 = alloca i64*
%7 = alloca i64*
%8 = alloca i64*
store i64* %0, i64** %5
store i64* %1, i64** %6
store i64* %2, i64** %7
store i64* %3, i64** %8
%9 = load i64*, i64** %5
%10 = load i64, i64* %9
%11 = load i64*, i64** %6
%12 = load i64, i64* %11
%13 = load i64*, i64** %7
%14 = load i64, i64* %13
%15 = load i64*, i64** %8
%16 = load i64, i64* %15
%17 = call i32 (i64, i64, i64, i64, ...) bitcast (i32 (...)* @limit to i32 (i64, i64, i64, i64, ...)*)(i64 %10, i64 %12, i64 %14, i64 %16)
%18 = sext i32 %17 to i64
ret i64 %18
}

LLVM IR (-O2):
define i64 @LIMIT(i64* nocapture %0, i64* nocapture %1, i64* nocapture %2, i64* nocapture %3) {
%5 = load i64, i64* %0
%6 = load i64, i64* %1
%7 = load i64, i64* %2
%8 = load i64, i64* %3
%9 = tail call i32 (i64, i64, i64, i64, ...) bitcast (i32 (...)* @limit to i32 (i64, i64, i64, i64, ...)*)(i64 %5, i64 %6, i64 %7, i64 %8)
%10 = sext i32 %9 to i64
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
int close(int fd) {
  _exit(-1);
  return -1;
}


x86 assembly (clang, -O0):
<close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<close>:
push   %rax
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

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

LLVM IR (-O2):
define i32 @close(i32 %0) {
%2 = tail call i32 @_exit(i32 -1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int S_ISBLK(int /*<<< orphan*/);
int C_S_ISBLK(mode_t mode) { return S_ISBLK(mode); }


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

x86 assembly (clang, -O2):
<C_S_ISBLK>:
jmp    1030 <S_ISBLK@plt>

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

LLVM IR (-O2):
define i32 @C_S_ISBLK(i32 %0) {
%2 = tail call i32 @S_ISBLK(i32 %0)
ret i32 %2
}
int test_imm_A3int64_lowword_mem(long long *val) {
  return ((*val) & (0xA3 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_A3int64_lowword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
and    $0xa3,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_A3int64_lowword_mem>:
testb  $0xa3,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_A3int64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 163
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_A3int64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 163
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int fl_fwrite(char const *, int, int, void *);
scalar_t__ strlen(char const *);
int fl_fputs(const char *str, void *f) {
  int len = (int)strlen(str);
  int res = fl_fwrite(str, 1, len, f);
  if (res == len)
    return len;
  else
    return res;
}


x86 assembly (clang, -O0):
<fl_fputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fl_fwrite@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    116b <fl_fputs+0x4b>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1171 <fl_fputs+0x51>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @fl_fputs(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = trunc i64 %3 to i32
%5 = tail call i32 @fl_fwrite(i8* %0, i32 1, i32 %4, i8* %1)
ret i32 %5
}
/* Type definitions */
struct timeval {
  long long tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
long long now_usecs(void) {
  struct timeval tv;
  assert(!gettimeofday(&tv, NULL));
  return (long long)tv.tv_sec * 1000000 + tv.tv_usec;
}


x86 assembly (clang, -O0):
<now_usecs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
imul   $0xf4240,-0x8(%rbp),%rax
add    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<now_usecs>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
imul   $0xf4240,0x10(%rsp),%rax
add    0x8(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define i64 @now_usecs() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = icmp ne i32 %2, 0
%4 = xor i1 %3, true
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%8 = load i64, i64* %7
%9 = mul nsw i64 %8, 1000000
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%11 = load i64, i64* %10
%12 = add nsw i64 %9, %11
ret i64 %12
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i64 @now_usecs() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i64, i64* %7
%9 = mul nsw i64 %8, 1000000
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%11 = load i64, i64* %10
%12 = add nsw i64 %9, %11
ret i64 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
void numberStore(int counter, int num[][20], FILE *in) {}


x86 assembly (clang, -O0):
<numberStore>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @numberStore(i32 %0, [20 x i32]* %1, i32* %2) {
%4 = alloca i32
%5 = alloca [20 x i32]*
%6 = alloca i32*
store i32 %0, i32* %4
store [20 x i32]* %1, [20 x i32]** %5
store i32* %2, i32** %6
ret void
}

LLVM IR (-O2):
define void @numberStore(i32 %0, [20 x i32]* nocapture %1, i32* nocapture %2) {
ret void
}
int rs_supports_trace(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @rs_supports_trace() {
ret i32 1
}

LLVM IR (-O2):
define i32 @rs_supports_trace() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ usleep(unsigned int);
void PLATFORM_SleepMSec(unsigned int uiMilliSecond) {
  usleep(uiMilliSecond * 1000);
}


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

x86 assembly (clang, -O2):
<PLATFORM_SleepMSec>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @PLATFORM_SleepMSec(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul i32 %3, 1000
%5 = call i32 @usleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @PLATFORM_SleepMSec(i32 %0) {
%2 = mul i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ num;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void even_or_odd(int num) {
  if ((num)&1)
    printf("Given number %d is odd number\n", num);
  else
    printf("Given number %d is even number\n", num);
  return;
}


x86 assembly (clang, -O0):
<even_or_odd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     113e <even_or_odd+0x2e>
mov    -0x4(%rbp),%esi
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
jmp    114d <even_or_odd+0x3d>
mov    -0x4(%rbp),%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<even_or_odd>:
mov    %edi,%esi
test   $0x1,%sil
lea    0xf02(%rip),%rax
lea    0xedc(%rip),%rdi
cmove  %rax,%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"Given number %d is odd number\0A\00"
@.str.1 = [32 x i8] c"Given number %d is even number\0A\00"
define void @even_or_odd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %9, %6
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"Given number %d is odd number\0A\00"
@.str.1 = [32 x i8] c"Given number %d is even number\0A\00"
define void @even_or_odd(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0)
%5 = tail call i32 @printf(i8* %4, i32 %0)
ret void
}
/* Variables and functions */
char *strncpy(char *, char const *, size_t);
char *strncpyz(char *dest, const char *source, size_t len) {
  char *s;
  if (len) {
    s = strncpy(dest, source, len - 1);
    dest[len - 1] = '\0';
  } else {
    s = dest;
  }
  return s;
}


x86 assembly (clang, -O0):
<strncpyz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     115d <strncpyz+0x4d>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
sub    $0x1,%rdx
call   1030 <strncpy@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1165 <strncpyz+0x55>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncpyz>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
test   %rdx,%rdx
je     1131 <strncpyz+0x21>
mov    %rdx,%r14
add    $0xffffffffffffffff,%rdx
mov    %rbx,%rdi
call   1030 <strncpy@plt>
movb   $0x0,-0x1(%rbx,%r14,1)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strncpyz(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i64, i64* %6
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = load i8*, i8** %5
%13 = load i64, i64* %6
%14 = sub i64 %13, 1
%15 = call i8* @strncpy(i8* %11, i8* %12, i64 %14)
store i8* %15, i8** %7
%16 = load i8*, i8** %4
%17 = load i64, i64* %6
%18 = sub i64 %17, 1
%19 = getelementptr inbounds i8, i8* %16, i64 %18
store i8 0, i8* %19
br label %22
20: ; preds = %3
%21 = load i8*, i8** %4
store i8* %21, i8** %7
br label %22
22: ; preds = %20, %10
%23 = load i8*, i8** %7
ret i8* %23
}

LLVM IR (-O2):
define i8* @strncpyz(i8* returned %0, i8* nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = add i64 %2, -1
%7 = tail call i8* @strncpy(i8* dereferenceable(1) %0, i8* %1, i64 %6)
%8 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 0, i8* %8
br label %9
9: ; preds = %3, %5
ret i8* %0
}
int f6(unsigned char c) {
  if (c == 0x22)
    return 2;
  if (c == 0x20)
    return 2;
  if (c < 0x20)
    return 2;
  return 0;
}


x86 assembly (clang, -O0):
<f6>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x22,%eax
jne    1123 <f6+0x23>
movl   $0x2,-0x4(%rbp)
jmp    115c <f6+0x5c>
movzbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    113c <f6+0x3c>
movl   $0x2,-0x4(%rbp)
jmp    115c <f6+0x5c>
movzbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jge    1155 <f6+0x55>
movl   $0x2,-0x4(%rbp)
jmp    115c <f6+0x5c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f6>:
mov    $0x2,%eax
mov    %edi,%ecx
or     $0x2,%cl
cmp    $0x22,%cl
jne    1110 <f6+0x10>
ret
xor    %eax,%eax
cmp    $0x20,%dil
setb   %al
add    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @f6(i8 zeroext %0) {
switch i8 %0, label %2 [
i8 34, label %5
i8 32, label %5
]
2: ; preds = %1
%3 = icmp ult i8 %0, 32
%4 = select i1 %3, i32 2, i32 0
br label %5
5: ; preds = %2, %1, %1
%6 = phi i32 [ 2, %1 ], [ 2, %1 ], [ %4, %2 ]
ret i32 %6
}
/* Variables and functions */
unsigned char fpst_quadbit_at(const char *str, size_t i) {
  unsigned char c;
  c = (unsigned char)str[i / 2];
  if ((i & 1U) == 0U) {
    c >>= 4;
  }
  return c & 0xf;
}


x86 assembly (clang, -O0):
<fpst_quadbit_at>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x1,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
jne    113a <fpst_quadbit_at+0x3a>
movzbl -0x11(%rbp),%eax
sar    $0x4,%eax
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
and    $0xf,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fpst_quadbit_at>:
mov    %rsi,%rax
shr    %rax
movzbl (%rdi,%rax,1),%ecx
mov    %ecx,%eax
shr    $0x4,%al
test   $0x1,%sil
movzbl %al,%eax
cmovne %ecx,%eax
and    $0xf,%al
ret

LLVM IR (-O0):
define zeroext i8 @fpst_quadbit_at(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = udiv i64 %7, 2
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
store i8 %10, i8* %5
%11 = load i64, i64* %4
%12 = and i64 %11, 1
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = load i8, i8* %5
%16 = zext i8 %15 to i32
%17 = ashr i32 %16, 4
%18 = trunc i32 %17 to i8
store i8 %18, i8* %5
br label %19
19: ; preds = %14, %2
%20 = load i8, i8* %5
%21 = zext i8 %20 to i32
%22 = and i32 %21, 15
%23 = trunc i32 %22 to i8
ret i8 %23
}

LLVM IR (-O2):
define zeroext i8 @fpst_quadbit_at(i8* nocapture %0, i64 %1) {
%3 = lshr i64 %1, 1
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = and i64 %1, 1
%7 = icmp eq i64 %6, 0
%8 = lshr i8 %5, 4
%9 = select i1 %7, i8 %8, i8 %5
%10 = and i8 %9, 15
ret i8 %10
}
int test_imm_66int16_mem(short *val) {
  return ((*val) & (-0x66 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_66int16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0xffffff9a,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_66int16_mem>:
movzwl (%rdi),%eax
test   $0xff9a,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_66int16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, -102
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_66int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -102
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
void handler(int sig) {
  printf("nexiting...(%d)\n", sig);
  exit(0);
}


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<handler>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@.str = [17 x i8] c"nexiting...(%d)\0A\00"
define void @handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
void free_imatrix(int **m, int nr) {
  int i;
  for (i = 0; i < nr; i++)
    free(m[i]);
  free(m);
}


x86 assembly (clang, -O0):
<free_imatrix>:
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    1151 <free_imatrix+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <free_imatrix+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_imatrix>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <free_imatrix+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <free_imatrix+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_imatrix(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 0, i32* %5
br label %6
6: ; preds = %17, %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*** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32*, i32** %11, i64 %13
%15 = load i32*, i32** %14
%16 = bitcast i32* %15 to i8*
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = load i32**, i32*** %3
%22 = bitcast i32** %21 to i8*
ret void
}

LLVM IR (-O2):
define void @free_imatrix(i32** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32*, i32** %0, i64 %7
%9 = bitcast i32** %8 to i8**
%10 = load i8*, i8** %9
tail call void @free(i8* %10)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = bitcast i32** %0 to i8*
tail call void @free(i8* %14)
ret void
}
/* Type definitions */
struct katcp_dispatch {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ terminate_katcp(struct katcp_dispatch *, int);
int halt_cmd_katcp(struct katcp_dispatch *d, int argc) {
  terminate_katcp(d, 2);
  return 0;
}


x86 assembly (clang, -O0):
<halt_cmd_katcp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1030 <terminate_katcp@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<halt_cmd_katcp>:
push   %rax
mov    $0x2,%esi
call   1030 <terminate_katcp@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.katcp_dispatch = type { i32 }
define i32 @halt_cmd_katcp(%struct.katcp_dispatch* %0, i32 %1) {
%3 = alloca %struct.katcp_dispatch*
%4 = alloca i32
store %struct.katcp_dispatch* %0, %struct.katcp_dispatch** %3
store i32 %1, i32* %4
%5 = load %struct.katcp_dispatch*, %struct.katcp_dispatch** %3
%6 = call i32 @terminate_katcp(%struct.katcp_dispatch* %5, i32 2)
ret i32 0
}

LLVM IR (-O2):
%struct.katcp_dispatch = type { i32 }
define i32 @halt_cmd_katcp(%struct.katcp_dispatch* %0, i32 %1) {
%3 = tail call i32 @terminate_katcp(%struct.katcp_dispatch* %0, i32 2)
ret i32 0
}
int decFixed(char **buf, int sz, char **r) {
  *r = *buf;
  *buf += sz;
  return 0;
}


x86 assembly (clang, -O0):
<decFixed>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decFixed>:
mov    (%rdi),%rax
mov    %rax,(%rdx)
movslq %esi,%rax
add    %rax,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @decFixed(i8** %0, i32 %1, i8** %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i8**
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %7
%9 = load i8**, i8*** %6
store i8* %8, i8** %9
%10 = load i32, i32* %5
%11 = load i8**, i8*** %4
%12 = load i8*, i8** %11
%13 = sext i32 %10 to i64
%14 = getelementptr inbounds i8, i8* %12, i64 %13
store i8* %14, i8** %11
ret i32 0
}

LLVM IR (-O2):
define i32 @decFixed(i8** nocapture %0, i32 %1, i8** nocapture writeonly %2) {
%4 = load i8*, i8** %0
store i8* %4, i8** %2
%5 = load i8*, i8** %0
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i8, i8* %5, i64 %6
store i8* %7, i8** %0
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ SmcConn;
typedef int /*<<< orphan*/ SmPointer;

/* Variables and functions */
void session_shutdown_cancelled(SmcConn smc_conn, SmPointer client_data) {}


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

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

LLVM IR (-O0):
define void @session_shutdown_cancelled(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @session_shutdown_cancelled(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ basic_uart_tx_str(char *);
__attribute__((isr)) void bad_int() {
  while (1)
    basic_uart_tx_str("bad int\r\n");
}


x86 assembly (clang, -O0):
<bad_int>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <bad_int+0x9>
lea    0xee0(%rip),%rdi
call   1030 <basic_uart_tx_str@plt>
jmp    1119 <bad_int+0x9>

x86 assembly (clang, -O2):
<bad_int>:
push   %rbx
lea    0xee8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <basic_uart_tx_str@plt>
jmp    1120 <bad_int+0x10>

LLVM IR (-O0):
@.str = [10 x i8] c"bad int\0D\0A\00"
define void @bad_int() {
br label %1
1: ; preds = %0, %1
%2 = call i32 @basic_uart_tx_str(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %1
}

LLVM IR (-O2):
@.str = [10 x i8] c"bad int\0D\0A\00"
define void @bad_int() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 @basic_uart_tx_str(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %1
}
void div_d(double *source1, double *source2, double *target) {
  *target = (*source1) / (*source2);
}


x86 assembly (clang, -O0):
<div_d>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<div_d>:
movsd  (%rdi),%xmm0
divsd  (%rsi),%xmm0
movsd  %xmm0,(%rdx)
ret

LLVM IR (-O0):
define void @div_d(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** %4
%8 = load double, double* %7
%9 = load double*, double** %5
%10 = load double, double* %9
%11 = fdiv double %8, %10
%12 = load double*, double** %6
store double %11, double* %12
ret void
}

LLVM IR (-O2):
define void @div_d(double* nocapture %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = load double, double* %0
%5 = load double, double* %1
%6 = fdiv double %4, %5
store double %6, double* %2
ret void
}
/* Type definitions */
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
};

/* Variables and functions */
int ntohs(int /*<<< orphan*/);
int pd_socket_get_port(struct sockaddr_in *addr) {
  int ret = -1;
  if (NULL != addr) {
    ret = ntohs(addr->sin_port);
  }
  return ret;
}


x86 assembly (clang, -O0):
<pd_socket_get_port>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
je     113d <pd_socket_get_port+0x2d>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <ntohs@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pd_socket_get_port>:
test   %rdi,%rdi
je     111c <pd_socket_get_port+0xc>
mov    (%rdi),%edi
jmp    1030 <ntohs@plt>
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
define i32 @pd_socket_get_port(%struct.sockaddr_in* %0) {
%2 = alloca %struct.sockaddr_in*
%3 = alloca i32
store %struct.sockaddr_in* %0, %struct.sockaddr_in** %2
store i32 -1, i32* %3
%4 = load %struct.sockaddr_in*, %struct.sockaddr_in** %2
%5 = icmp ne %struct.sockaddr_in* null, %4
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load %struct.sockaddr_in*, %struct.sockaddr_in** %2
%8 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
%9 = load i32, i32* %8
%10 = call i32 @ntohs(i32 %9)
store i32 %10, i32* %3
br label %11
11: ; preds = %6, %1
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
define i32 @pd_socket_get_port(%struct.sockaddr_in* %0) {
%2 = icmp eq %struct.sockaddr_in* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 0
%5 = load i32, i32* %4
%6 = tail call i32 @ntohs(i32 %5)
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ %6, %3 ], [ -1, %1 ]
ret i32 %8
}
int check_hmac(unsigned char *hmacA, unsigned char *hmacB,
               unsigned int nBytes) {
  int idx;
  for (idx = 0; idx < nBytes; idx++) {
    if (hmacA[idx] != hmacB[idx])
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<check_hmac>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    1161 <check_hmac+0x61>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     114e <check_hmac+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    1168 <check_hmac+0x68>
jmp    1153 <check_hmac+0x53>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1116 <check_hmac+0x16>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @check_hmac(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %17, label %5
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %16, %6
br i1 %8, label %17, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %16, %7 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %1, i64 %10
%14 = load i8, i8* %13
%15 = icmp eq i8 %12, %14
%16 = add nuw nsw i64 %10, 1
br i1 %15, label %7, label %17
17: ; preds = %9, %7, %3
%18 = phi i32 [ 1, %3 ], [ 1, %7 ], [ 0, %9 ]
ret i32 %18
}
unsigned h1(char *s) {
  unsigned h = 0;
  while (*s != '\0') {
    h = h * 27 + *s;
    s++;
  }
  return h;
}


x86 assembly (clang, -O0):
<h1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1140 <h1+0x40>
imul   $0x1b,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <h1+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<h1>:
mov    (%rdi),%cl
test   %cl,%cl
je     1127 <h1+0x27>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
lea    (%rax,%rax,8),%eax
lea    (%rax,%rax,2),%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <h1+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @h1(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = mul i32 %6, 27
%10 = add i32 %9, %8
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 0, %1 ], [ %10, %4 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ genericError(char *, int);
void __errorUnexpectedMatch(const char *file, const int line) {
  genericError("%s:%d We though something was always true, but it is not!", 10);
}


x86 assembly (clang, -O0):
<__errorUnexpectedMatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeda(%rip),%rdi
mov    $0xa,%esi
call   1030 <genericError@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__errorUnexpectedMatch>:
lea    0xee9(%rip),%rdi
mov    $0xa,%esi
jmp    1030 <genericError@plt>

LLVM IR (-O0):
@.str = [58 x i8] c"%s:%d We though something was always true, but it is not!\00"
define void @__errorUnexpectedMatch(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 @genericError(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 10)
ret void
}

LLVM IR (-O2):
@.str = [58 x i8] c"%s:%d We though something was always true, but it is not!\00"
define void @__errorUnexpectedMatch(i8* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @genericError(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 10)
ret void
}
int fibonacci(int n, int f1, int f0) {
  int fn = f1 + f0;
  if (n >= 2) {
    fn = fibonacci(--n, fn, f1);
  } else {
    if (n == 1) {
      return f1;
    } else {
      return f0;
    }
  }
  return fn;
}


x86 assembly (clang, -O0):
<fibonacci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     1150 <fibonacci+0x40>
mov    -0x8(%rbp),%edi
add    $0xffffffff,%edi
mov    %edi,-0x8(%rbp)
mov    -0x14(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <fibonacci@plt>
mov    %eax,-0x14(%rbp)
jmp    1170 <fibonacci+0x60>
cmpl   $0x1,-0x8(%rbp)
jne    1165 <fibonacci+0x55>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1176 <fibonacci+0x66>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1176 <fibonacci+0x66>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibonacci>:
mov    %edx,%eax
cmp    $0x2,%edi
jl     1122 <fibonacci+0x22>
add    $0x1,%edi
mov    %esi,%ecx
nopl   0x0(%rax)
mov    %eax,%esi
add    %ecx,%esi
add    $0xffffffff,%edi
mov    %ecx,%eax
mov    %esi,%ecx
cmp    $0x2,%edi
ja     1110 <fibonacci+0x10>
jmp    1127 <fibonacci+0x27>
cmp    $0x1,%edi
jne    1129 <fibonacci+0x29>
mov    %esi,%eax
ret

LLVM IR (-O0):
define i32 @fibonacci(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%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
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = add nsw i32 %9, %10
store i32 %11, i32* %8
%12 = load i32, i32* %5
%13 = icmp sge i32 %12, 2
br i1 %13, label %14, label %20
14: ; preds = %3
%15 = load i32, i32* %5
%16 = add nsw i32 %15, -1
store i32 %16, i32* %5
%17 = load i32, i32* %8
%18 = load i32, i32* %6
%19 = call i32 @fibonacci(i32 %16, i32 %17, i32 %18)
store i32 %19, i32* %8
br label %27
20: ; preds = %3
%21 = load i32, i32* %5
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = load i32, i32* %6
store i32 %24, i32* %4
br label %29
25: ; preds = %20
%26 = load i32, i32* %7
store i32 %26, i32* %4
br label %29
27: ; preds = %14
%28 = load i32, i32* %8
store i32 %28, i32* %4
br label %29
29: ; preds = %27, %25, %23
%30 = load i32, i32* %4
ret i32 %30
}

LLVM IR (-O2):
define i32 @fibonacci(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %12
5: ; preds = %3, %5
%6 = phi i32 [ %7, %5 ], [ %2, %3 ]
%7 = phi i32 [ %9, %5 ], [ %1, %3 ]
%8 = phi i32 [ %10, %5 ], [ %0, %3 ]
%9 = add nsw i32 %6, %7
%10 = add nsw i32 %8, -1
%11 = icmp ugt i32 %8, 2
br i1 %11, label %5, label %14
12: ; preds = %3
%13 = icmp eq i32 %0, 1
br i1 %13, label %14, label %16
14: ; preds = %5, %12
%15 = phi i32 [ %1, %12 ], [ %9, %5 ]
br label %16
16: ; preds = %12, %14
%17 = phi i32 [ %15, %14 ], [ %2, %12 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("Hello!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"Hello!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [7 x i8] c"Hello!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret i32 0
}