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

/* Variables and functions */
struct Queue *queue_open_with_options(char const *const, int /*<<< orphan*/ *);
struct Queue *queue_open(const char *const path) {
  return queue_open_with_options(path, NULL);
}


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

x86 assembly (clang, -O2):
<queue_open>:
xor    %esi,%esi
jmp    1030 <queue_open_with_options@plt>

LLVM IR (-O0):
%struct.Queue = type { i32 }
define %struct.Queue* @queue_open(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call %struct.Queue* @queue_open_with_options(i8* %3, i32* null)
ret %struct.Queue* %4
}

LLVM IR (-O2):
%struct.Queue = type { i32 }
define %struct.Queue* @queue_open(i8* %0) {
%2 = tail call %struct.Queue* @queue_open_with_options(i8* %0, i32* null)
ret %struct.Queue* %2
}
/* Variables and functions */
int /*<<< orphan*/ _delay_ms(int);
unsigned char spi_master_tx_and_rx(unsigned char data) {
  unsigned char rx_data = 0;
  _delay_ms(1);
  return rx_data;
}


x86 assembly (clang, -O0):
<spi_master_tx_and_rx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x0,-0x2(%rbp)
mov    $0x1,%edi
call   1030 <_delay_ms@plt>
movzbl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_master_tx_and_rx>:
push   %rax
mov    $0x1,%edi
call   1030 <_delay_ms@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i8 @spi_master_tx_and_rx(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
store i8 0, i8* %3
%4 = call i32 @_delay_ms(i32 1)
%5 = load i8, i8* %3
ret i8 %5
}

LLVM IR (-O2):
define zeroext i8 @spi_master_tx_and_rx(i8 zeroext %0) {
%2 = tail call i32 @_delay_ms(i32 1)
ret i8 0
}
void dfree_matrix(double **mat, int n) {
#pragma omp parallel for
  for (int i = 0; i < n; ++i)
    free(mat[i]);
  free(mat);
}


x86 assembly (clang, -O0):
<dfree_matrix>:
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 <dfree_matrix+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 <dfree_matrix+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dfree_matrix>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <dfree_matrix+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 <dfree_matrix+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @dfree_matrix(double** %0, i32 %1) {
%3 = alloca double**
%4 = alloca i32
%5 = alloca i32
store double** %0, double*** %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 double**, double*** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double*, double** %11, i64 %13
%15 = load double*, double** %14
%16 = bitcast double* %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 double**, double*** %3
%22 = bitcast double** %21 to i8*
ret void
}

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

/* Variables and functions */
scalar_t__ getrlimit(int, struct rlimit *);
int /*<<< orphan*/ shutdown(int, char *, int);
void getr(int type, struct rlimit *rlim) {
  if (getrlimit(type, rlim))
    shutdown(6, "getrlimit()", 139 - 1);
}


x86 assembly (clang, -O0):
<getr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <getrlimit@plt>
cmp    $0x0,%rax
je     115b <getr+0x3b>
mov    $0x6,%edi
lea    0xeaf(%rip),%rsi
mov    $0x8a,%edx
call   1030 <shutdown@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getr>:
push   %rax
call   1040 <getrlimit@plt>
test   %rax,%rax
je     1142 <getr+0x22>
lea    0xece(%rip),%rsi
mov    $0x6,%edi
mov    $0x8a,%edx
pop    %rax
jmp    1030 <shutdown@plt>
pop    %rax
ret

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

