xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  for (int i = 0; i < 100; i++) {
    assert(i < 100);
    for (int k = 0; k < 1000; k++) {
      assert(k < 1000);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    118a <main+0x7a>
cmpl   $0x64,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    1177 <main+0x67>
cmpl   $0x3e8,-0xc(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <main+0x38>
jmp    117c <main+0x6c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x3e8,%ebp
nop
mov    $0x1,%edi
call   1030 <assert@plt>
add    $0xffffffff,%ebp
jne    1130 <main+0x20>
add    $0x1,%ebx
cmp    $0x64,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @main() {
br label %2
1: ; preds = %5
ret i32 0
2: ; preds = %0, %5
%3 = phi i32 [ 0, %0 ], [ %6, %5 ]
%4 = tail call i32 @assert(i32 1)
br label %8
5: ; preds = %8
%6 = add nuw nsw i32 %3, 1
%7 = icmp eq i32 %6, 100
br i1 %7, label %1, label %2
8: ; preds = %2, %8
%9 = phi i32 [ 0, %2 ], [ %11, %8 ]
%10 = tail call i32 @assert(i32 1)
%11 = add nuw nsw i32 %9, 1
%12 = icmp eq i32 %11, 1000
br i1 %12, label %5, label %8
}
void threadpool_wait(struct threadpool *self) {}


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

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

LLVM IR (-O0):
%struct.threadpool = type opaque
define void @threadpool_wait(%struct.threadpool* %0) {
%2 = alloca %struct.threadpool*
store %struct.threadpool* %0, %struct.threadpool** %2
ret void
}

LLVM IR (-O2):
%struct.threadpool = type opaque
define void @threadpool_wait(%struct.threadpool* nocapture %0) {
ret void
}
/* Variables and functions */
__attribute__((visibility("default"))) void *sd_bus_creds_unref(void *c) {
  return NULL;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @sd_bus_creds_unref(i8* nocapture readnone %0) {
ret i8* null
}
/* Type definitions */
struct task_struct {
  int dummy;
};

/* Variables and functions */
int task_nice(struct task_struct *);
int task_nice_ioprio(struct task_struct *task) {
  return (task_nice(task) + 20) / 5;
}


x86 assembly (clang, -O0):
<task_nice_ioprio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <task_nice@plt>
add    $0x14,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<task_nice_ioprio>:
push   %rax
call   1030 <task_nice@plt>
add    $0x14,%eax
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.task_struct = type { i32 }
define i32 @task_nice_ioprio(%struct.task_struct* %0) {
%2 = alloca %struct.task_struct*
store %struct.task_struct* %0, %struct.task_struct** %2
%3 = load %struct.task_struct*, %struct.task_struct** %2
%4 = call i32 @task_nice(%struct.task_struct* %3)
%5 = add nsw i32 %4, 20
%6 = sdiv i32 %5, 5
ret i32 %6
}

LLVM IR (-O2):
%struct.task_struct = type { i32 }
define i32 @task_nice_ioprio(%struct.task_struct* %0) {
%2 = tail call i32 @task_nice(%struct.task_struct* %0)
%3 = add nsw i32 %2, 20
%4 = sdiv i32 %3, 5
ret i32 %4
}
/* Variables and functions */
void *realloc(void *, size_t);
__attribute__((__always___)) void *chpl_realloc(void *ptr, size_t size) {
  return realloc(ptr, size);
}


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

x86 assembly (clang, -O2):
<chpl_realloc>:
jmp    1030 <realloc@plt>

LLVM IR (-O0):
define i8* @chpl_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i8* @realloc(i8* %5, i64 %6)
ret i8* %7
}

LLVM IR (-O2):
define noalias i8* @chpl_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
int read_data(unsigned char *buffer, int *position, unsigned char *output,
              int bytes) {
  memcpy(output, buffer + *position, bytes);
  *position += bytes;
}


x86 assembly (clang, -O0):
<read_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
movslq (%rax),%rax
add    %rax,%rsi
mov    -0x24(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x24(%rbp),%ecx
mov    -0x18(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_data>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rsi,%rbx
movslq (%rsi),%rsi
add    %rdi,%rsi
mov    %rdx,%rdi
mov    %ecx,%edx
call   1030 <memcpy@plt>
add    %ebp,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @read_data(i8* %0, i32* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %6
store i32* %1, i32** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%10 = load i8*, i8** %8
%11 = load i8*, i8** %6
%12 = load i32*, i32** %7
%13 = load i32, i32* %12
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %11, i64 %14
%16 = load i32, i32* %9
%17 = call i32 @memcpy(i8* %10, i8* %15, i32 %16)
%18 = load i32, i32* %9
%19 = load i32*, i32** %7
%20 = load i32, i32* %19
%21 = add nsw i32 %20, %18
store i32 %21, i32* %19
%22 = load i32, i32* %5
ret i32 %22
}

LLVM IR (-O2):
define i32 @read_data(i8* %0, i32* nocapture %1, i8* %2, i32 %3) {
%5 = load i32, i32* %1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = tail call i32 @memcpy(i8* %2, i8* %7, i32 %3)
%9 = load i32, i32* %1
%10 = add nsw i32 %9, %3
store i32 %10, i32* %1
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long, int);
scalar_t__ pthread_self();
int /*<<< orphan*/ sleep(int);
void *thread_func(void *arg) {
  printf("Thread id is %ld, working on task %d\n\n", (long)pthread_self(),
         *((int *)arg));
  sleep(1);
  return NULL;
}


x86 assembly (clang, -O0):
<thread_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %rax,%rsi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_func>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <pthread_self@plt>
mov    (%rbx),%edx
lea    0xebc(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"Thread id is %ld, working on task %d\0A\0A\00"
define i8* @thread_func(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i64 (...) @pthread_self()
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
%7 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i64 %3, i32 %6)
%8 = call i32 @sleep(i32 1)
ret i8* null
}

LLVM IR (-O2):
@.str = [39 x i8] c"Thread id is %ld, working on task %d\0A\0A\00"
define noalias i8* @thread_func(i8* nocapture %0) {
%2 = tail call i64 (...) @pthread_self()
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i64 %2, i32 %4)
%6 = tail call i32 @sleep(i32 1)
ret i8* null
}
char *mpgdecoder_version_06(void) {
  static char version[] = "0.06";
  return version;
}


x86 assembly (clang, -O0):
<mpgdecoder_version_06>:
push   %rbp
mov    %rsp,%rbp
lea    0x2f15(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpgdecoder_version_06>:
lea    0x2f19(%rip),%rax
ret

LLVM IR (-O0):
@mpgdecoder_version_06.version = internal global [5 x i8] c"0.06\00"
define i8* @mpgdecoder_version_06() {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @mpgdecoder_version_06.version, i64 0, i64 0)
}

LLVM IR (-O2):
@mpgdecoder_version_06.version = internal global [5 x i8] c"0.06\00"
define i8* @mpgdecoder_version_06() {
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @mpgdecoder_version_06.version, i64 0, i64 0)
}
int severalargs2(int x) { return x; }


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

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

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

LLVM IR (-O2):
define i32 @severalargs2(i32 returned %0) {
ret i32 %0
}
int double_cmp(const void *a, const void *b) {
  const double *da = (const double *)a;
  const double *db = (const double *)b;
  return (*da < *db) - (*da > *db);
}


x86 assembly (clang, -O0):
<double_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x18(%rbp),%rcx
movsd  (%rcx),%xmm0
mov    -0x20(%rbp),%rcx
ucomisd (%rcx),%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_cmp>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
xor    %ecx,%ecx
ucomisd %xmm1,%xmm0
seta   %cl
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @double_cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca double*
%6 = alloca double*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to double*
store double* %8, double** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to double*
store double* %10, double** %6
%11 = load double*, double** %5
%12 = load double, double* %11
%13 = load double*, double** %6
%14 = load double, double* %13
%15 = fcmp olt double %12, %14
%16 = zext i1 %15 to i32
%17 = load double*, double** %5
%18 = load double, double* %17
%19 = load double*, double** %6
%20 = load double, double* %19
%21 = fcmp ogt double %18, %20
%22 = zext i1 %21 to i32
%23 = sub nsw i32 %16, %22
ret i32 %23
}

LLVM IR (-O2):
define i32 @double_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = bitcast i8* %1 to double*
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp olt double %5, %6
%8 = zext i1 %7 to i32
%9 = fcmp ogt double %5, %6
%10 = sext i1 %9 to i32
%11 = add nsw i32 %10, %8
ret i32 %11
}
/* Variables and functions */
scalar_t__ shim_enosys(int /*<<< orphan*/, int, void *, unsigned long);
int shim_modify_ldt(int func, void *ptr, unsigned long bytecount) {
  return (int)shim_enosys(0, func, ptr, bytecount);
}


x86 assembly (clang, -O0):
<shim_modify_ldt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
xor    %edi,%edi
call   1030 <shim_enosys@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shim_modify_ldt>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <shim_enosys@plt>

LLVM IR (-O0):
define i32 @shim_modify_ldt(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i64 @shim_enosys(i32 0, i32 %7, i8* %8, i64 %9)
%11 = trunc i64 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @shim_modify_ldt(i32 %0, i8* %1, i64 %2) {
%4 = tail call i64 @shim_enosys(i32 0, i32 %0, i8* %1, i64 %2)
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Variables and functions */
scalar_t__ isspace(char const);
void _skip_whitespaces(const char **str) {
  while (isspace(**str)) {
    (*str)++;
  }
}


x86 assembly (clang, -O0):
<_skip_whitespaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1148 <_skip_whitespaces+0x38>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    111c <_skip_whitespaces+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_skip_whitespaces>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rax
movsbl (%rax),%edi
nopw   0x0(%rax,%rax,1)
call   1030 <isspace@plt>
test   %rax,%rax
je     113a <_skip_whitespaces+0x2a>
mov    (%rbx),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rbx)
movsbl 0x1(%rax),%edi
jmp    1120 <_skip_whitespaces+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @_skip_whitespaces(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
br label %3
3: ; preds = %9, %1
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
%6 = load i8, i8* %5
%7 = call i64 @isspace(i8 signext %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i8**, i8*** %2
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %10
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @_skip_whitespaces(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = tail call i64 @isspace(i8 signext %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %1, %6
%7 = load i8*, i8** %0
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8* %8, i8** %0
%9 = load i8, i8* %8
%10 = tail call i64 @isspace(i8 signext %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %6
12: ; preds = %6, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ WAIT_ANY;
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ waitpid(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/);
void handle_child(int signum) { waitpid(WAIT_ANY, NULL, WNOHANG); }


x86 assembly (clang, -O0):
<handle_child>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
mov    0x2ebd(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1030 <waitpid@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_child>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
mov    0x2ec8(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
jmp    1030 <waitpid@plt>

LLVM IR (-O0):
@WAIT_ANY = global i32 0
@WNOHANG = global i32 0
define void @handle_child(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @WAIT_ANY
%4 = load i32, i32* @WNOHANG
%5 = call i32 @waitpid(i32 %3, i32* null, i32 %4)
ret void
}

LLVM IR (-O2):
@WAIT_ANY = global i32 0
@WNOHANG = global i32 0
define void @handle_child(i32 %0) {
%2 = load i32, i32* @WAIT_ANY
%3 = load i32, i32* @WNOHANG
%4 = tail call i32 @waitpid(i32 %2, i32* null, i32 %3)
ret void
}
void remove_content_newlines(char *content) {
  char *i = content;
  char *j = content;
  while (*j != '\0') {
    *i = *j++;
    if (*i != '\n')
      i++;
  }
  *i = '\0';
}


x86 assembly (clang, -O0):
<remove_content_newlines>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1160 <remove_content_newlines+0x60>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     115b <remove_content_newlines+0x5b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1118 <remove_content_newlines+0x18>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_content_newlines>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <remove_content_newlines+0x28>
lea    0x1(%rdi),%rax
nopw   0x0(%rax,%rax,1)
mov    %cl,(%rdi)
xor    %edx,%edx
cmp    $0xa,%cl
setne  %dl
add    %rdx,%rdi
movzbl (%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <remove_content_newlines+0x10>
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @remove_content_newlines(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
store i8 %5, i8* %7
%9 = icmp ne i8 %5, 10
%10 = zext i1 %9 to i64
%11 = getelementptr i8, i8* %7, i64 %10
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i8* [ %0, %1 ], [ %11, %4 ]
store i8 0, i8* %15
ret void
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
void end_curses() { endwin(); }


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

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

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

LLVM IR (-O2):
define void @end_curses() {
%1 = tail call i32 (...) @endwin()
ret void
}
void av_mastering_display_metadata_alloc() {}


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

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

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

LLVM IR (-O2):
define void @av_mastering_display_metadata_alloc() {
ret void
}
void __arch_atomic_dec(long int *p) { (*p)--; }


x86 assembly (clang, -O0):
<__arch_atomic_dec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__arch_atomic_dec>:
addq   $0xffffffffffffffff,(%rdi)
ret

LLVM IR (-O0):
define void @__arch_atomic_dec(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = add nsw i64 %4, -1
store i64 %5, i64* %3
ret void
}

LLVM IR (-O2):
define void @__arch_atomic_dec(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = add nsw i64 %2, -1
store i64 %3, i64* %0
ret void
}
/* Variables and functions */
unsigned short NumberOnly();
int /*<<< orphan*/ WriteInstruction(char *);
int /*<<< orphan*/ WriteNumber(unsigned short);
void CR_FillRight(void) {
  unsigned short int nNum = NumberOnly();
  WriteInstruction("ld b,");
  WriteNumber(nNum);
  WriteInstruction("call fillr");
}


x86 assembly (clang, -O0):
<CR_FillRight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <NumberOnly@plt>
mov    %ax,-0x2(%rbp)
lea    0xeb6(%rip),%rdi
call   1040 <WriteInstruction@plt>
movzwl -0x2(%rbp),%edi
call   1030 <WriteNumber@plt>
lea    0xea7(%rip),%rdi
call   1040 <WriteInstruction@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CR_FillRight>:
push   %rbx
xor    %eax,%eax
call   1050 <NumberOnly@plt>
mov    %eax,%ebx
lea    0xebf(%rip),%rdi
call   1040 <WriteInstruction@plt>
movzwl %bx,%edi
call   1030 <WriteNumber@plt>
lea    0xeb1(%rip),%rdi
pop    %rbx
jmp    1040 <WriteInstruction@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"ld b,\00"
@.str.1 = [11 x i8] c"call fillr\00"
define void @CR_FillRight() {
%1 = alloca i16
%2 = call zeroext i16 (...) @NumberOnly()
store i16 %2, i16* %1
%3 = call i32 @WriteInstruction(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = load i16, i16* %1
%5 = call i32 @WriteNumber(i16 zeroext %4)
%6 = call i32 @WriteInstruction(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"ld b,\00"
@.str.1 = [11 x i8] c"call fillr\00"
define void @CR_FillRight() {
%1 = tail call zeroext i16 (...) @NumberOnly()
%2 = tail call i32 @WriteInstruction(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @WriteNumber(i16 zeroext %1)
%4 = tail call i32 @WriteInstruction(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int ex(int a) { return a * a; }


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

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

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

LLVM IR (-O2):
define i32 @ex(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}
/* Type definitions */
struct timeval {
  double tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double timer_cpu_seconds(void) {
  struct timeval tv;
  double wtime;
  gettimeofday(&tv, NULL);
  wtime = tv.tv_sec;
  wtime += (double)tv.tv_usec * 1.0e-6;
  return wtime;
}


x86 assembly (clang, -O0):
<timer_cpu_seconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdq -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xebe(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_cpu_seconds>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x10(%rsp),%xmm0
mulsd  0xed1(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { double, i64 }
define double @timer_cpu_seconds() {
%1 = alloca %struct.timeval
%2 = alloca double
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%5 = load double, double* %4
store double %5, double* %2
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = load double, double* %2
%10 = call double @llvm.fmuladd.f64(double %8, double 0x3EB0C6F7A0B5ED8D, double %9)
store double %10, double* %2
%11 = load double, double* %2
ret double %11
}

LLVM IR (-O2):
%struct.timeval = type { double, i64 }
define double @timer_cpu_seconds() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = tail call double @llvm.fmuladd.f64(double %8, double 0x3EB0C6F7A0B5ED8D, double %5)
ret double %9
}
int abs(int x) {
  if (x > 0)
    return x;
  else if (x == 0)
    return 0;
  else
    return -x;
}


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    111c <abs+0x1c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113a <abs+0x3a>
cmpl   $0x0,-0x8(%rbp)
jne    1132 <abs+0x32>
movl   $0x0,-0x4(%rbp)
jmp    113a <abs+0x3a>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ locale_t;

/* Variables and functions */
locale_t newlocale(int category_mask, const char *locale, locale_t base) {
  ;
  return 0;
}


x86 assembly (clang, -O0):
<newlocale>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @newlocale(i32 %0, i8* nocapture readnone %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void usage(int status) { abort(); }


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define void @usage(i32 %0) {
%2 = tail call i32 (...) @abort()
unreachable
}
int XUngrabKeyboard() { return 0; }


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

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

LLVM IR (-O0):
define i32 @XUngrabKeyboard() {
ret i32 0
}

LLVM IR (-O2):
define i32 @XUngrabKeyboard() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ display(char *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void error(int a) {
  display("ERROR", a);
  printf("\n-------------------------------------------------------------------"
         "-------------------------------\n");
  exit(1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xebb(%rip),%rdi
call   1030 <display@plt>
lea    0xeb5(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
mov    %edi,%esi
lea    0xec6(%rip),%rdi
call   1040 <display@plt>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"ERROR\00"
@str = [100 x i8] c"\0A--------------------------------------------------------------------------------------------------\00"
define void @error(i32 %0) {
%2 = tail call i32 @display(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int, float, float);
main() {
  int a, b, c, d;
  float suma, media;
  a = 12000, b = 32422, c = 123000, d = -1212;
  suma = a + b + c + d;
  media = suma / 4;
  printf("a = %d\tb = %d\tc = %d\td = %d\nsuma = %g\nmedia = %g\n", a, b, c, d,
         suma, media);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x2ee0,-0x4(%rbp)
movl   $0x7ea6,-0x8(%rbp)
movl   $0x1e078,-0xc(%rbp)
movl   $0xfffffb44,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  0xeaa(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movss  0xee0(%rip),%xmm0
movss  0xedc(%rip),%xmm1
mov    $0x2ee0,%esi
mov    $0x7ea6,%edx
mov    $0x1e078,%ecx
mov    $0xfffffb44,%r8d
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [50 x i8] c"a = %d\09b = %d\09c = %d\09d = %d\0Asuma = %g\0Amedia = %g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
%6 = alloca float
store i32 12000, i32* %1
store i32 32422, i32* %2
store i32 123000, i32* %3
store i32 -1212, i32* %4
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = add nsw i32 %7, %8
%10 = load i32, i32* %3
%11 = add nsw i32 %9, %10
%12 = load i32, i32* %4
%13 = add nsw i32 %11, %12
%14 = sitofp i32 %13 to float
store float %14, float* %5
%15 = load float, float* %5
%16 = fdiv float %15, 4.000000e+00
store float %16, float* %6
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = load float, float* %5
%22 = load float, float* %6
%23 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18, i32 %19, i32 %20, float %21, float %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [50 x i8] c"a = %d\09b = %d\09c = %d\09d = %d\0Asuma = %g\0Amedia = %g\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 12000, i32 32422, i32 123000, i32 -1212, float 1.662100e+05, float 4.155250e+04)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ open(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int main(int argc, const char **argv) {
  while (*++argv != NULL)
    open(*argv, O_RDWR);
  while (true)
    sleep(60000);
}


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    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
cmpq   $0x0,0x8(%rax)
je     116a <main+0x4a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    0x2e8a(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
jmp    1136 <main+0x16>
jmp    116f <main+0x4f>
mov    $0xea60,%edi
call   1040 <sleep@plt>
jmp    116f <main+0x4f>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     1160 <main+0x40>
mov    %rsi,%rbx
add    $0x10,%rbx
mov    0x2ead(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r14),%esi
call   1030 <open@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1140 <main+0x20>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xea60,%edi
call   1040 <sleep@plt>
jmp    1160 <main+0x40>

LLVM IR (-O0):
@O_RDWR = global i32 0
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
br label %6
6: ; preds = %11, %2
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i32 1
store i8** %8, i8*** %5
%9 = load i8*, i8** %8
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %16
11: ; preds = %6
%12 = load i8**, i8*** %5
%13 = load i8*, i8** %12
%14 = load i32, i32* @O_RDWR
%15 = call i32 @open(i8* %13, i32 %14)
br label %6
16: ; preds = %6
br label %17
17: ; preds = %16, %17
%18 = call i32 @sleep(i32 60000)
br label %17
}

LLVM IR (-O2):
@O_RDWR = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %14, label %6
6: ; preds = %2, %6
%7 = phi i8* [ %12, %6 ], [ %4, %2 ]
%8 = phi i8** [ %11, %6 ], [ %3, %2 ]
%9 = load i32, i32* @O_RDWR
%10 = tail call i32 @open(i8* %7, i32 %9)
%11 = getelementptr inbounds i8*, i8** %8, i64 1
%12 = load i8*, i8** %11
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %6
14: ; preds = %6, %2
br label %15
15: ; preds = %14, %15
%16 = tail call i32 @sleep(i32 60000)
br label %15
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int open(char const *, int, int /*<<< orphan*/);
int /*<<< orphan*/ unix_error(char *);
int Open(const char *pathname, int flags, mode_t mode) {
  int rc;
  if ((rc = open(pathname, flags, mode)) < 0)
    unix_error("Open error");
  return rc;
}


x86 assembly (clang, -O0):
<Open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1159 <Open+0x39>
lea    0xeac(%rip),%rdi
call   1030 <unix_error@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Open>:
push   %rbx
call   1040 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1138 <Open+0x18>
lea    0xecd(%rip),%rdi
call   1030 <unix_error@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"Open error\00"
define i32 @Open(i8* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 @open(i8* %0, i32 %1, i32 %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @unix_error(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret i32 %4
}
unsigned long insert_ral(insn, value, errmsg)
unsigned long insn;
long value;
const char **errmsg;
{
  if (value == 0 || value == ((insn >> 21) & 0x1f))
    *errmsg = "invalid register operand when updating";
  return insn | ((value & 0x1f) << 16);
}


x86 assembly (clang, -O0):
<insert_ral>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1134 <insert_ral+0x34>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x15,%rcx
and    $0x1f,%rcx
cmp    %rcx,%rax
jne    1142 <insert_ral+0x42>
mov    -0x18(%rbp),%rax
lea    0xec1(%rip),%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
and    $0x1f,%rcx
shl    $0x10,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_ral>:
mov    %rsi,%rax
test   %rsi,%rsi
je     1115 <insert_ral+0x15>
mov    %edi,%ecx
shr    $0x15,%ecx
and    $0x1f,%ecx
cmp    %rax,%rcx
jne    111f <insert_ral+0x1f>
lea    0xee4(%rip),%rcx
mov    %rcx,(%rdx)
and    $0x1f,%eax
shl    $0x10,%rax
or     %rdi,%rax
ret

LLVM IR (-O0):
@.str = [39 x i8] c"invalid register operand when updating\00"
define i64 @insert_ral(i64 %0, i64 %1, i8** %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8**
store i64 %0, i64* %4
store i64 %1, i64* %5
store i8** %2, i8*** %6
%7 = load i64, i64* %5
%8 = icmp eq i64 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %3
%10 = load i64, i64* %5
%11 = load i64, i64* %4
%12 = lshr i64 %11, 21
%13 = and i64 %12, 31
%14 = icmp eq i64 %10, %13
br i1 %14, label %15, label %17
15: ; preds = %9, %3
%16 = load i8**, i8*** %6
store i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8** %16
br label %17
17: ; preds = %15, %9
%18 = load i64, i64* %4
%19 = load i64, i64* %5
%20 = and i64 %19, 31
%21 = shl i64 %20, 16
%22 = or i64 %18, %21
ret i64 %22
}

LLVM IR (-O2):
@.str = [39 x i8] c"invalid register operand when updating\00"
define i64 @insert_ral(i64 %0, i64 %1, i8** nocapture writeonly %2) {
%4 = icmp eq i64 %1, 0
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = lshr i64 %0, 21
%7 = and i64 %6, 31
%8 = icmp eq i64 %7, %1
br i1 %8, label %9, label %10
9: ; preds = %5, %3
store i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8** %2
br label %10
10: ; preds = %9, %5
%11 = shl i64 %1, 16
%12 = and i64 %11, 2031616
%13 = or i64 %12, %0
ret i64 %13
}
/* Variables and functions */
int sched_yield();
int main(void) { return sched_yield(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @sched_yield()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void _bye() { exit(0); }


x86 assembly (clang, -O0):
<_bye>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <exit@plt>

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

LLVM IR (-O0):
define void @_bye() {
%1 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @_bye() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int EOF;
int getchar();
void clear_buffer() {
  int c = 0;
  while (c != '\n' && c != EOF) {
    c = getchar();
  }
}


x86 assembly (clang, -O0):
<clear_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0xa,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1140 <clear_buffer+0x30>
mov    -0x4(%rbp),%eax
mov    0x2eb0(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    1150 <clear_buffer+0x40>
jmp    115f <clear_buffer+0x4f>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x4(%rbp)
jmp    111f <clear_buffer+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_buffer>:
push   %rbx
mov    0x2ed0(%rip),%rbx
cmpl   $0x0,(%rbx)
je     1130 <clear_buffer+0x20>
nopl   (%rax)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%eax
je     1130 <clear_buffer+0x20>
cmp    (%rbx),%eax
jne    1120 <clear_buffer+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
define void @clear_buffer() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %11, %0
%3 = load i32, i32* %1
%4 = icmp ne i32 %3, 10
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* %1
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br label %9
9: ; preds = %5, %2
%10 = phi i1 [ false, %2 ], [ %8, %5 ]
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = call i32 (...) @getchar()
store i32 %12, i32* %1
br label %2
13: ; preds = %9
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @clear_buffer() {
%1 = load i32, i32* @EOF
%2 = icmp eq i32 %1, 0
br i1 %2, label %9, label %3
3: ; preds = %0, %3
%4 = tail call i32 (...) @getchar()
%5 = icmp ne i32 %4, 10
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %4, %6
%8 = select i1 %5, i1 %7, i1 false
br i1 %8, label %3, label %9
9: ; preds = %3, %0
ret void
}
/* Variables and functions */
int length_char(char *);
int /*<<< orphan*/ strcat(char *, char *);
void check_path(char *path) {
  int len;
  len = length_char(path);
  strcat(path, "/");
  strcat(path, "\0");
}


x86 assembly (clang, -O0):
<check_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <length_char@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1040 <strcat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_path>:
push   %rbx
mov    %rdi,%rbx
call   1030 <length_char@plt>
lea    0xed0(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
lea    0xec3(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <strcat@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
@.str.1 = [2 x i8] zeroinitializer
define void @check_path(i8* %0) {
%2 = tail call i32 @length_char(i8* %0)
%3 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int getopt_long_only(nargc, nargv, options, long_options, idx)
int nargc;
char *const *nargv;
const char *options;
const struct option *long_options;
int *idx;
{
  return (
      getopt_internal(nargc, nargv, options, long_options, idx, 0x01 | 0x04));
}


x86 assembly (clang, -O0):
<getopt_long_only>:
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),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    $0x5,%r9d
mov    $0x0,%al
call   1030 <getopt_internal@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getopt_long_only>:
mov    $0x5,%r9d
xor    %eax,%eax
jmp    1030 <getopt_internal@plt>

LLVM IR (-O0):
%struct.option = type opaque
define i32 @getopt_long_only(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca %struct.option*
%10 = alloca i32*
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store %struct.option* %3, %struct.option** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = load i8**, i8*** %7
%13 = load i8*, i8** %8
%14 = load %struct.option*, %struct.option** %9
%15 = load i32*, i32** %10
%16 = call i32 (i32, i8**, i8*, %struct.option*, i32*, i32, ...) bitcast (i32 (...)* @getopt_internal to i32 (i32, i8**, i8*, %struct.option*, i32*, i32, ...)*)(i32 %11, i8** %12, i8* %13, %struct.option* %14, i32* %15, i32 5)
ret i32 %16
}

LLVM IR (-O2):
%struct.option = type opaque
define i32 @getopt_long_only(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = tail call i32 (i32, i8**, i8*, %struct.option*, i32*, i32, ...) bitcast (i32 (...)* @getopt_internal to i32 (i32, i8**, i8*, %struct.option*, i32*, i32, ...)*)(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4, i32 5)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_iochannel_set_callback() {
  printf("NOT IMPLEMENTED:"
         "pa_iochannel_set_callback"
         "\n");
}


x86 assembly (clang, -O0):
<pa_iochannel_set_callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [43 x i8] c"NOT IMPLEMENTED:pa_iochannel_set_callback\0A\00"
define i32 @pa_iochannel_set_callback() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [42 x i8] c"NOT IMPLEMENTED:pa_iochannel_set_callback\00"
define i32 @pa_iochannel_set_callback() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
ret i32 undef
}