xunge/DecIR huggingface dataset:
double ldexp(double x, int expo) {
  puts("# ");
  puts(__FUNCTION__);
  puts("()\n");
  delay(100000000);
  (void)(x);
  (void)(expo);
  return 0;
}


x86 assembly (clang, -O0):
<ldexp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
mov    $0x5f5e100,%edi
mov    $0x0,%al
call   1040 <delay@plt>
xorps  %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldexp>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
mov    $0x5f5e100,%edi
xor    %eax,%eax
call   1040 <delay@plt>
xorps  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"# \00"
@__FUNCTION__.ldexp = [6 x i8] c"ldexp\00"
@.str.1 = [4 x i8] c"()\0A\00"
define double @ldexp(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__FUNCTION__.ldexp, i64 0, i64 0))
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i32, ...) bitcast (i32 (...)* @delay to i32 (i32, ...)*)(i32 100000000)
%9 = load double, double* %3
%10 = load i32, i32* %4
ret double 0.000000e+00
}

LLVM IR (-O2):
@.str = [3 x i8] c"# \00"
@__FUNCTION__.ldexp = [6 x i8] c"ldexp\00"
@.str.1 = [4 x i8] c"()\0A\00"
define double @ldexp(double %0, i32 %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__FUNCTION__.ldexp, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @delay to i32 (i32, ...)*)(i32 100000000)
ret double 0.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ memorystream_close(void *);
void memorystream_destroy(void *obj) {
  memorystream_close(obj);
  free(obj);
}


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