LLVM IR (-O2):
%struct.rlimit = type { i32 }
@.str = [12 x i8] c"getrlimit()\00"
define void @getr(i32 %0, %struct.rlimit* %1) {
%3 = tail call i64 @getrlimit(i32 %0, %struct.rlimit* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @shutdown(i32 6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 138)
br label %7
7: ; preds = %5, %2
ret void
}
/* Variables and functions */
unsigned char b1outp(unsigned int, int, int);
unsigned char b1_disable_irq(unsigned int base) {
  return b1outp(base, 0x02, 0x00);
}


x86 assembly (clang, -O0):
<b1_disable_irq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
xor    %edx,%edx
call   1030 <b1outp@plt>
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<b1_disable_irq>:
mov    $0x2,%esi
xor    %edx,%edx
jmp    1030 <b1outp@plt>

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

LLVM IR (-O2):
define zeroext i8 @b1_disable_irq(i32 %0) {
%2 = tail call zeroext i8 @b1outp(i32 %0, i32 2, i32 0)
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ pause();
void *slavethread(void *arg) {
  while (1)
    pause();
}


x86 assembly (clang, -O0):
<slavethread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <pause@plt>
jmp    111c <slavethread+0xc>

x86 assembly (clang, -O2):
<slavethread>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <pause@plt>
jmp    1120 <slavethread+0x10>

LLVM IR (-O0):
define i8* @slavethread(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %3
%4 = call i32 (...) @pause()
br label %3
}

LLVM IR (-O2):
define noalias i8* @slavethread(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 (...) @pause()
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ bench_context_fork();
int /*<<< orphan*/ bench_context_thread();
int /*<<< orphan*/ bench_fork();
int /*<<< orphan*/ bench_thread();
int main(int argc, char *argv[]) {
  bench_fork();
  bench_thread();
  bench_context_fork();
  bench_context_thread();
  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)
mov    $0x0,%al
call   1040 <bench_fork@plt>
mov    $0x0,%al
call   1050 <bench_thread@plt>
mov    $0x0,%al
call   1060 <bench_context_fork@plt>
mov    $0x0,%al
call   1030 <bench_context_thread@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <bench_fork@plt>
xor    %eax,%eax
call   1050 <bench_thread@plt>
xor    %eax,%eax
call   1060 <bench_context_fork@plt>
xor    %eax,%eax
call   1030 <bench_context_thread@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
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 (...) @bench_fork()
%7 = call i32 (...) @bench_thread()
%8 = call i32 (...) @bench_context_fork()
%9 = call i32 (...) @bench_context_thread()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @bench_fork()
%4 = tail call i32 (...) @bench_thread()
%5 = tail call i32 (...) @bench_context_fork()
%6 = tail call i32 (...) @bench_context_thread()
ret i32 0
}
void foo_1_1_2_1_1_2_2_1_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_1_2_1_1_2_2_1_1() {
ret void
}
unsigned xrop3_232_0_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk2 = S ^ T;
  stk3 = D ^ S;
  stk2 = stk2 & stk3;
  stk1 = S ^ stk2;
  return stk1;
}


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

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

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

LLVM IR (-O2):
define i32 @xrop3_232_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = xor i32 %6, %4
%8 = xor i32 %4, 255
%9 = and i32 %7, %8
%10 = xor i32 %9, %4
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ f(void *);
int main(void) {
  f((void *)0);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @f(i8* null)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i8* null)
ret i32 0
}
/* Variables and functions */
int inb(int);
int /*<<< orphan*/ outb(char, int);
void uart_putchar_raw(int offset, char c) {
  while ((inb(0x2fd + offset) & 0x20) == 0)
    continue;
  outb(c, 0x2f8 + offset);
}


x86 assembly (clang, -O0):
<uart_putchar_raw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%edi
add    $0x2fd,%edi
call   1040 <inb@plt>
and    $0x20,%eax
cmp    $0x0,%eax
jne    1150 <uart_putchar_raw+0x30>
jmp    1131 <uart_putchar_raw+0x11>
mov    -0x5(%rbp),%al
mov    -0x4(%rbp),%esi
add    $0x2f8,%esi
movsbl %al,%edi
call   1030 <outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_putchar_raw>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebx
lea    0x2fd(%rbx),%ebp
nop
mov    %ebp,%edi
call   1040 <inb@plt>
test   $0x20,%al
je     1130 <uart_putchar_raw+0x10>
add    $0x2f8,%ebx
movsbl %r14b,%edi
mov    %ebx,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @uart_putchar_raw(i32 %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
store i8 %1, i8* %4
br label %5
5: ; preds = %11, %2
%6 = load i32, i32* %3
%7 = add nsw i32 765, %6
%8 = call i32 @inb(i32 %7)
%9 = and i32 %8, 32
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %5
br label %5
12: ; preds = %5
%13 = load i8, i8* %4
%14 = load i32, i32* %3
%15 = add nsw i32 760, %14
%16 = call i32 @outb(i8 signext %13, i32 %15)
ret void
}

