xunge/DecIR huggingface dataset:
unsigned int get_uart_base_addr(unsigned int id) {
  switch (id) {
  case 0:
    return (0x10009000);
  case 1:
    return (0x1000A000);
  case 2:
    return (0x1000B000);
  case 3:
    return (0x1000C000);
  default:
    break;
  }
  return -1;
}


x86 assembly (clang, -O0):
<get_uart_base_addr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
ja     115c <get_uart_base_addr+0x5c>
mov    -0x10(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x10009000,-0x4(%rbp)
jmp    1168 <get_uart_base_addr+0x68>
movl   $0x1000a000,-0x4(%rbp)
jmp    1168 <get_uart_base_addr+0x68>
movl   $0x1000b000,-0x4(%rbp)
jmp    1168 <get_uart_base_addr+0x68>
movl   $0x1000c000,-0x4(%rbp)
jmp    1168 <get_uart_base_addr+0x68>
jmp    1161 <get_uart_base_addr+0x61>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_uart_base_addr>:
mov    %edi,%ecx
shl    $0xc,%ecx
add    $0x10009000,%ecx
cmp    $0x4,%edi
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @get_uart_base_addr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %9 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 3, label %8
]
5: ; preds = %1
store i32 268472320, i32* %2
br label %11
6: ; preds = %1
store i32 268476416, i32* %2
br label %11
7: ; preds = %1
store i32 268480512, i32* %2
br label %11
8: ; preds = %1
store i32 268484608, i32* %2
br label %11
9: ; preds = %1
br label %10
10: ; preds = %9
store i32 -1, i32* %2
br label %11
11: ; preds = %10, %8, %7, %6, %5
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @get_uart_base_addr(i32 %0) {
%2 = icmp ult i32 %0, 4
%3 = shl i32 %0, 12
%4 = add i32 %3, 268472320
%5 = select i1 %2, i32 %4, i32 -1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ g();
void f(long long v) {
  if (v > 0xfffffffffLL)
    g();
  g();
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movabs $0xfffffffff,%rax
cmp    %rax,-0x8(%rbp)
jle    1137 <f+0x27>
mov    $0x0,%al
call   1030 <g@plt>
mov    $0x0,%al
call   1030 <g@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movabs $0x1000000000,%rax
cmp    %rax,%rdi
jl     112b <f+0x1b>
push   %rax
xor    %eax,%eax
call   1030 <g@plt>
add    $0x8,%rsp
xor    %eax,%eax
jmp    1030 <g@plt>

LLVM IR (-O0):
define void @f(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp sgt i64 %3, 68719476735
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @g()
br label %7
7: ; preds = %5, %1
%8 = call i32 (...) @g()
ret void
}

LLVM IR (-O2):
define void @f(i64 %0) {
%2 = icmp sgt i64 %0, 68719476735
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @g()
br label %5
5: ; preds = %3, %1
%6 = tail call i32 (...) @g()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void segv_handler() {
  fputs("Segmentation fault", stderr);
  fputc('\n', stderr);
  abort();
}


x86 assembly (clang, -O0):
<segv_handler>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ea5(%rip),%rax
mov    (%rax),%esi
lea    0xebc(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1050 <fputc@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<segv_handler>:
push   %rbx
mov    0x2ea8(%rip),%rbx
mov    (%rbx),%esi
lea    0xebf(%rip),%rdi
call   1040 <fputs@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
call   1050 <fputc@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Segmentation fault\00"
@stderr = global i32 0
define void @segv_handler() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @stderr
%4 = call i32 @fputc(i8 signext 10, i32 %3)
%5 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@.str = [19 x i8] c"Segmentation fault\00"
@stderr = global i32 0
define void @segv_handler() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @stderr
%4 = tail call i32 @fputc(i8 signext 10, i32 %3)
%5 = tail call i32 (...) @abort()
unreachable
}
int fun254() { return 254; }


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

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

LLVM IR (-O0):
define i32 @fun254() {
ret i32 254
}

LLVM IR (-O2):
define i32 @fun254() {
ret i32 254
}
/* Variables and functions */
char *lp_internal_sconfig(int, char *);
char *lp_chn_cphy(int chn) { return lp_internal_sconfig(chn, "cphy"); }


x86 assembly (clang, -O0):
<lp_chn_cphy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xedb(%rip),%rsi
call   1030 <lp_internal_sconfig@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lp_chn_cphy>:
lea    0xee9(%rip),%rsi
jmp    1030 <lp_internal_sconfig@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"cphy\00"
define i8* @lp_chn_cphy(i32 %0) {
%2 = tail call i8* @lp_internal_sconfig(i32 %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void macscp1_1() { puts("macscp1_1"); }


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

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

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

LLVM IR (-O2):
@.str = [10 x i8] c"macscp1_1\00"
define void @macscp1_1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int /*<<< orphan*/ cmd;
};
typedef TYPE_1__ osd_cmd_t;

/* Variables and functions */
int /*<<< orphan*/ OSD_SEND_CMD;
int /*<<< orphan*/ OSD_Show;
int ioctl(int, int /*<<< orphan*/, TYPE_1__ *);
int OSDShow(int dev) {
  osd_cmd_t dc;
  dc.cmd = OSD_Show;
  return ioctl(dev, OSD_SEND_CMD, &dc);
}


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

x86 assembly (clang, -O2):
<OSDShow>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsp)
mov    0x2ecc(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
call   1030 <ioctl@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32 }
@OSD_Show = global i32 0
@OSD_SEND_CMD = global i32 0
define i32 @OSDShow(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.TYPE_3__
store i32 %0, i32* %2
%4 = load i32, i32* @OSD_Show
%5 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
store i32 %4, i32* %5
%6 = load i32, i32* %2
%7 = load i32, i32* @OSD_SEND_CMD
%8 = call i32 @ioctl(i32 %6, i32 %7, %struct.TYPE_3__* %3)
ret i32 %8
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32 }
@OSD_Show = global i32 0
@OSD_SEND_CMD = global i32 0
define i32 @OSDShow(i32 %0) {
%2 = alloca %struct.TYPE_3__
%3 = bitcast %struct.TYPE_3__* %2 to i8*
%4 = load i32, i32* @OSD_Show
%5 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i64 0, i32 0
store i32 %4, i32* %5
%6 = load i32, i32* @OSD_SEND_CMD
%7 = call i32 @ioctl(i32 %0, i32 %6, %struct.TYPE_3__* %2)
ret i32 %7
}
/* Variables and functions */
void *SSL_CTX_new(int /*<<< orphan*/);
int /*<<< orphan*/ TLSv1_2_server_method();
void *dv_openssl_ctx_server_new(void) {
  return SSL_CTX_new(TLSv1_2_server_method());
}


x86 assembly (clang, -O0):
<dv_openssl_ctx_server_new>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <TLSv1_2_server_method@plt>
mov    %eax,%edi
call   1030 <SSL_CTX_new@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dv_openssl_ctx_server_new>:
push   %rax
xor    %eax,%eax
call   1040 <TLSv1_2_server_method@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <SSL_CTX_new@plt>

LLVM IR (-O0):
define i8* @dv_openssl_ctx_server_new() {
%1 = call i32 (...) @TLSv1_2_server_method()
%2 = call i8* @SSL_CTX_new(i32 %1)
ret i8* %2
}

LLVM IR (-O2):
define i8* @dv_openssl_ctx_server_new() {
%1 = tail call i32 (...) @TLSv1_2_server_method()
%2 = tail call i8* @SSL_CTX_new(i32 %1)
ret i8* %2
}
/* Variables and functions */
void set_to_zeros(double *restrict z, size_t s) {
  size_t i;
  for (i = 0; i < s; i++) {
    z[i] = 0.0;
  }
}


x86 assembly (clang, -O0):
<set_to_zeros>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1143 <set_to_zeros+0x43>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <set_to_zeros+0x14>
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_to_zeros>:
test   %rsi,%rsi
je     1128 <set_to_zeros+0x18>
push   %rax
mov    %rsi,%rdx
shl    $0x3,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @set_to_zeros(double* noalias %0, i64 %1) {
%3 = alloca double*
%4 = alloca i64
%5 = alloca i64
store double* %0, double** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %14, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load double*, double** %3
%12 = load i64, i64* %5
%13 = getelementptr inbounds double, double* %11, i64 %12
store double 0.000000e+00, double* %13
br label %14
14: ; preds = %10
%15 = load i64, i64* %5
%16 = add i64 %15, 1
store i64 %16, i64* %5
br label %6
17: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @set_to_zeros(double* noalias nocapture writeonly %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = bitcast double* %0 to i8*
%6 = shl nuw i64 %1, 3
br label %7
7: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_help() {
  printf("frisky is a simple tool to monitor the hardware using the /proc/ "
         "filesystem.\n    Possible options:\n\t    -c\tcpu usage\n\t    "
         "-m\tmemory usage\n\t    -x\tcombined monitor\n\t    -n "
         "<number>\tprovide the number of motherboard to be saved as "
         "<number>.txt\n");
}


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

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

LLVM IR (-O0):
@.str = [243 x i8] c"frisky is a simple tool to monitor the hardware using the /proc/ filesystem.\0A Possible options:\0A\09 -c\09cpu usage\0A\09 -m\09memory usage\0A\09 -x\09combined monitor\0A\09 -n <number>\09provide the number of motherboard to be saved as <number>.txt\0A\00"
define void @print_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([243 x i8], [243 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [242 x i8] c"frisky is a simple tool to monitor the hardware using the /proc/ filesystem.\0A Possible options:\0A\09 -c\09cpu usage\0A\09 -m\09memory usage\0A\09 -x\09combined monitor\0A\09 -n <number>\09provide the number of motherboard to be saved as <number>.txt\00"
define void @print_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([242 x i8], [242 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ crash(char *);
void fault(int i) { crash("fault"); }


x86 assembly (clang, -O0):
<fault>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <crash@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"fault\00"
define void @fault(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @crash(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"fault\00"
define void @fault(i32 %0) {
%2 = tail call i32 @crash(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
int LZ4_compressBoundInv(int bound) {
  if (bound < 16)
    return 0;
  return 255 * (bound - 16) / 256;
}


x86 assembly (clang, -O0):
<LZ4_compressBoundInv>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
jge    111d <LZ4_compressBoundInv+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1134 <LZ4_compressBoundInv+0x34>
mov    -0x8(%rbp),%eax
sub    $0x10,%eax
imul   $0xff,%eax,%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<LZ4_compressBoundInv>:
xor    %eax,%eax
cmp    $0x10,%edi
jl     1121 <LZ4_compressBoundInv+0x21>
mov    %edi,%eax
shl    $0x8,%eax
sub    %edi,%eax
lea    -0xff0(%rax),%ecx
add    $0xfffff10f,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
sar    $0x8,%eax
ret

LLVM IR (-O0):
define i32 @LZ4_compressBoundInv(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 16
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %12
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 16
%10 = mul nsw i32 255, %9
%11 = sdiv i32 %10, 256
store i32 %11, i32* %2
br label %12
12: ; preds = %7, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @LZ4_compressBoundInv(i32 %0) {
%2 = icmp slt i32 %0, 16
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = mul i32 %0, 255
%5 = add i32 %4, -4080
%6 = sdiv i32 %5, 256
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 0, %1 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
void Display(char ch[]) {
  printf("String Output: ");
  puts(ch);
}


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

x86 assembly (clang, -O2):
<Display>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"String Output: \00"
define void @Display(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @puts(i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"String Output: \00"
define void @Display(i8* nocapture %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) %0)
ret void
}
void MirrorUVRow_C() {}


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

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

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

LLVM IR (-O2):
define void @MirrorUVRow_C() {
ret void
}
/* Variables and functions */
char const **split_string(char const *, char *);
const char **split_string_whitespace(const char *str) {
  return split_string(str, " \t");
}


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

x86 assembly (clang, -O2):
<split_string_whitespace>:
lea    0xee9(%rip),%rsi
jmp    1030 <split_string@plt>

LLVM IR (-O0):
@.str = [3 x i8] c" \09\00"
define i8** @split_string_whitespace(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8** @split_string(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i8** %4
}

LLVM IR (-O2):
@.str = [3 x i8] c" \09\00"
define i8** @split_string_whitespace(i8* %0) {
%2 = tail call i8** @split_string(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i8** %2
}
/* Variables and functions */
int EXIT_SUCCESS;
unsigned int strlen(char const *);
int main(void) {
  const char *title = "The Unix Programming Environment";
  const unsigned int size = strlen(title);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    0x2ea3(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [33 x i8] c"The Unix Programming Environment\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* @EXIT_SUCCESS
ret i32 %6
}

LLVM IR (-O2):
@.str = [33 x i8] c"The Unix Programming Environment\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ arc4random_uniform(int);
void invalidFunctionArg() {
  (void)arc4random_uniform(1);
  (void)arc4random_uniform(2);
}


x86 assembly (clang, -O0):
<invalidFunctionArg>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <arc4random_uniform@plt>
mov    $0x2,%edi
call   1030 <arc4random_uniform@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<invalidFunctionArg>:
push   %rax
mov    $0x1,%edi
call   1030 <arc4random_uniform@plt>
mov    $0x2,%edi
pop    %rax
jmp    1030 <arc4random_uniform@plt>

LLVM IR (-O0):
define void @invalidFunctionArg() {
%1 = call i32 @arc4random_uniform(i32 1)
%2 = call i32 @arc4random_uniform(i32 2)
ret void
}

LLVM IR (-O2):
define void @invalidFunctionArg() {
%1 = tail call i32 @arc4random_uniform(i32 1)
%2 = tail call i32 @arc4random_uniform(i32 2)
ret void
}
void swap(int data[], int from, int to) {
  if (from != to) {
    int temporary = data[from];
    data[from] = data[to];
    data[to] = temporary;
  }
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     114c <swap+0x4c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
cmp    %edx,%esi
je     1116 <swap+0x16>
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

LLVM IR (-O0):
define void @swap(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* %5
%9 = load i32, i32* %6
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %31
11: ; preds = %3
%12 = load i32*, i32** %4
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
store i32 %16, i32* %7
%17 = load i32*, i32** %4
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = load i32, i32* %20
%22 = load i32*, i32** %4
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
store i32 %21, i32* %25
%26 = load i32, i32* %7
%27 = load i32*, i32** %4
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
store i32 %26, i32* %30
br label %31
31: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, %2
br i1 %4, label %12, label %5
5: ; preds = %3
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = load i32, i32* %7
%9 = sext i32 %2 to i64
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
store i32 %11, i32* %7
store i32 %8, i32* %10
br label %12
12: ; preds = %5, %3
ret void
}
int cmp(const void *x1, const void *x2) { return (*(char *)x2 - *(char *)x1); }


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
movsbl (%rsi),%eax
movsbl (%rdi),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = sext i8 %3 to i32
%5 = load i8, i8* %0
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
double mid_point(double lhs, double rhs) {
  assert(lhs < rhs);
  return (lhs + rhs) / 2.0;
}


x86 assembly (clang, -O0):
<mid_point>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  0xeb1(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mid_point>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
xor    %edi,%edi
ucomisd %xmm0,%xmm1
seta   %dil
call   1030 <assert@plt>
movsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
mulsd  0xebd(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @mid_point(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp olt double %5, %6
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load double, double* %3
%11 = load double, double* %4
%12 = fadd double %10, %11
%13 = fdiv double %12, 2.000000e+00
ret double %13
}

LLVM IR (-O2):
define double @mid_point(double %0, double %1) {
%3 = fcmp olt double %0, %1
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = fadd double %0, %1
%7 = fmul double %6, 5.000000e-01
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ perror(char *);
void *realloc(void *, size_t);
void *hhrealloc(void *src, size_t size) {
  void *new = realloc(src, size);
  if (new == NULL) {
    free(src);
    perror("realloc");
    exit(EXIT_FAILURE);
  }
  return new;
}


x86 assembly (clang, -O0):
<hhrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    118f <hhrealloc+0x4f>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
lea    0xe84(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hhrealloc>:
push   %rbx
mov    %rdi,%rbx
call   1040 <realloc@plt>
test   %rax,%rax
je     1150 <hhrealloc+0x10>
pop    %rbx
ret
mov    %rbx,%rdi
call   1030 <free@plt>
lea    0xea1(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"realloc\00"
@EXIT_FAILURE = global i32 0
define i8* @hhrealloc(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 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = call i32 @free(i8* %12)
%14 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %2
%18 = load i8*, i8** %5
ret i8* %18
}

LLVM IR (-O2):
@.str = [8 x i8] c"realloc\00"
@EXIT_FAILURE = global i32 0
define noalias i8* @hhrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = tail call i32 @free(i8* %0)
%7 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int SomeAction();
int main() {
  int flag = 0;
  while (flag == 0) {
    flag = SomeAction();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    113f <main+0x2f>
mov    $0x0,%al
call   1030 <SomeAction@plt>
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <SomeAction@plt>
test   %eax,%eax
je     1120 <main+0x10>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = call i32 (...) @SomeAction()
store i32 %7, i32* %2
br label %3
8: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (...) @SomeAction()
%3 = icmp eq i32 %2, 0
br i1 %3, label %1, label %4
4: ; preds = %1
ret i32 0
}
__attribute__((no)) void func_6(void) {}


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

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

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

LLVM IR (-O2):
define void @func_6() {
ret void
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int syscon_standard_size_limit(int k, int *szl) {
  int fail;
  double *c;
  fail = _ada_use_c2phc4c(600, &k, szl, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<syscon_standard_size_limit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x258,%edi
lea    -0x4(%rbp),%rsi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscon_standard_size_limit>:
push   %rax
mov    %rsi,%rdx
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x258,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @syscon_standard_size_limit(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca double*
store i32 %0, i32* %3
store i32* %1, i32** %4
%7 = load i32*, i32** %4
%8 = load double*, double** %6
%9 = call i32 @_ada_use_c2phc4c(i32 600, i32* %3, i32* %7, double* %8, i32 0)
store i32 %9, i32* %5
%10 = load i32, i32* %5
ret i32 %10
}

LLVM IR (-O2):
define i32 @syscon_standard_size_limit(i32 %0, i32* %1) {
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 @_ada_use_c2phc4c(i32 600, i32* %3, i32* %1, double* undef, i32 0)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int android_atomic_cas(int /*<<< orphan*/, int /*<<< orphan*/,
                       int /*<<< orphan*/ volatile *);
extern __attribute__((always_)) int
android_atomic_release_cas(int32_t old_value, int32_t new_value,
                           volatile int32_t *ptr) {
  return android_atomic_cas(old_value, new_value, ptr);
}


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

x86 assembly (clang, -O2):
<android_atomic_release_cas>:
jmp    1030 <android_atomic_cas@plt>

LLVM IR (-O0):
define i32 @android_atomic_release_cas(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 @android_atomic_cas(i32 %7, i32 %8, i32* %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @android_atomic_release_cas(i32 %0, i32 %1, i32* %2) {
%4 = tail call i32 @android_atomic_cas(i32 %0, i32 %1, i32* %2)
ret i32 %4
}
int foo(int a, int b) {
  if (a > 3 || a < 0)
    return a;
  a &= 3;
  return a & 3;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x3,-0x8(%rbp)
jg     111e <foo+0x1e>
cmpl   $0x0,-0x8(%rbp)
jge    1129 <foo+0x29>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113b <foo+0x3b>
mov    -0x8(%rbp),%eax
and    $0x3,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x3,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
ret i32 %0
}
/* Variables and functions */
unsigned long long get_data_disks(int, int, int);
unsigned long long calc_array_size(int level, int raid_disks, int layout,
                                   int chunksize, unsigned long long devsize) {
  if (level == 1)
    return devsize;
  devsize &= ~(unsigned long long)((chunksize >> 9) - 1);
  return get_data_disks(level, layout, raid_disks) * devsize;
}


x86 assembly (clang, -O0):
<calc_array_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    113f <calc_array_size+0x2f>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116d <calc_array_size+0x5d>
mov    -0x18(%rbp),%eax
sar    $0x9,%eax
sub    $0x1,%eax
cltq
xor    $0xffffffffffffffff,%rax
and    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <get_data_disks@plt>
imul   -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_array_size>:
mov    %r8,%rax
cmp    $0x1,%edi
je     1136 <calc_array_size+0x26>
push   %rbx
mov    %esi,%r8d
sar    $0x9,%ecx
neg    %ecx
movslq %ecx,%rbx
and    %rax,%rbx
mov    %edx,%esi
mov    %r8d,%edx
call   1030 <get_data_disks@plt>
imul   %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @calc_array_size(i32 %0, i32 %1, i32 %2, i32 %3, i64 %4) {
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i64 %4, i64* %11
%12 = load i32, i32* %7
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %5
%15 = load i64, i64* %11
store i64 %15, i64* %6
br label %30
16: ; preds = %5
%17 = load i32, i32* %10
%18 = ashr i32 %17, 9
%19 = sub nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = xor i64 %20, -1
%22 = load i64, i64* %11
%23 = and i64 %22, %21
store i64 %23, i64* %11
%24 = load i32, i32* %7
%25 = load i32, i32* %9
%26 = load i32, i32* %8
%27 = call i64 @get_data_disks(i32 %24, i32 %25, i32 %26)
%28 = load i64, i64* %11
%29 = mul i64 %27, %28
store i64 %29, i64* %6
br label %30
30: ; preds = %16, %14
%31 = load i64, i64* %6
ret i64 %31
}

LLVM IR (-O2):
define i64 @calc_array_size(i32 %0, i32 %1, i32 %2, i32 %3, i64 %4) {
%6 = icmp eq i32 %0, 1
br i1 %6, label %14, label %7
7: ; preds = %5
%8 = ashr i32 %3, 9
%9 = sub nsw i32 0, %8
%10 = sext i32 %9 to i64
%11 = and i64 %10, %4
%12 = tail call i64 @get_data_disks(i32 %0, i32 %2, i32 %1)
%13 = mul i64 %12, %11
br label %14
14: ; preds = %5, %7
%15 = phi i64 [ %13, %7 ], [ %4, %5 ]
ret i64 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char const *argv[]) {
  printf("%s\n", ("hello"));
  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
lea    0xed0(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [6 x i8] c"hello\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 ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [6 x i8] c"hello\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
void XtAppWarningMsg() {}


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

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

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

LLVM IR (-O2):
define void @XtAppWarningMsg() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ alarm(int);
void handler(int signum) {
  ;
  alarm(5);
}


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

x86 assembly (clang, -O2):
<handler>:
mov    $0x5,%edi
jmp    1030 <alarm@plt>

LLVM IR (-O0):
define void @handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @alarm(i32 5)
ret void
}

LLVM IR (-O2):
define void @handler(i32 %0) {
%2 = tail call i32 @alarm(i32 5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
int kill(int pid, int sig) {
  if (pid == 1)
    _exit(sig);
  return 0;
}


x86 assembly (clang, -O0):
<kill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1130 <kill+0x20>
mov    -0x8(%rbp),%edi
call   1030 <_exit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kill>:
cmp    $0x1,%edi
je     1118 <kill+0x8>
xor    %eax,%eax
ret
push   %rax
mov    %esi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define i32 @kill(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %4
%9 = call i32 @_exit(i32 %8)
unreachable
10: ; preds = %2
ret i32 0
}

LLVM IR (-O2):
define i32 @kill(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @_exit(i32 %1)
unreachable
6: ; preds = %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ kill_connection(int);
int /*<<< orphan*/ user_return(int, int);
void handle_suspects(int nr) {
  user_return(nr, 14);
  kill_connection(nr);
}


x86 assembly (clang, -O0):
<handle_suspects>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0xe,%esi
call   1040 <user_return@plt>
mov    -0x4(%rbp),%edi
call   1030 <kill_connection@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_suspects>:
push   %rbx
mov    %edi,%ebx
mov    $0xe,%esi
call   1040 <user_return@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <kill_connection@plt>

LLVM IR (-O0):
define void @handle_suspects(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @user_return(i32 %3, i32 14)
%5 = load i32, i32* %2
%6 = call i32 @kill_connection(i32 %5)
ret void
}

LLVM IR (-O2):
define void @handle_suspects(i32 %0) {
%2 = tail call i32 @user_return(i32 %0, i32 14)
%3 = tail call i32 @kill_connection(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void f() {
  extern int i;
  int j;
  j = 11;
  assert(i == 1);
  i = 10;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xb,-0x4(%rbp)
mov    0x2ec2(%rip),%rax
cmpl   $0x1,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    0x2eab(%rip),%rax
movl   $0xa,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbx
mov    0x2ed0(%rip),%rbx
xor    %edi,%edi
cmpl   $0x1,(%rbx)
sete   %dil
call   1030 <assert@plt>
movl   $0xa,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
@i = external global i32
define void @f() {
%1 = alloca i32
store i32 11, i32* %1
%2 = load i32, i32* @i
%3 = icmp eq i32 %2, 1
%4 = zext i1 %3 to i32
%5 = call i32 @assert(i32 %4)
store i32 10, i32* @i
ret void
}

LLVM IR (-O2):
@i = external global i32
define void @f() {
%1 = load i32, i32* @i
%2 = icmp eq i32 %1, 1
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
store i32 10, i32* @i
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bsp_coresight_resume();
void bsp_utrace_resume(void) {
  bsp_coresight_resume();
  return;
}


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

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

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

LLVM IR (-O2):
define void @bsp_utrace_resume() {
%1 = tail call i32 (...) @bsp_coresight_resume()
ret void
}
POS_to_LineNumber(pos, ref_number) long pos;
long *ref_number;
{ *ref_number = (pos % 1000000000L) / 1000L; }


x86 assembly (clang, -O0):
<POS_to_LineNumber>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x3b9aca00,%ecx
cqto
idiv   %rcx
mov    %rdx,%rax
mov    $0x3e8,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<POS_to_LineNumber>:
movabs $0x112e0be826d694b3,%rcx
0b 2e 11
mov    %rdi,%rax
imul   %rcx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0x1a,%rdx
add    %eax,%edx
imul   $0x3b9aca00,%edx,%eax
sub    %eax,%edi
movslq %edi,%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
cltq
mov    %rax,(%rsi)
ret

LLVM IR (-O0):
define i32 @POS_to_LineNumber(i64 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64*
store i64 %0, i64* %4
store i64* %1, i64** %5
%6 = load i64, i64* %4
%7 = srem i64 %6, 1000000000
%8 = sdiv i64 %7, 1000
%9 = load i64*, i64** %5
store i64 %8, i64* %9
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @POS_to_LineNumber(i64 %0, i64* nocapture writeonly %1) {
%3 = srem i64 %0, 1000000000
%4 = trunc i64 %3 to i32
%5 = sdiv i32 %4, 1000
%6 = sext i32 %5 to i64
store i64 %6, i64* %1
ret i32 undef
}
/* Variables and functions */
double rand_norm();
int sample_delta_r(void) { return (rand_norm() > 0.5) ? 1 : -1; }


x86 assembly (clang, -O0):
<sample_delta_r>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand_norm@plt>
movsd  0xedd(%rip),%xmm1
mov    $0xffffffff,%eax
mov    $0x1,%ecx
ucomisd %xmm1,%xmm0
cmova  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sample_delta_r>:
push   %rax
xor    %eax,%eax
call   1030 <rand_norm@plt>
xor    %eax,%eax
ucomisd 0xede(%rip),%xmm0
seta   %al
add    %eax,%eax
add    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @sample_delta_r() {
%1 = call double (...) @rand_norm()
%2 = fcmp ogt double %1, 5.000000e-01
%3 = zext i1 %2 to i64
%4 = select i1 %2, i32 1, i32 -1
ret i32 %4
}

LLVM IR (-O2):
define i32 @sample_delta_r() {
%1 = tail call double (...) @rand_norm()
%2 = fcmp ogt double %1, 5.000000e-01
%3 = select i1 %2, i32 1, i32 -1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ doit(char *, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main() {
  doit("%s", "hello world\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    0xec6(%rip),%rsi
call   1030 <doit@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed4(%rip),%rsi
call   1030 <doit@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [13 x i8] c"hello world\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @doit(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [13 x i8] c"hello world\0A\00"
define i32 @main() {
%1 = tail call i32 @doit(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
int test_imm_88int16_reg(short val) {
  return ((val) & (-0x88 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_88int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffff78,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_88int16_reg>:
test   $0xff78,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_88int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, -136
%6 = icmp ne i32 %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_88int16_reg(i16 signext %0) {
%2 = and i16 %0, -136
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
char *c_strdup(const char *str) {
  int n = strlen(str) + 1;
  char *dup = malloc(n);
  if (dup)
    strcpy(dup, str);
  return dup;
}


x86 assembly (clang, -O0):
<c_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     116f <c_strdup+0x3f>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1157 <c_strdup+0x27>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @c_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = call i8* @malloc(i32 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %16
12: ; preds = %1
%13 = load i8*, i8** %4
%14 = load i8*, i8** %2
%15 = call i32 @strcpy(i8* %13, i8* %14)
br label %16
16: ; preds = %12, %1
%17 = load i8*, i8** %4
ret i8* %17
}

LLVM IR (-O2):
define i8* @c_strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @strcpy(i8* %4, i8* %0)
br label %8
8: ; preds = %6, %1
ret i8* %4
}
unsigned long insert_nsi(unsigned long insn, long value, const char **errmsg) {
  return insn | ((-value) & 0xffff);
}


x86 assembly (clang, -O0):
<insert_nsi>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
and    $0xffff,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_nsi>:
neg    %esi
movzwl %si,%eax
or     %rdi,%rax
ret

LLVM IR (-O0):
define i64 @insert_nsi(i64 %0, i64 %1, i8** %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8**
store i64 %0, i64* %4
store i64 %1, i64* %5
store i8** %2, i8*** %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = sub nsw i64 0, %8
%10 = and i64 %9, 65535
%11 = or i64 %7, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @insert_nsi(i64 %0, i64 %1, i8** nocapture readnone %2) {
%4 = sub nsw i64 0, %1
%5 = and i64 %4, 65535
%6 = or i64 %5, %0
ret i64 %6
}