xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ concat(char const *, char *);
int /*<<< orphan*/ fifo_remove(int /*<<< orphan*/);
int /*<<< orphan*/ srmdir(char const *);
void dpx_remove(const char *path) {
  fifo_remove(concat(path, "/sub"));
  fifo_remove(concat(path, "/pub"));
  srmdir(path);
}


x86 assembly (clang, -O0):
<dpx_remove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1030 <concat@plt>
mov    %eax,%edi
call   1040 <fifo_remove@plt>
mov    -0x8(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1030 <concat@plt>
mov    %eax,%edi
call   1040 <fifo_remove@plt>
mov    -0x8(%rbp),%rdi
call   1050 <srmdir@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dpx_remove>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rsi
call   1030 <concat@plt>
mov    %eax,%edi
call   1040 <fifo_remove@plt>
lea    0xeb7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <concat@plt>
mov    %eax,%edi
call   1040 <fifo_remove@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <srmdir@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"/sub\00"
@.str.1 = [5 x i8] c"/pub\00"
define void @dpx_remove(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @concat(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @fifo_remove(i32 %4)
%6 = load i8*, i8** %2
%7 = call i32 @concat(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @fifo_remove(i32 %7)
%9 = load i8*, i8** %2
%10 = call i32 @srmdir(i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"/sub\00"
@.str.1 = [5 x i8] c"/pub\00"
define void @dpx_remove(i8* %0) {
%2 = tail call i32 @concat(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @fifo_remove(i32 %2)
%4 = tail call i32 @concat(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @fifo_remove(i32 %4)
%6 = tail call i32 @srmdir(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ jp();
void cpu_jp_nn() { jp(); }


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

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

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

LLVM IR (-O2):
define void @cpu_jp_nn() {
%1 = tail call i32 (...) @jp()
ret void
}
/* Variables and functions */
void *Malloc(int);
int /*<<< orphan*/ memcpy(void *, void const *, int);
void *key_copy(const void *key, int key_len) {
  void *copy;
  copy = Malloc(key_len);
  if (!copy)
    return 0;
  memcpy(copy, key, key_len);
  return copy;
}


x86 assembly (clang, -O0):
<key_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <Malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1153 <key_copy+0x33>
movq   $0x0,-0x8(%rbp)
jmp    116b <key_copy+0x4b>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<key_copy>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%edi
call   1030 <Malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1145 <key_copy+0x25>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @key_copy(i8* %0, i32 %1) {
%3 = tail call i8* @Malloc(i32 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @memcpy(i8* %3, i8* %0, i32 %1)
br label %7
7: ; preds = %2, %5
ret i8* %3
}
/* Variables and functions */
long meat_time_find_begin_of_month(long const);
long meat_time_offset_days(int);
long meat_time_offset_months(int const);
signed long int meat_time_find_middle_of_month(signed long int const i_now,
                                               int const i_count) {
  signed long int i_begin_of_month;
  i_begin_of_month = meat_time_find_begin_of_month(i_now);
  return (i_begin_of_month + meat_time_offset_days(14) +
          meat_time_offset_months(i_count));
}


x86 assembly (clang, -O0):
<meat_time_find_middle_of_month>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <meat_time_find_begin_of_month@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0xe,%edi
call   1040 <meat_time_offset_days@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <meat_time_offset_months@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
add    %rcx,%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<meat_time_find_middle_of_month>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
call   1050 <meat_time_find_begin_of_month@plt>
mov    %rax,%rbx
mov    $0xe,%edi
call   1040 <meat_time_offset_days@plt>
mov    %rax,%rbp
add    %rbx,%rbp
mov    %r14d,%edi
call   1030 <meat_time_offset_months@plt>
add    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i64 @meat_time_find_middle_of_month(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i64
store i64 %0, i64* %3
store i32 %1, i32* %4
%6 = load i64, i64* %3
%7 = call i64 @meat_time_find_begin_of_month(i64 %6)
store i64 %7, i64* %5
%8 = load i64, i64* %5
%9 = call i64 @meat_time_offset_days(i32 14)
%10 = add nsw i64 %8, %9
%11 = load i32, i32* %4
%12 = call i64 @meat_time_offset_months(i32 %11)
%13 = add nsw i64 %10, %12
ret i64 %13
}

LLVM IR (-O2):
define i64 @meat_time_find_middle_of_month(i64 %0, i32 %1) {
%3 = tail call i64 @meat_time_find_begin_of_month(i64 %0)
%4 = tail call i64 @meat_time_offset_days(i32 14)
%5 = add nsw i64 %4, %3
%6 = tail call i64 @meat_time_offset_months(i32 %1)
%7 = add nsw i64 %5, %6
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ RVS_Ipoint(int);
void test_ipoint_1(int v) { RVS_Ipoint(v); }


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

x86 assembly (clang, -O2):
<test_ipoint_1>:
jmp    1030 <RVS_Ipoint@plt>

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

LLVM IR (-O2):
define void @test_ipoint_1(i32 %0) {
%2 = tail call i32 @RVS_Ipoint(i32 %0)
ret void
}
void enQueue(int socket) {}


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

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

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

LLVM IR (-O2):
define void @enQueue(i32 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ siginfo_t;

/* Variables and functions */
int /*<<< orphan*/ display_backtrace();
void backtrace_handle_signal(siginfo_t *info) { display_backtrace(); }


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

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

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

LLVM IR (-O2):
define void @backtrace_handle_signal(i32* nocapture readnone %0) {
%2 = tail call i32 (...) @display_backtrace()
ret void
}
/* Variables and functions */
int atan(int);
int /*<<< orphan*/ printf(char *, double, char);
int main() {
  double pi;
  char ch;
  pi = 4 * atan(1);
  ch = *(char *)&pi;
  printf("pi=%1.10f\tch=%c\n", pi, ch);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1040 <atan@plt>
shl    $0x2,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x10(%rbp),%al
mov    %al,-0x11(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xea9(%rip),%rdi
movsbl -0x11(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1040 <atan@plt>
shl    $0x2,%eax
cvtsi2sd %eax,%xmm0
movq   %xmm0,%rax
movsbl %al,%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"pi=%1.10f\09ch=%c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i8
store i32 0, i32* %1
%4 = call i32 @atan(i32 1)
%5 = mul nsw i32 4, %4
%6 = sitofp i32 %5 to double
store double %6, double* %2
%7 = bitcast double* %2 to i8*
%8 = load i8, i8* %7
store i8 %8, i8* %3
%9 = load double, double* %2
%10 = load i8, i8* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double %9, i8 signext %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"pi=%1.10f\09ch=%c\0A\00"
define i32 @main() {
%1 = tail call i32 @atan(i32 1)
%2 = shl nsw i32 %1, 2
%3 = sitofp i32 %2 to double
%4 = bitcast double %3 to i64
%5 = trunc i64 %4 to i8
%6 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double %3, i8 signext %5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  int i;
  int vc[5];
  for (i = 0; i < 5; i++)
    printf("vc[%d]= %d \n", i, vc[i]);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1155 <main+0x45>
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%edx
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"vc[%d]= %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [5 x i32]
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %14, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 5
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %12)
br label %14
14: ; preds = %7
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %4
17: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"vc[%d]= %d \0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 0, i32 undef)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 1, i32 undef)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 2, i32 undef)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 3, i32 undef)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 4, i32 undef)
ret i32 0
}
/* Variables and functions */
int zgeth1();
zgethex() {
  register int c;
  c = zgeth1();
  return c;
}


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

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

LLVM IR (-O0):
define i32 @zgethex() {
%1 = alloca i32
%2 = call i32 (...) @zgeth1()
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @zgethex() {
%1 = tail call i32 (...) @zgeth1()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int);
void tinysh_char_out(unsigned char c) { putchar((int)c); }


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

x86 assembly (clang, -O2):
<tinysh_char_out>:
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @tinysh_char_out(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = call i32 @putchar(i32 %4)
ret void
}

LLVM IR (-O2):
define void @tinysh_char_out(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = tail call i32 @putchar(i32 %2)
ret void
}
float frequencyToIncrement(float samplingRate, float frequency,
                           int bufferLength) {
  return (frequency / samplingRate) * (float)bufferLength;
}


x86 assembly (clang, -O0):
<frequencyToIncrement>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
divss  -0x4(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<frequencyToIncrement>:
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ss %edi,%xmm0
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @frequencyToIncrement(float %0, float %1, i32 %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca i32
store float %0, float* %4
store float %1, float* %5
store i32 %2, i32* %6
%7 = load float, float* %5
%8 = load float, float* %4
%9 = fdiv float %7, %8
%10 = load i32, i32* %6
%11 = sitofp i32 %10 to float
%12 = fmul float %9, %11
ret float %12
}

LLVM IR (-O2):
define float @frequencyToIncrement(float %0, float %1, i32 %2) {
%4 = fdiv float %1, %0
%5 = sitofp i32 %2 to float
%6 = fmul float %4, %5
ret float %6
}
int genpos(int x, int y) { return 64 * x + y; }


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

x86 assembly (clang, -O2):
<genpos>:
shl    $0x6,%edi
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @genpos(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 = mul nsw i32 64, %5
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @genpos(i32 %0, i32 %1) {
%3 = shl nsw i32 %0, 6
%4 = add nsw i32 %3, %1
ret i32 %4
}
int affirmd(prompt, dval)
char *prompt;
{ return (waffirm(prompt, 1, dval)); }


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

x86 assembly (clang, -O2):
<affirmd>:
mov    %esi,%edx
mov    $0x1,%esi
xor    %eax,%eax
jmp    1030 <waffirm@plt>

LLVM IR (-O0):
define i32 @affirmd(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @waffirm to i32 (i8*, i32, i32, ...)*)(i8* %5, i32 1, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @affirmd(i8* %0, i32 %1) {
%3 = tail call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @waffirm to i32 (i8*, i32, i32, ...)*)(i8* %0, i32 1, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int die(char *str) {
  perror(str);
  exit(1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define i32 @die(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int system(char *);
int main(void) { return system("xcbm5x0.exe -sounddev dummy"); }


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

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

LLVM IR (-O0):
@.str = [28 x i8] c"xcbm5x0.exe -sounddev dummy\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}

LLVM IR (-O2):
@.str = [28 x i8] c"xcbm5x0.exe -sounddev dummy\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ Cbuf_Execute();
int /*<<< orphan*/ IN_Commands();
int /*<<< orphan*/ IN_Frame();
int /*<<< orphan*/ Sys_SendKeyEvents();
void CL_UserInputFrame(void) {
  IN_Frame();
  Sys_SendKeyEvents();
  IN_Commands();
  Cbuf_Execute();
}


x86 assembly (clang, -O0):
<CL_UserInputFrame>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <IN_Frame@plt>
mov    $0x0,%al
call   1050 <Sys_SendKeyEvents@plt>
mov    $0x0,%al
call   1060 <IN_Commands@plt>
mov    $0x0,%al
call   1040 <Cbuf_Execute@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<CL_UserInputFrame>:
push   %rax
xor    %eax,%eax
call   1030 <IN_Frame@plt>
xor    %eax,%eax
call   1050 <Sys_SendKeyEvents@plt>
xor    %eax,%eax
call   1060 <IN_Commands@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <Cbuf_Execute@plt>

LLVM IR (-O0):
define void @CL_UserInputFrame() {
%1 = call i32 (...) @IN_Frame()
%2 = call i32 (...) @Sys_SendKeyEvents()
%3 = call i32 (...) @IN_Commands()
%4 = call i32 (...) @Cbuf_Execute()
ret void
}

LLVM IR (-O2):
define void @CL_UserInputFrame() {
%1 = tail call i32 (...) @IN_Frame()
%2 = tail call i32 (...) @Sys_SendKeyEvents()
%3 = tail call i32 (...) @IN_Commands()
%4 = tail call i32 (...) @Cbuf_Execute()
ret void
}
void wcnss_prevent_suspend(void) {}


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

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

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

LLVM IR (-O2):
define void @wcnss_prevent_suspend() {
ret void
}
void socket_init() {}


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

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

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

LLVM IR (-O2):
define void @socket_init() {
ret void
}
/* Variables and functions */
int myfunc();
int __attribute__((weak)) foo() { return myfunc(); }


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

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

LLVM IR (-O0):
define weak i32 @foo() {
%1 = call i32 (...) @myfunc()
ret i32 %1
}

LLVM IR (-O2):
define weak i32 @foo() {
%1 = tail call i32 (...) @myfunc()
ret i32 %1
}
/* Variables and functions */
void _m_prefetch(void *);
void test_m_prefetch(void *p) { return _m_prefetch(p); }


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

x86 assembly (clang, -O2):
<test_m_prefetch>:
jmp    1030 <_m_prefetch@plt>

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

LLVM IR (-O2):
define void @test_m_prefetch(i8* %0) {
tail call void @_m_prefetch(i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, float);
int /*<<< orphan*/ t4_list(int /*<<< orphan*/ *, float *);
void t4_write(FILE *fp, float *t4, float scale) {
  int i, m;
  t4_list(fp, t4);
  if (scale != 0)
    fprintf(fp, "scale:    %10.6f\n", scale);
}


x86 assembly (clang, -O0):
<t4_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <t4_list@plt>
movss  -0x14(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    115e <t4_write+0x3e>
jp     115e <t4_write+0x3e>
jmp    1173 <t4_write+0x53>
mov    -0x8(%rbp),%rdi
movss  -0x14(%rbp),%xmm0
lea    0xe92(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t4_write>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0xc(%rsp)
mov    %rdi,%rbx
call   1030 <t4_list@plt>
xorps  %xmm0,%xmm0
movss  0xc(%rsp),%xmm1
ucomiss %xmm0,%xmm1
jne    1143 <t4_write+0x23>
jnp    115a <t4_write+0x3a>
movaps %xmm1,%xmm0
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"scale: %10.6f\0A\00"
define void @t4_write(i32* %0, float* %1, float %2) {
%4 = alloca i32*
%5 = alloca float*
%6 = alloca float
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store float* %1, float** %5
store float %2, float* %6
%9 = load i32*, i32** %4
%10 = load float*, float** %5
%11 = call i32 @t4_list(i32* %9, float* %10)
%12 = load float, float* %6
%13 = fcmp une float %12, 0.000000e+00
br i1 %13, label %14, label %18
14: ; preds = %3
%15 = load i32*, i32** %4
%16 = load float, float* %6
%17 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), float %16)
br label %18
18: ; preds = %14, %3
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"scale: %10.6f\0A\00"
define void @t4_write(i32* %0, float* %1, float %2) {
%4 = tail call i32 @t4_list(i32* %0, float* %1)
%5 = fcmp une float %2, 0.000000e+00
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), float %2)
br label %8
8: ; preds = %6, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int subBits(int bits, int start, int len, int left_shift) {
  assert((start + len) <= 32 && left_shift <= 32);
  return (((bits >> start)) & ((1 << len) - 1)) << left_shift;
}


x86 assembly (clang, -O0):
<subBits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x8(%rbp),%ecx
add    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x11(%rbp)
jg     1142 <subBits+0x32>
cmpl   $0x20,-0x10(%rbp)
setle  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
sub    $0x1,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%ecx
shl    %cl,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subBits>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebp
mov    %edi,%ebx
lea    (%r15,%rbp,1),%eax
cmp    $0x21,%eax
setl   %al
cmp    $0x21,%ecx
setl   %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
mov    %ebp,%ecx
sar    %cl,%ebx
mov    $0xffffffff,%eax
mov    %r15d,%ecx
shl    %cl,%eax
not    %eax
and    %ebx,%eax
mov    %r14d,%ecx
shl    %cl,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @subBits(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = add nsw i32 %2, %1
%6 = icmp slt i32 %5, 33
%7 = icmp slt i32 %3, 33
%8 = and i1 %6, %7
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = ashr i32 %0, %1
%12 = shl nsw i32 -1, %2
%13 = xor i32 %12, -1
%14 = and i32 %11, %13
%15 = shl i32 %14, %3
ret i32 %15
}
void gtk_file_chooser_set_filter() {}


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

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

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

LLVM IR (-O2):
define void @gtk_file_chooser_set_filter() {
ret void
}
int ioctl_readtoc_raw(unsigned char *b, int maxlen) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ioctl_readtoc_raw(i8* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_rwlock_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_rwlock_unlock(int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_rwlock_wrlock(int /*<<< orphan*/ *);
void sync_add(pthread_rwlock_t *lock, int *var, int val) {
  pthread_rwlock_wrlock(lock);
  { *var += val; }
  pthread_rwlock_unlock(lock);
}


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

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

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

LLVM IR (-O2):
define void @sync_add(i32* %0, i32* nocapture %1, i32 %2) {
%4 = tail call i32 @pthread_rwlock_wrlock(i32* %0)
%5 = load i32, i32* %1
%6 = add nsw i32 %5, %2
store i32 %6, i32* %1
%7 = tail call i32 @pthread_rwlock_unlock(i32* %0)
ret void
}
int putchar(int c) {
  _Bool error;
__ESBMC_HIDE:
  printf("%c", c);
  return (error ? -1 : c);
}


x86 assembly (clang, -O0):
<putchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
testb  $0x1,-0x5(%rbp)
je     1143 <putchar+0x33>
mov    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1149 <putchar+0x39>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putchar>:
jmp    1100 <putchar>

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

LLVM IR (-O2):
define i32 @putchar(i32 %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
/* Variables and functions */
int tolower(int);
int _irc_tolower(int c) {
  switch (c) {
  case '\\':
    return '|';
  default:
    return tolower(c);
  }
}


x86 assembly (clang, -O0):
<_irc_tolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x5c,%eax
jne    1138 <_irc_tolower+0x28>
jmp    112c <_irc_tolower+0x1c>
movl   $0x7c,-0x4(%rbp)
jmp    1143 <_irc_tolower+0x33>
mov    -0x8(%rbp),%edi
call   1030 <tolower@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_irc_tolower>:
cmp    $0x5c,%edi
jne    111b <_irc_tolower+0xb>
mov    $0x7c,%eax
ret
jmp    1030 <tolower@plt>

LLVM IR (-O0):
define i32 @_irc_tolower(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 92, label %5
]
5: ; preds = %1
store i32 124, i32* %2
br label %9
6: ; preds = %1
%7 = load i32, i32* %3
%8 = call i32 @tolower(i32 %7)
store i32 %8, i32* %2
br label %9
9: ; preds = %6, %5
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @_irc_tolower(i32 %0) {
%2 = icmp eq i32 %0, 92
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @tolower(i32 %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 124, %1 ]
ret i32 %6
}
/* Variables and functions */
double E0F();
double ECHF(int i, double x) { return (i - x) * (i - x) - E0F(); }


x86 assembly (clang, -O0):
<ECHF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1030 <E0F@plt>
movsd  -0x20(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ECHF>:
push   %rax
cvtsi2sd %edi,%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
xor    %eax,%eax
call   1030 <E0F@plt>
movsd  (%rsp),%xmm1
mulsd  %xmm1,%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @ECHF(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%5 = load i32, i32* %3
%6 = sitofp i32 %5 to double
%7 = load double, double* %4
%8 = fsub double %6, %7
%9 = load i32, i32* %3
%10 = sitofp i32 %9 to double
%11 = load double, double* %4
%12 = fsub double %10, %11
%13 = call double (...) @E0F()
%14 = fneg double %13
%15 = call double @llvm.fmuladd.f64(double %8, double %12, double %14)
ret double %15
}

LLVM IR (-O2):
define double @ECHF(i32 %0, double %1) {
%3 = sitofp i32 %0 to double
%4 = fsub double %3, %1
%5 = tail call double (...) @E0F()
%6 = fneg double %5
%7 = tail call double @llvm.fmuladd.f64(double %4, double %4, double %6)
ret double %7
}
int do_859() { return 859; }


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

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

LLVM IR (-O0):
define i32 @do_859() {
ret i32 859
}

LLVM IR (-O2):
define i32 @do_859() {
ret i32 859
}
/* Variables and functions */
scalar_t__ read(int, char *, int);
int readc(int fd) {
  char c;
  if (read(fd, &c, 1) <= 0) {
    return -1;
  }
  return c;
}


x86 assembly (clang, -O0):
<readc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x0,%rax
jg     1142 <readc+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    1149 <readc+0x39>
movsbl -0x9(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readc>:
push   %rax
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
test   %rax,%rax
movsbl 0x7(%rsp),%ecx
mov    $0xffffffff,%eax
cmovg  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @readc(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i64 @read(i32 %5, i8* %4, i32 1)
%7 = icmp sle i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %12
9: ; preds = %1
%10 = load i8, i8* %4
%11 = sext i8 %10 to i32
store i32 %11, i32* %2
br label %12
12: ; preds = %9, %8
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @readc(i32 %0) {
%2 = alloca i8
%3 = call i64 @read(i32 %0, i8* %2, i32 1)
%4 = icmp slt i64 %3, 1
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = select i1 %4, i32 -1, i32 %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int rand();
int get_random_in_range(int min, int max) {
  assert(min < max);
  return (rand() % max + min);
}


x86 assembly (clang, -O0):
<get_random_in_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x0,%al
call   1040 <rand@plt>
cltd
idivl  -0x8(%rbp)
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_random_in_range>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
cmp    %esi,%ebp
setl   %dil
call   1030 <assert@plt>
xor    %eax,%eax
call   1040 <rand@plt>
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_random_in_range(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 = icmp slt i32 %5, %6
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i32 (...) @rand()
%11 = load i32, i32* %4
%12 = srem i32 %10, %11
%13 = load i32, i32* %3
%14 = add nsw i32 %12, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @get_random_in_range(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, %1
%8 = add nsw i32 %7, %0
ret i32 %8
}
int bitwise_or(int x, int y) { return x | y; }


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

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

LLVM IR (-O0):
define i32 @bitwise_or(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 = or i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @bitwise_or(i32 %0, i32 %1) {
%3 = or i32 %1, %0
ret i32 %3
}
/* Type definitions */
struct user {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct user *);
void user_delete(struct user *u) {
  if (u)
    free(u);
}


x86 assembly (clang, -O0):
<user_delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <user_delete+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<user_delete>:
test   %rdi,%rdi
je     111a <user_delete+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
%struct.user = type { i32 }
define void @user_delete(%struct.user* %0) {
%2 = alloca %struct.user*
store %struct.user* %0, %struct.user** %2
%3 = load %struct.user*, %struct.user** %2
%4 = icmp ne %struct.user* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load %struct.user*, %struct.user** %2
%7 = call i32 @free(%struct.user* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
%struct.user = type { i32 }
define void @user_delete(%struct.user* %0) {
%2 = icmp eq %struct.user* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(%struct.user* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int wchar_t;
struct _Locale_numeric {
  int dummy;
};

/* Variables and functions */
wchar_t _WLocale_thousands_sep(struct _Locale_numeric *lnum) { return L','; }


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

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

LLVM IR (-O0):
%struct._Locale_numeric = type { i32 }
define i32 @_WLocale_thousands_sep(%struct._Locale_numeric* %0) {
%2 = alloca %struct._Locale_numeric*
store %struct._Locale_numeric* %0, %struct._Locale_numeric** %2
ret i32 44
}

LLVM IR (-O2):
%struct._Locale_numeric = type { i32 }
define i32 @_WLocale_thousands_sep(%struct._Locale_numeric* nocapture readnone %0) {
ret i32 44
}
int symlink(char *src, char *dst) {}


x86 assembly (clang, -O0):
<symlink>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @symlink(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void Debug_UserLog(char *log, int err) { puts(log); }


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

x86 assembly (clang, -O2):
<Debug_UserLog>:
jmp    1030 <puts@plt>

LLVM IR (-O0):
define void @Debug_UserLog(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 @puts(i8* %5)
ret void
}

LLVM IR (-O2):
define void @Debug_UserLog(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ c;
typedef int /*<<< orphan*/ b;

/* Variables and functions */
int /*<<< orphan*/ fun(int *, int *);
int /*<<< orphan*/ printf(char *, int, int);
main() {
  int b[20], *c, a;
  c = &a;
  printf("\nb=%u,c=%u", sizeof(b), sizeof(c));
  fun(b, c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x5c(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    0xec9(%rip),%rdi
mov    $0x50,%esi
mov    $0x8,%edx
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
call   1030 <fun@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%rsp
lea    0xed5(%rip),%rdi
mov    $0x50,%esi
mov    $0x8,%edx
call   1040 <printf@plt>
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1030 <fun@plt>
xor    %eax,%eax
add    $0x68,%rsp
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"\0Ab=%u,c=%u\00"
define i32 @main() {
%1 = alloca [20 x i32]
%2 = alloca i32
%3 = bitcast [20 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 80, i32 8)
%6 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%7 = call i32 @fun(i32* %6, i32* %2)
ret i32 0
}
int slacpy(char UPLO, int M, int N, float *A, int LDA, float *B, int LDB) {
  extern int slacpy_(char *UPLO, int *M, int *N, float *A, int *LDA, float *B,
                     int *LDB);
  return slacpy_(&UPLO, &M, &N, A, &LDA, B, &LDB);
}


x86 assembly (clang, -O0):
<slacpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dil,%al
mov    0x10(%rbp),%edi
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x28(%rbp),%r9
lea    -0x1(%rbp),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x1c(%rbp),%r8
lea    0x10(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <slacpy_@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slacpy>:
sub    $0x18,%rsp
mov    %dil,0xb(%rsp)
mov    %esi,0x14(%rsp)
mov    %edx,0x10(%rsp)
mov    %r8d,0xc(%rsp)
lea    0x20(%rsp),%rax
mov    %rax,(%rsp)
lea    0xb(%rsp),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%r8
call   1030 <slacpy_@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @slacpy(i8 signext %0, i32 %1, i32 %2, float* %3, i32 %4, float* %5, i32 %6) {
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
%11 = alloca float*
%12 = alloca i32
%13 = alloca float*
%14 = alloca i32
store i8 %0, i8* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store float* %3, float** %11
store i32 %4, i32* %12
store float* %5, float** %13
store i32 %6, i32* %14
%15 = load float*, float** %11
%16 = load float*, float** %13
%17 = call i32 @slacpy_(i8* %8, i32* %9, i32* %10, float* %15, i32* %12, float* %16, i32* %14)
ret i32 %17
}

LLVM IR (-O2):
define i32 @slacpy(i8 signext %0, i32 %1, i32 %2, float* %3, i32 %4, float* %5, i32 %6) {
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8 %0, i8* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %4, i32* %11
store i32 %6, i32* %12
%13 = call i32 @slacpy_(i8* %8, i32* %9, i32* %10, float* %3, i32* %11, float* %5, i32* %12)
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *, char *, char);
int main() {
  char buff[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  char x = 0;
  *(buff - 1) = 16;
  buff[10] = 16;
  printf("%p  %p  %p %d\n", &buff[0], &buff[9], &x, x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0xa(%rbp)
mov    0xede(%rip),%ax
mov    %ax,-0x2(%rbp)
movb   $0x0,-0xb(%rbp)
movb   $0x10,-0xb(%rbp)
movb   $0x10,0x0(%rbp)
lea    -0xa(%rbp),%rsi
lea    -0xa(%rbp),%rdx
add    $0x9,%rdx
lea    0xebd(%rip),%rdi
lea    -0xb(%rbp),%rcx
movsbl -0xb(%rbp),%r8d
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x807060504030201,%rax
06 07 08
mov    %rax,0x8(%rsp)
movw   $0xa09,0x10(%rsp)
movb   $0x0,0x7(%rsp)
movb   $0x10,0x7(%rsp)
movb   $0x10,0x12(%rsp)
lea    0x11(%rsp),%rdx
lea    0xec5(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0x7(%rsp),%rcx
xor    %r8d,%r8d
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.buff = [10 x i8] c"\01\02\03\04\05\06\07\08\09\0A"
@.str = [15 x i8] c"%p %p %p %d\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca i8
%3 = bitcast [10 x i8]* %1 to i8*
store i8 0, i8* %2
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds i8, i8* %4, i64 -1
store i8 16, i8* %5
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 10
store i8 16, i8* %6
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 9
%9 = load i8, i8* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8, i8* %2, i8 signext %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.buff = [10 x i8] c"\01\02\03\04\05\06\07\08\09\0A"
@.str = [15 x i8] c"%p %p %p %d\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca i8
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
store i8 0, i8* %2
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 -1
store i8 16, i8* %4
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 10
store i8 16, i8* %5
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 9
%7 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %6, i8* %2, i8 signext 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(size_t *, size_t *, int);
size_t arr_len(void const *a) {
  size_t ret;
  memcpy(&ret, (size_t *)a - 1, sizeof ret);
  return ret;
}


x86 assembly (clang, -O0):
<arr_len>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
add    $0xfffffffffffffff8,%rsi
lea    -0x10(%rbp),%rdi
mov    $0x8,%edx
call   1030 <memcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arr_len>:
push   %rax
lea    -0x8(%rdi),%rsi
mov    %rsp,%rdi
mov    $0x8,%edx
call   1030 <memcpy@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @arr_len(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i64*
%6 = getelementptr inbounds i64, i64* %5, i64 -1
%7 = call i32 @memcpy(i64* %3, i64* %6, i32 8)
%8 = load i64, i64* %3
ret i64 %8
}

LLVM IR (-O2):
define i64 @arr_len(i8* %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = getelementptr inbounds i8, i8* %0, i64 -8
%5 = bitcast i8* %4 to i64*
%6 = call i32 @memcpy(i64* %2, i64* %5, i32 8)
%7 = load i64, i64* %2
ret i64 %7
}