LLVM IR (-O2):
define void @uart_putchar_raw(i32 %0, i8 signext %1) {
%3 = add nsw i32 %0, 765
br label %4
4: ; preds = %4, %2
%5 = tail call i32 @inb(i32 %3)
%6 = and i32 %5, 32
%7 = icmp eq i32 %6, 0
br i1 %7, label %4, label %8
8: ; preds = %4
%9 = add nsw i32 %0, 760
%10 = tail call i32 @outb(i8 signext %1, i32 %9)
ret void
}
void __DELETE_java_lang_Thread(void *me, void *client_data) {}


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

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

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

LLVM IR (-O2):
define void @__DELETE_java_lang_Thread(i8* nocapture %0, i8* nocapture %1) {
ret void
}
void transfer_BGR8888_to_RGB888(unsigned char *(*output),
                                unsigned char *input) {
  *(*output)++ = input[2];
  *(*output)++ = input[1];
  *(*output)++ = input[0];
}


x86 assembly (clang, -O0):
<transfer_BGR8888_to_RGB888>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<transfer_BGR8888_to_RGB888>:
mov    0x2(%rsi),%al
mov    (%rdi),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,(%rdi)
mov    %al,(%rcx)
mov    0x1(%rsi),%al
mov    (%rdi),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,(%rdi)
mov    %al,(%rcx)
mov    (%rsi),%al
mov    (%rdi),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,(%rdi)
mov    %al,(%rcx)
ret

LLVM IR (-O0):
define void @transfer_BGR8888_to_RGB888(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 = getelementptr inbounds i8, i8* %5, i64 2
%7 = load i8, i8* %6
%8 = load i8**, i8*** %3
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %8
store i8 %7, i8* %9
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = load i8**, i8*** %3
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %14
store i8 %13, i8* %15
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 0
%19 = load i8, i8* %18
%20 = load i8**, i8*** %3
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %20
store i8 %19, i8* %21
ret void
}

LLVM IR (-O2):
define void @transfer_BGR8888_to_RGB888(i8** nocapture %0, i8* nocapture %1) {
%3 = getelementptr inbounds i8, i8* %1, i64 2
%4 = load i8, i8* %3
%5 = load i8*, i8** %0
%6 = getelementptr inbounds i8, i8* %5, i64 1
store i8* %6, i8** %0
store i8 %4, i8* %5
%7 = getelementptr inbounds i8, i8* %1, i64 1
%8 = load i8, i8* %7
%9 = load i8*, i8** %0
%10 = getelementptr inbounds i8, i8* %9, i64 1
store i8* %10, i8** %0
store i8 %8, i8* %9
%11 = load i8, i8* %1
%12 = load i8*, i8** %0
%13 = getelementptr inbounds i8, i8* %12, i64 1
store i8* %13, i8** %0
store i8 %11, i8* %12
ret void
}
void cache_dolib(const char *dir, const char *so, int libtype) { return; }