x86 assembly (clang, -O2):
<memorystream_destroy>:
push   %rbx
mov    %rdi,%rbx
call   1040 <memorystream_close@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @memorystream_destroy(i8* %0) {
%2 = tail call i32 @memorystream_close(i8* %0)
%3 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getch();
int /*<<< orphan*/ imprimeVet(int, int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ selectionSort(int, int *);
int main() {
  int vet[6] = {20, 80, 70, 21, 31, 33};
  imprimeVet(6, vet);
  printf("\n");
  selectionSort(6, vet);
  printf("\n");
  imprimeVet(6, vet);
  getch();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rsi
mov    $0x6,%edi
call   1030 <imprimeVet@plt>
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
mov    $0x6,%edi
call   1050 <selectionSort@plt>
lea    0xe79(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rsi
mov    $0x6,%edi
call   1030 <imprimeVet@plt>
mov    $0x0,%al
call   1060 <getch@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    0xec4(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xea8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    $0x6,%edi
mov    %rbx,%rsi
call   1040 <imprimeVet@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x6,%edi
mov    %rbx,%rsi
call   1050 <selectionSort@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x6,%edi
mov    %rbx,%rsi
call   1040 <imprimeVet@plt>
xor    %eax,%eax
call   1060 <getch@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.vet = [6 x i32] [i32 20, i32 80, i32 70, i32 21, i32 31, i32 33]
@.str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
store i32 0, i32* %1
%3 = bitcast [6 x i32]* %2 to i8*
%4 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%5 = call i32 @imprimeVet(i32 6, i32* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%8 = call i32 @selectionSort(i32 6, i32* %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%11 = call i32 @imprimeVet(i32 6, i32* %10)
%12 = call i32 (...) @getch()
ret i32 0
}

LLVM IR (-O2):
@__const.main.vet = [6 x i32] [i32 20, i32 80, i32 70, i32 21, i32 31, i32 33]
define i32 @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%4 = call i32 @imprimeVet(i32 6, i32* %3)
%5 = call i32 @putchar(i32 10)
%6 = call i32 @selectionSort(i32 6, i32* %3)
%7 = call i32 @putchar(i32 10)
%8 = call i32 @imprimeVet(i32 6, i32* %3)
%9 = call i32 (...) @getch()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int test(int, int);
int main(void) {
  int myval = 15;
  printf("Result is %d \n", test(myval, (myval > 8)));
  int myval2 = 20;
  printf("Result is %d \n", test(myval2, (myval2 == 30)));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xf,-0x8(%rbp)
mov    -0x8(%rbp),%edi
cmpl   $0x8,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%esi
call   1040 <test@plt>
mov    %eax,%esi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
movl   $0x14,-0xc(%rbp)
mov    -0xc(%rbp),%edi
cmpl   $0x1e,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%esi
call   1040 <test@plt>
mov    %eax,%esi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xf,%edi
mov    $0x1,%esi
call   1040 <test@plt>
lea    0xec9(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x14,%edi
xor    %esi,%esi
call   1040 <test@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Result is %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 15, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 8
%7 = zext i1 %6 to i32
%8 = call i32 @test(i32 %4, i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %8)
store i32 20, i32* %3
%10 = load i32, i32* %3
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 30
%13 = zext i1 %12 to i32
%14 = call i32 @test(i32 %10, i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Result is %d \0A\00"
define i32 @main() {
%1 = tail call i32 @test(i32 15, i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @test(i32 20, i32 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int bsdsock_write(int, char *, void *);
int bsdsock_putch(int ch, void *data) {
  char ch_ = ch;
  return bsdsock_write(1, &ch_, data);
}


x86 assembly (clang, -O0):
<bsdsock_putch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rdx
mov    $0x1,%edi
lea    -0x11(%rbp),%rsi
call   1030 <bsdsock_write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bsdsock_putch>:
push   %rax
mov    %rsi,%rdx
mov    %dil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edi
call   1030 <bsdsock_write@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @bsdsock_putch(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
%7 = trunc i32 %6 to i8
store i8 %7, i8* %5
%8 = load i8*, i8** %4
%9 = call i32 @bsdsock_write(i32 1, i8* %5, i8* %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @bsdsock_putch(i32 %0, i8* %1) {
%3 = alloca i8
%4 = trunc i32 %0 to i8
store i8 %4, i8* %3
%5 = call i32 @bsdsock_write(i32 1, i8* %3, i8* %1)
ret i32 %5
}
int stringcmp(char *str1, char *str2) {
  int status = 0, i;
  char c;
  for (i = 0; (c = *(str2 + i)) != '\0'; i++) {
    if (*(str1 + i) != c) {
      status = -1;
      break;
    }
  }
  return status;
}


x86 assembly (clang, -O0):
<stringcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x19(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     116b <stringcmp+0x6b>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x19(%rbp),%ecx
cmp    %ecx,%eax
je     1158 <stringcmp+0x58>
movl   $0xffffffff,-0x14(%rbp)
jmp    116b <stringcmp+0x6b>
jmp    115d <stringcmp+0x5d>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    111a <stringcmp+0x1a>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringcmp>:
mov    (%rsi),%al
test   %al,%al
je     1122 <stringcmp+0x22>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmp    %al,(%rdi,%rcx,1)
jne    1125 <stringcmp+0x25>
movzbl 0x1(%rsi,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1110 <stringcmp+0x10>
xor    %eax,%eax
ret
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @stringcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %9
5: ; preds = %9
%6 = getelementptr inbounds i8, i8* %1, i64 %15
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %2, %5
%10 = phi i64 [ %15, %5 ], [ 0, %2 ]
%11 = phi i8 [ %7, %5 ], [ %3, %2 ]
%12 = getelementptr inbounds i8, i8* %0, i64 %10
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, %11
%15 = add nuw i64 %10, 1
br i1 %14, label %5, label %16
16: ; preds = %5, %9, %2
%17 = phi i32 [ 0, %2 ], [ -1, %9 ], [ 0, %5 ]
ret i32 %17
}
/* Variables and functions */
int fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int b_green() { return fputs("[42m", stdout); }


x86 assembly (clang, -O0):
<b_green>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_green>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"\1B[42m\00"
@stdout = global i32 0
define i32 @b_green() {
%1 = load i32, i32* @stdout
%2 = call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[42m\00"
@stdout = global i32 0
define i32 @b_green() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %2
}
/* Type definitions */
struct sqlConnection {
  int dummy;
};

/* Variables and functions */
char *stringFieldInSubmissionSource(struct sqlConnection *, int, char *);
char *visiGeneSubmissionSource(struct sqlConnection *conn, int id) {
  return stringFieldInSubmissionSource(conn, id, "name");
}


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

x86 assembly (clang, -O2):
<visiGeneSubmissionSource>:
lea    0xee9(%rip),%rdx
jmp    1030 <stringFieldInSubmissionSource@plt>

LLVM IR (-O0):
%struct.sqlConnection = type { i32 }
@.str = [5 x i8] c"name\00"
define i8* @visiGeneSubmissionSource(%struct.sqlConnection* %0, i32 %1) {
%3 = alloca %struct.sqlConnection*
%4 = alloca i32
store %struct.sqlConnection* %0, %struct.sqlConnection** %3
store i32 %1, i32* %4
%5 = load %struct.sqlConnection*, %struct.sqlConnection** %3
%6 = load i32, i32* %4
%7 = call i8* @stringFieldInSubmissionSource(%struct.sqlConnection* %5, i32 %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %7
}

LLVM IR (-O2):
%struct.sqlConnection = type { i32 }
@.str = [5 x i8] c"name\00"
define i8* @visiGeneSubmissionSource(%struct.sqlConnection* %0, i32 %1) {
%3 = tail call i8* @stringFieldInSubmissionSource(%struct.sqlConnection* %0, i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %3
}
void ff_hevc_put_hevc_bi_qpel_h8_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_qpel_h8_12_sse4() {
ret void
}
void call3a(char *cp, short *sp, int *ip, long *lp) {
  cp = 0;
  sp = 0;
  ip = 0;
  lp = 0;
}


x86 assembly (clang, -O0):
<call3a>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @call3a(i8* %0, i16* %1, i32* %2, i64* %3) {
%5 = alloca i8*
%6 = alloca i16*
%7 = alloca i32*
%8 = alloca i64*
store i8* %0, i8** %5
store i16* %1, i16** %6
store i32* %2, i32** %7
store i64* %3, i64** %8
store i8* null, i8** %5
store i16* null, i16** %6
store i32* null, i32** %7
store i64* null, i64** %8
ret void
}

LLVM IR (-O2):
define void @call3a(i8* nocapture %0, i16* nocapture %1, i32* nocapture %2, i64* nocapture %3) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ key_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int semget(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int sem_connect(key_t key) {
  int sem_anfordid;
  if ((sem_anfordid = semget(key, 0, 0)) == -1) {
    fprintf(stderr,
            "Error: semaphore (Anforderungen) konnte nicht angelegt werden\n");
    exit(-1);
  }
  return (sem_anfordid);
}


x86 assembly (clang, -O0):
<sem_connect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <semget@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
jne    1172 <sem_connect+0x42>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sem_connect>:
push   %rax
xor    %esi,%esi
xor    %edx,%edx
call   1030 <semget@plt>
cmp    $0xffffffff,%eax
je     1141 <sem_connect+0x11>
pop    %rcx
ret
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
lea    0xeaf(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [63 x i8] c"Error: semaphore (Anforderungen) konnte nicht angelegt werden\0A\00"
define i32 @sem_connect(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @semget(i32 %4, i32 0, i32 0)
store i32 %5, i32* %3
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %1
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [63 x i8] c"Error: semaphore (Anforderungen) konnte nicht angelegt werden\0A\00"
define i32 @sem_connect(i32 %0) {
%2 = tail call i32 @semget(i32 %0, i32 0, i32 0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %1
ret i32 %2
}
int ft_strlen(const char *str) {
  int i;
  i = 0;
  while (*str++) {
    i++;
  }
  return (i);
}


x86 assembly (clang, -O0):
<ft_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1135 <ft_strlen+0x35>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <ft_strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strlen>:
cmpb   $0x0,(%rdi)
je     111c <ft_strlen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <ft_strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ gettid();
int kill(int /*<<< orphan*/, int);
int raise(int signum) { return kill(gettid(), signum); }


x86 assembly (clang, -O0):
<raise>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <gettid@plt>
mov    %eax,%edi
mov    -0x4(%rbp),%esi
call   1040 <kill@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<raise>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <gettid@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <kill@plt>

LLVM IR (-O0):
define i32 @raise(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @gettid()
%4 = load i32, i32* %2
%5 = call i32 @kill(i32 %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @raise(i32 %0) {
%2 = tail call i32 (...) @gettid()
%3 = tail call i32 @kill(i32 %2, i32 %0)
ret i32 %3
}
ServerData(buf, n) int n;
char *buf;
{
  int i;
  for (i = 0; i < n; i++)
    ServerByte(buf[i]);
}


x86 assembly (clang, -O0):
<ServerData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1153 <ServerData+0x43>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
mov    $0x0,%al
call   1030 <ServerByte@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1126 <ServerData+0x16>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ServerData>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1145 <ServerData+0x35>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
xor    %eax,%eax
call   1030 <ServerByte@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <ServerData+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @ServerData(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = tail call i32 (i32, ...) bitcast (i32 (...)* @ServerByte to i32 (i32, ...)*)(i32 %10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void bar(int x) {
  if (!x)
    abort();
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    112c <bar+0x1c>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
test   %edi,%edi
je     1115 <bar+0x5>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define void @bar(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ i2c_write(int /*<<< orphan*/, int /*<<< orphan*/, int,
                             int /*<<< orphan*/ *, int);
void i2c_reg_write(uint8_t addr, uint8_t reg, uint8_t val) {
  i2c_write(addr, reg, 1, &val, 1);
}


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

x86 assembly (clang, -O2):
<i2c_reg_write>:
push   %rax
mov    %edx,0x4(%rsp)
lea    0x4(%rsp),%rcx
mov    $0x1,%edx
mov    $0x1,%r8d
call   1030 <i2c_write@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @i2c_reg_write(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = call i32 @i2c_write(i32 %7, i32 %8, i32 1, i32* %6, i32 1)
ret void
}

LLVM IR (-O2):
define void @i2c_reg_write(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
store i32 %2, i32* %4
%5 = call i32 @i2c_write(i32 %0, i32 %1, i32 1, i32* %4, i32 1)
ret void
}
void __attribute__((__warning__(
    "curl_easy_setopt expects a curl_seek_callback argument for this option")))
__attribute__((__unused__)) __attribute__((__no__))
_curl_easy_setopt_err_seek_cb(void) {
  __asm__("");
}


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

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

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

LLVM IR (-O2):
define void @_curl_easy_setopt_err_seek_cb() {
tail call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
struct timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
void setup_timeout(struct timeval *timeout) {
  timeout->tv_sec = 20;
  timeout->tv_usec = 0;
}


x86 assembly (clang, -O0):
<setup_timeout>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x14,(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_timeout>:
movl   $0x14,(%rdi)
movq   $0x0,0x8(%rdi)
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define void @setup_timeout(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %2
%3 = load %struct.timeval*, %struct.timeval** %2
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
store i32 20, i32* %4
%5 = load %struct.timeval*, %struct.timeval** %2
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
store i64 0, i64* %6
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define void @setup_timeout(%struct.timeval* nocapture writeonly %0) {
%2 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
store i32 20, i32* %2
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
store i64 0, i64* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __builtin_ldwio(void *);
void udelay() {
  __builtin_ldwio(((void *)(((unsigned char *)(0x018810a0)) + (((0)) * (4)))));
  __builtin_ldwio(((void *)(((unsigned char *)(0x018810a0)) + (((0)) * (4)))));
}


x86 assembly (clang, -O0):
<udelay>:
push   %rbp
mov    %rsp,%rbp
mov    $0x18810a0,%edi
call   1030 <__builtin_ldwio@plt>
mov    $0x18810a0,%edi
call   1030 <__builtin_ldwio@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<udelay>:
push   %rax
mov    $0x18810a0,%edi
call   1030 <__builtin_ldwio@plt>
mov    $0x18810a0,%edi
pop    %rax
jmp    1030 <__builtin_ldwio@plt>

LLVM IR (-O0):
define void @udelay() {
%1 = call i32 @__builtin_ldwio(i8* inttoptr (i64 25694368 to i8*))
%2 = call i32 @__builtin_ldwio(i8* inttoptr (i64 25694368 to i8*))
ret void
}

LLVM IR (-O2):
define void @udelay() {
%1 = tail call i32 @__builtin_ldwio(i8* inttoptr (i64 25694368 to i8*))
%2 = tail call i32 @__builtin_ldwio(i8* inttoptr (i64 25694368 to i8*))
ret void
}
int numslav(int *slave) {
  int i;
  int n = 0;
  for (i = 0; i < 10; i++) {
    n += *(slave + i);
  }
  return n;
}


x86 assembly (clang, -O0):
<numslav>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    113f <numslav+0x3f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <numslav+0x16>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<numslav>:
movdqu 0x8(%rdi),%xmm0
movdqu 0x18(%rdi),%xmm1
paddd  %xmm0,%xmm1
pshufd $0xee,%xmm1,%xmm0
paddd  %xmm1,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%eax
add    0x4(%rdi),%eax
add    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @numslav(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = getelementptr inbounds i32, i32* %0, i64 2
%6 = bitcast i32* %5 to <8 x i32>*
%7 = load <8 x i32>, <8 x i32>* %6
%8 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %7)
%9 = add nsw i32 %8, %4
%10 = add nsw i32 %9, %2
ret i32 %10
}
/* Variables and functions */
int irc_printf(int, char *, char const *);
int irc_nick_set(int fd, const char *nick) {
  return irc_printf(fd, "NICK %s\r\n", nick);
}


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

x86 assembly (clang, -O2):
<irc_nick_set>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <irc_printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"NICK %s\0D\0A\00"
define i32 @irc_nick_set(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = call i32 @irc_printf(i32 %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %6)
ret i32 %7
}

LLVM IR (-O2):
@.str = [10 x i8] c"NICK %s\0D\0A\00"
define i32 @irc_nick_set(i32 %0, i8* %1) {
%3 = tail call i32 @irc_printf(i32 %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *malloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void test_size(size_t size) {
  void *p = malloc(size);
  if (p) {
    if (size) {
      memset(p, 0, size);
    }
    free(p);
  }
}


x86 assembly (clang, -O0):
<test_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1177 <test_size+0x47>
cmpq   $0x0,-0x8(%rbp)
je     116e <test_size+0x3e>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_size>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <malloc@plt>
test   %rax,%rax
je     1165 <test_size+0x35>
mov    %rax,%rbx
test   %r14,%r14
je     1156 <test_size+0x26>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @test_size(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = icmp eq i64 %0, 0
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @memset(i8* %2, i32 0, i64 %0)
br label %8
8: ; preds = %6, %4
%9 = tail call i32 @free(i8* %2)
br label %10
10: ; preds = %8, %1
ret void
}
/* Variables and functions */
int RAND_MAX;
double rand();
double random_(void) {
  double x = rand() / (RAND_MAX + 1.);
  return x * rand();
}


x86 assembly (clang, -O0):
<random_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    0x2ec2(%rip),%rax
cvtsi2sdl (%rax),%xmm1
movsd  0xece(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
mov    0x2ec9(%rip),%rax
cvtsi2sdl (%rax),%xmm1
addsd  0xed5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define double @random_() {
%1 = alloca double
%2 = call double (...) @rand()
%3 = load i32, i32* @RAND_MAX
%4 = sitofp i32 %3 to double
%5 = fadd double %4, 1.000000e+00
%6 = fdiv double %2, %5
store double %6, double* %1
%7 = load double, double* %1
%8 = call double (...) @rand()
%9 = fmul double %7, %8
ret double %9
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define double @random_() {
%1 = tail call double (...) @rand()
%2 = load i32, i32* @RAND_MAX
%3 = sitofp i32 %2 to double
%4 = fadd double %3, 1.000000e+00
%5 = fdiv double %1, %4
%6 = tail call double (...) @rand()
%7 = fmul double %6, %5
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M376_f(char *s) {
  debug("M376_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M376_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M376_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M376_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M376_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M376_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M376_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EAGAIN;
scalar_t__ errno;
int fileno(int /*<<< orphan*/ *);
int sendfile(int, int, int /*<<< orphan*/ *, int);
void cat(int client, FILE *resource) {
  int out_fd = fileno(resource);
  int result;
  for (;;) {
    result = sendfile(client, out_fd, NULL, 512);
    if (result == 0)
      break;
    else if (result == -1)
      if (errno == EAGAIN)
        continue;
  }
}


x86 assembly (clang, -O0):
<cat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fileno@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
xor    %eax,%eax
mov    %eax,%edx
mov    $0x200,%ecx
call   1040 <sendfile@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1161 <cat+0x41>
jmp    1199 <cat+0x79>
cmpl   $0xffffffff,-0x18(%rbp)
jne    118f <cat+0x6f>
mov    0x2e6e(%rip),%rax
mov    (%rax),%rax
mov    0x2e54(%rip),%rcx
cmp    (%rcx),%rax
jne    118a <cat+0x6a>
jmp    113b <cat+0x1b>
jmp    118f <cat+0x6f>
jmp    1194 <cat+0x74>
jmp    113b <cat+0x1b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cat>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %rsi,%rdi
call   1030 <fileno@plt>
mov    %eax,%ebp
nop
mov    %ebx,%edi
mov    %ebp,%esi
xor    %edx,%edx
mov    $0x200,%ecx
call   1040 <sendfile@plt>
test   %eax,%eax
jne    1130 <cat+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@errno = global i64 0
@EAGAIN = global i64 0
define void @cat(i32 %0, i32* nocapture %1) {
%3 = tail call i32 @fileno(i32* %1)
br label %4
4: ; preds = %4, %2
%5 = tail call i32 @sendfile(i32 %0, i32 %3, i32* null, i32 512)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %4
7: ; preds = %4
ret void
}
int is_index_bigger(double *p, double *q) { return (*p > *q); }


x86 assembly (clang, -O0):
<is_index_bigger>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_index_bigger>:
movsd  (%rdi),%xmm0
xor    %eax,%eax
ucomisd (%rsi),%xmm0
seta   %al
ret

LLVM IR (-O0):
define i32 @is_index_bigger(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = load double, double* %5
%7 = load double*, double** %4
%8 = load double, double* %7
%9 = fcmp ogt double %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @is_index_bigger(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = fcmp ogt double %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int abs(unsigned int);
int /*<<< orphan*/ printf(char *, int);
void cursor_backword(unsigned int columns) { printf("\e[%uD", abs(columns)); }


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

x86 assembly (clang, -O2):
<cursor_backword>:
mov    %edi,%esi
neg    %esi
cmovs  %edi,%esi
lea    0xee2(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"\1B[%uD\00"
define void @cursor_backword(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @abs(i32 %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[%uD\00"
define void @cursor_backword(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
long unsigned int strlen(const char *s) {
  long unsigned int i;
  i = 0;
  while (s[i] != 0)
    i++;
  return i;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1136 <strlen+0x36>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %7, %2 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i64 %3
}
void foo() { int i = 0; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @foo() {
ret void
}
void gtk_widget_unparent() {}


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

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

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

LLVM IR (-O2):
define void @gtk_widget_unparent() {
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  int x;
  int vx = 10;
  for (x = -100; x < 1000; x++) {
    if ((x < 0) && (x > 400)) {
      vx = -vx;
      printf("change direction\n");
    }
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x18(%rbp)
movl   $0xffffff9c,-0x14(%rbp)
cmpl   $0x3e8,-0x14(%rbp)
jge    117f <main+0x6f>
cmpl   $0x0,-0x14(%rbp)
jge    116c <main+0x5c>
cmpl   $0x190,-0x14(%rbp)
jle    116c <main+0x5c>
xor    %eax,%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
jmp    1171 <main+0x61>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1134 <main+0x24>
mov    0x2e5a(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@.str = [18 x i8] c"change direction\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 10, i32* %7
store i32 -100, i32* %6
br label %8
8: ; preds = %22, %2
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 1000
br i1 %10, label %11, label %25
11: ; preds = %8
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %11
%15 = load i32, i32* %6
%16 = icmp sgt i32 %15, 400
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = load i32, i32* %7
%19 = sub nsw i32 0, %18
store i32 %19, i32* %7
%20 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %17, %14, %11
br label %22
22: ; preds = %21
%23 = load i32, i32* %6
%24 = add nsw i32 %23, 1
store i32 %24, i32* %6
br label %8
25: ; preds = %8
%26 = load i32, i32* @EXIT_SUCCESS
ret i32 %26
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}