x86 assembly (clang, -O0):
<cache_dolib>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @cache_dolib(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
define void @cache_dolib(i8* nocapture %0, i8* nocapture %1, i32 %2) {
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ strncat(char *, char *, int);
char *substr(char *src, int pos, int len) {
  char *dest = NULL;
  if (len > 0) {
    dest = (char *)malloc(len + 1);
    strncat(dest, src + pos, len);
  }
  return dest;
}


x86 assembly (clang, -O0):
<substr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    116a <substr+0x4a>
mov    -0x10(%rbp),%edi
add    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
mov    -0x10(%rbp),%edx
call   1030 <strncat@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<substr>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edx,%edx
jle    1152 <substr+0x32>
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r15
lea    0x1(%rbx),%edi
call   1040 <malloc@plt>
mov    %rax,%r14
movslq %ebp,%rax
add    %rax,%r15
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1030 <strncat@plt>
jmp    1155 <substr+0x35>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @substr(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i8* null, i8** %7
%8 = load i32, i32* %6
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %22
10: ; preds = %3
%11 = load i32, i32* %6
%12 = add nsw i32 %11, 1
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %7
%15 = load i8*, i8** %7
%16 = load i8*, i8** %4
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i32, i32* %6
%21 = call i32 @strncat(i8* %15, i8* %19, i32 %20)
br label %22
22: ; preds = %10, %3
%23 = load i8*, i8** %7
ret i8* %23
}

LLVM IR (-O2):
define i8* @substr(i8* %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %12
5: ; preds = %3
%6 = add nuw nsw i32 %2, 1
%7 = tail call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i8*
%9 = sext i32 %1 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = tail call i32 @strncat(i8* %8, i8* %10, i32 %2)
br label %12
12: ; preds = %5, %3
%13 = phi i8* [ %8, %5 ], [ null, %3 ]
ret i8* %13
}
void event_x_reserved(p) char p;
{}


x86 assembly (clang, -O0):
<event_x_reserved>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @event_x_reserved(i32 %0) {
%2 = alloca i8
%3 = trunc i32 %0 to i8
store i8 %3, i8* %2
ret void
}

LLVM IR (-O2):
define void @event_x_reserved(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ og_initStates();
int main() {
  og_initStates();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <og_initStates@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <og_initStates@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @og_initStates()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @og_initStates()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ X509;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *ASN1_item_d2i_fp(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ **);
int /*<<< orphan*/ X509_it;
X509 *d2i_X509_fp(FILE *fp, X509 **x509) {
  return ASN1_item_d2i_fp(&X509_it, fp, x509);
}


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

x86 assembly (clang, -O2):
<d2i_X509_fp>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    0x2ecb(%rip),%rdi
jmp    1030 <ASN1_item_d2i_fp@plt>

LLVM IR (-O0):
@X509_it = global i32 0
define i32* @d2i_X509_fp(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 = load i32**, i32*** %4
%7 = call i32* @ASN1_item_d2i_fp(i32* @X509_it, i32* %5, i32** %6)
ret i32* %7
}

LLVM IR (-O2):
@X509_it = global i32 0
define i32* @d2i_X509_fp(i32* %0, i32** %1) {
%3 = tail call i32* @ASN1_item_d2i_fp(i32* @X509_it, i32* %0, i32** %1)
ret i32* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ test_bit_swap();
int main() {
  int counter = 0;
  if (!test_bit_swap()) {
    printf("Bit swap test failed!\n");
    counter++;
  }
  printf("%d tests failed.\n", counter);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <test_bit_swap@plt>
cmp    $0x0,%eax
jne    115d <main+0x3d>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <test_bit_swap@plt>
test   %eax,%eax
jne    114f <main+0x1f>
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
lea    0xeaa(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Bit swap test failed!\0A\00"
@.str.1 = [18 x i8] c"%d tests failed.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (...) @test_bit_swap()
%4 = icmp ne i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
store i32 %8, i32* %2
br label %9
9: ; preds = %5, %0
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"%d tests failed.\0A\00"
@str = [22 x i8] c"Bit swap test failed!\00"
define i32 @main() {
%1 = tail call i32 (...) @test_bit_swap()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = phi i32 [ 0, %0 ], [ 1, %3 ]
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int i;
  int j;
  int z;
  int res;
  res = 0;
  i = 0;
  z = 1;
  if (i) {
    if (j) {
    } else {
    }
  } else {
    if (z) {
      res = 1;
    } else {
    }
  }
  assert(res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1157 <main+0x47>
cmpl   $0x0,-0xc(%rbp)
je     114d <main+0x3d>
jmp    1152 <main+0x42>
jmp    1152 <main+0x42>
jmp    1177 <main+0x67>
cmpl   $0x0,-0x10(%rbp)
je     116d <main+0x5d>
movl   $0x1,-0x14(%rbp)
jmp    1172 <main+0x62>
jmp    1172 <main+0x62>
jmp    1177 <main+0x67>
mov    -0x14(%rbp),%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
int logsys_mkpri(int priority, int id) { return (((id) << 3) | (priority)); }


x86 assembly (clang, -O0):
<logsys_mkpri>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x3,%eax
or     -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<logsys_mkpri>:
lea    0x0(,%rsi,8),%eax
or     %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @logsys_mkpri(i32 %0, i32 %1) {
%3 = shl i32 %1, 3
%4 = or i32 %3, %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
int main() {
  fprintf(stdout, "Hello world! fprintf=%p, stdout=%p\n", fprintf, stdout);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
mov    0x2eb9(%rip),%rax
mov    (%rax),%ecx
lea    0xed8(%rip),%rsi
mov    0x2eb1(%rip),%rdx
mov    $0x0,%al
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%ecx
lea    0xeef(%rip),%rsi
mov    0x2ec8(%rip),%rdx
mov    %ecx,%edi
xor    %eax,%eax
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [36 x i8] c"Hello world! fprintf=%p, stdout=%p\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @stdout
%3 = load i32, i32* @stdout
%4 = call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 (i32, i8*, ...)* @fprintf, i32 %3)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [36 x i8] c"Hello world! fprintf=%p, stdout=%p\0A\00"
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 (i32, i8*, ...) @fprintf(i32 %1, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 (i32, i8*, ...)* @fprintf, i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void error_not_enough_args() {
  fprintf(stderr, "Usage: licence -l <LICENCE> [-o] <FILE>...\n");
}


x86 assembly (clang, -O0):
<error_not_enough_args>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<error_not_enough_args>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"Usage: licence -l <LICENCE> [-o] <FILE>...\0A\00"
define void @error_not_enough_args() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"Usage: licence -l <LICENCE> [-o] <FILE>...\0A\00"
define void @error_not_enough_args() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void *check_non_null(void *ptr) {
  assert(ptr != 0);
  return ptr;
}


x86 assembly (clang, -O0):
<check_non_null>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_non_null>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @check_non_null(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load i8*, i8** %2
ret i8* %7
}

LLVM IR (-O2):
define i8* @check_non_null(i8* readnone returned %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ terminate_rapl();
void sigint_handler(int signum) {
  terminate_rapl();
  exit(0);
}


x86 assembly (clang, -O0):
<sigint_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <terminate_rapl@plt>
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<sigint_handler>:
push   %rax
xor    %eax,%eax
call   1040 <terminate_rapl@plt>
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @sigint_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @terminate_rapl()
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @sigint_handler(i32 %0) {
%2 = tail call i32 (...) @terminate_rapl()
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ sync();
int main(int argc, char *argv[]) {
  sync();
  exit(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)
mov    $0x0,%al
call   1030 <sync@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <sync@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
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 (...) @sync()
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @sync()
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
struct timeval {
  int dummy;
};
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int syscall_cp(int, int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
               int /*<<< orphan*/ *, struct timeval *);
int select(int n, fd_set *rfds, fd_set *wfds, fd_set *efds,
           struct timeval *tv) {
  return syscall_cp(142, n, rfds, wfds, efds, tv);
}


x86 assembly (clang, -O0):
<select>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    $0x8e,%edi
call   1030 <syscall_cp@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<select>:
mov    %r8,%r9
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0x8e,%edi
jmp    1030 <syscall_cp@plt>

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i32 @select(i32 %0, i32* %1, i32* %2, i32* %3, %struct.timeval* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca %struct.timeval*
store i32 %0, i32* %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store %struct.timeval* %4, %struct.timeval** %10
%11 = load i32, i32* %6
%12 = load i32*, i32** %7
%13 = load i32*, i32** %8
%14 = load i32*, i32** %9
%15 = load %struct.timeval*, %struct.timeval** %10
%16 = call i32 @syscall_cp(i32 142, i32 %11, i32* %12, i32* %13, i32* %14, %struct.timeval* %15)
ret i32 %16
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @select(i32 %0, i32* %1, i32* %2, i32* %3, %struct.timeval* %4) {
%6 = tail call i32 @syscall_cp(i32 142, i32 %0, i32* %1, i32* %2, i32* %3, %struct.timeval* %4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern void clear(void) { printf("\e[H\e[2J"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"\1B[H\1B[2J\00"
define void @clear() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"\1B[H\1B[2J\00"
define void @clear() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
int ctoi(char value) { return (int)((unsigned char)value); }


x86 assembly (clang, -O0):
<ctoi>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctoi>:
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @ctoi(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @ctoi(i8 signext %0) {
%2 = zext i8 %0 to i32
ret i32 %2
}
unsigned parent_node(unsigned i) { return i / 2; }


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

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

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

LLVM IR (-O2):
define i32 @parent_node(i32 %0) {
%2 = lshr i32 %0, 1
ret i32 %2
}
int f(long long a) {
  if (a & 0x3ffffffffffffffull)
    return 1;
  return 1024;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movabs $0x3ffffffffffffff,%rax
ff ff 03
and    -0x10(%rbp),%rax
cmp    $0x0,%rax
je     112c <f+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    1133 <f+0x33>
movl   $0x400,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
shl    $0x6,%rdi
mov    $0x400,%ecx
mov    $0x1,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @f(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = and i64 %4, 288230376151711743
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %9
8: ; preds = %1
store i32 1024, i32* %2
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @f(i64 %0) {
%2 = and i64 %0, 288230376151711743
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 1024, i32 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void get_subdirname(void) { printf("riscv64"); }


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"riscv64\00"
define void @get_subdirname() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ report(char *, int /*<<< orphan*/, char *, char *, int,
                          int /*<<< orphan*/, int /*<<< orphan*/,
                          unsigned long);
void bad(char *comment, char *re, char *s, int len, unsigned long test) {
  printf("bad test case ");
  report(comment, 0, re, s, len, 0, 0, test);
  exit(1);
}


x86 assembly (clang, -O0):
<bad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    -0x28(%rbp),%rax
xor    %r9d,%r9d
mov    %r9d,%esi
movl   $0x0,(%rsp)
mov    %rax,0x8(%rsp)
call   1050 <report@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<bad>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8,%r14
mov    %ecx,%r15d
mov    %rdx,%r12
mov    %rsi,%rbp
mov    %rdi,%rbx
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %rbp,%rdx
mov    %r12,%rcx
mov    %r15d,%r8d
xor    %r9d,%r9d
push   %r14
push   $0x0
call   1050 <report@plt>
add    $0x10,%rsp
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"bad test case \00"
define void @bad(i8* %0, i8* %1, i8* %2, i32 %3, i64 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i64
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i64 %4, i64* %10
%11 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%12 = load i8*, i8** %6
%13 = load i8*, i8** %7
%14 = load i8*, i8** %8
%15 = load i32, i32* %9
%16 = load i64, i64* %10
%17 = call i32 @report(i8* %12, i32 0, i8* %13, i8* %14, i32 %15, i32 0, i32 0, i64 %16)
%18 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [15 x i8] c"bad test case \00"
define void @bad(i8* %0, i8* %1, i8* %2, i32 %3, i64 %4) {
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @report(i8* %0, i32 0, i8* %1, i8* %2, i32 %3, i32 0, i32 0, i64 %4)
%8 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int, int);
void exitfunc19(int status, void *arg) {
  printf("Executing exitfunc19 (status=%d, arg=%d)\n", status, (int)arg);
  exit((int)arg);
}


x86 assembly (clang, -O0):
<exitfunc19>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rax
mov    %eax,%edx
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %eax,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<exitfunc19>:
push   %rbx
mov    %rsi,%rbx
mov    %edi,%esi
lea    0xed3(%rip),%rdi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"Executing exitfunc19 (status=%d, arg=%d)\0A\00"
define void @exitfunc19(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = ptrtoint i8* %6 to i32
%8 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %7)
%9 = load i8*, i8** %4
%10 = ptrtoint i8* %9 to i32
%11 = call i32 @exit(i32 %10)
unreachable
}

LLVM IR (-O2):
@.str = [42 x i8] c"Executing exitfunc19 (status=%d, arg=%d)\0A\00"
define void @exitfunc19(i32 %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = trunc i64 %3 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %4)
%6 = tail call i32 @exit(i32 %4)
unreachable
}
int f(int a) {
  if (a > 10) {
    double b = 3.14;
    return (int)(a * b);
  }
  return a;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jle    1134 <f+0x34>
movsd  0xee7(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
jmp    113a <f+0x3a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
cmp    $0xb,%edi
cvtsi2sd %edi,%xmm0
mulsd  0xef1(%rip),%xmm0
cvttsd2si %xmm0,%eax
cmovl  %edi,%eax
ret

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp sgt i32 %5, 10
br i1 %6, label %7, label %13
7: ; preds = %1
store double 3.140000e+00, double* %4
%8 = load i32, i32* %3
%9 = sitofp i32 %8 to double
%10 = load double, double* %4
%11 = fmul double %9, %10
%12 = fptosi double %11 to i32
store i32 %12, i32* %2
br label %15
13: ; preds = %1
%14 = load i32, i32* %3
store i32 %14, i32* %2
br label %15
15: ; preds = %13, %7
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = icmp sgt i32 %0, 10
%3 = sitofp i32 %0 to double
%4 = fmul double %3, 3.140000e+00
%5 = fptosi double %4 to i32
%6 = select i1 %2, i32 %5, i32 %0
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int;
typedef int /*<<< orphan*/ SVCXPRT;

/* Variables and functions */
int /*<<< orphan*/ *makefd_xprt(int, int /*<<< orphan*/, int /*<<< orphan*/);
SVCXPRT *svcunixfd_create(int fd, u_int sendsize, u_int recvsize) {
  return makefd_xprt(fd, sendsize, recvsize);
}


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

x86 assembly (clang, -O2):
<svcunixfd_create>:
jmp    1030 <makefd_xprt@plt>

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

LLVM IR (-O2):
define i32* @svcunixfd_create(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32* @makefd_xprt(i32 %0, i32 %1, i32 %2)
ret i32* %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void main() {
  printf("%s", "This is STDOUT\n");
  fprintf(stdout, "%s", "This is STDOUT\n");
  fprintf(stderr, "%s", "This is STDERR\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xed1(%rip),%rsi
call   1030 <printf@plt>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xeb9(%rip),%rsi
lea    0xeb5(%rip),%rdx
call   1040 <fprintf@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
lea    0xea9(%rip),%rdx
call   1040 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rbx
lea    0xed1(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1040 <fprintf@plt>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
lea    0xeb2(%rip),%rdx
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [16 x i8] c"This is STDOUT\0A\00"
@stdout = global i32 0
@stderr = global i32 0
@.str.2 = [16 x i8] c"This is STDERR\0A\00"
define void @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [16 x i8] c"This is STDOUT\0A\00"
@stdout = global i32 0
@stderr = global i32 0
@.str.2 = [16 x i8] c"This is STDERR\0A\00"
define void @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
ret void
}