xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ add_ecc(int /*<<< orphan*/ *);
int /*<<< orphan*/ add_edc(int /*<<< orphan*/ *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ add_header(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
void convert_track_xa_form_1_2056(uint8_t *sector, uint32_t adr) {
  add_header(sector, 0, 0);
  add_edc(sector + 16, 8 + 2048, sector + 2072);
  add_ecc(sector);
  add_header(sector, adr, 2);
}


x86 assembly (clang, -O0):
<convert_track_xa_form_1_2056>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <add_header@plt>
mov    -0x8(%rbp),%rdi
add    $0x40,%rdi
mov    -0x8(%rbp),%rdx
add    $0x2060,%rdx
mov    $0x808,%esi
call   1030 <add_edc@plt>
mov    -0x8(%rbp),%rdi
call   1050 <add_ecc@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x2,%edx
call   1040 <add_header@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_track_xa_form_1_2056>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %esi,%esi
xor    %edx,%edx
call   1040 <add_header@plt>
lea    0x40(%rbx),%rdi
lea    0x2060(%rbx),%rdx
mov    $0x808,%esi
call   1030 <add_edc@plt>
mov    %rbx,%rdi
call   1050 <add_ecc@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    $0x2,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <add_header@plt>

LLVM IR (-O0):
define void @convert_track_xa_form_1_2056(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = call i32 @add_header(i32* %5, i32 0, i32 0)
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 16
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 2072
%11 = call i32 @add_edc(i32* %8, i32 2056, i32* %10)
%12 = load i32*, i32** %3
%13 = call i32 @add_ecc(i32* %12)
%14 = load i32*, i32** %3
%15 = load i32, i32* %4
%16 = call i32 @add_header(i32* %14, i32 %15, i32 2)
ret void
}

LLVM IR (-O2):
define void @convert_track_xa_form_1_2056(i32* %0, i32 %1) {
%3 = tail call i32 @add_header(i32* %0, i32 0, i32 0)
%4 = getelementptr inbounds i32, i32* %0, i64 16
%5 = getelementptr inbounds i32, i32* %0, i64 2072
%6 = tail call i32 @add_edc(i32* %4, i32 2056, i32* %5)
%7 = tail call i32 @add_ecc(i32* %0)
%8 = tail call i32 @add_header(i32* %0, i32 %1, i32 2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ RAND_METHOD;

/* Variables and functions */
const RAND_METHOD *RAND_get_rand_method(void) { return NULL; }


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

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

LLVM IR (-O0):
define i32* @RAND_get_rand_method() {
ret i32* null
}

LLVM IR (-O2):
define noalias i32* @RAND_get_rand_method() {
ret i32* null
}
int main(int argc, char *argv[], char *envp[]) {
  int a;
  a = a + 679;
  return a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x2a7,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 679
store i32 %10, i32* %8
%11 = load i32, i32* %8
ret i32 %11
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int listen(int, int);
int /*<<< orphan*/ perror(char *);
void listen_on(int sockfd, int backlog) {
  int err = listen(sockfd, backlog);
  if (err) {
    perror("listen");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<listen_on>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <listen@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     116c <listen_on+0x3c>
lea    0xea3(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<listen_on>:
push   %rax
call   1030 <listen@plt>
test   %eax,%eax
jne    113c <listen_on+0xc>
pop    %rax
ret
lea    0xebd(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"listen\00"
define void @listen_on(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 @listen(i32 %6, i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"listen\00"
define void @listen_on(i32 %0, i32 %1) {
%3 = tail call i32 @listen(i32 %0, i32 %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
ret void
}
f() {
  long ldata[2];
  int seed;
  seed = (ldata[0]) + (ldata[1] << 16);
  g(seed);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
shl    $0x10,%rcx
add    %rcx,%rax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
mov    $0x0,%al
call   1030 <g@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f() {
%1 = alloca i32
%2 = alloca [2 x i64]
%3 = alloca i32
%4 = getelementptr inbounds [2 x i64], [2 x i64]* %2, i64 0, i64 0
%5 = load i64, i64* %4
%6 = getelementptr inbounds [2 x i64], [2 x i64]* %2, i64 0, i64 1
%7 = load i64, i64* %6
%8 = shl i64 %7, 16
%9 = add nsw i64 %5, %8
%10 = trunc i64 %9 to i32
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = call i32 (i32, ...) bitcast (i32 (...)* @g to i32 (i32, ...)*)(i32 %11)
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
define i32 @f() {
%1 = tail call i32 (i32, ...) bitcast (i32 (...)* @g to i32 (i32, ...)*)(i32 undef)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void error() { exit(1); }


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <exit@plt>

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

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

LLVM IR (-O2):
define void @error() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
void call_restore_data(struct desc_track *desc) {}


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

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

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

LLVM IR (-O2):
%struct.desc_track = type opaque
define void @call_restore_data(%struct.desc_track* nocapture %0) {
ret void
}
indent(indent_amount, temporary_indent) int indent_amount;
int temporary_indent;
{
  static int current_indent;
  if (indent_amount != current_indent) {
    printf("'in %d\n", indent_amount);
    current_indent = indent_amount;
  }
  if (temporary_indent > 0)
    printf(".ti -%d\n", temporary_indent);
}


x86 assembly (clang, -O0):
<indent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    0x2f05(%rip),%eax
je     1147 <indent+0x37>
mov    -0x8(%rbp),%esi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,0x2ee5(%rip)
cmpl   $0x0,-0xc(%rbp)
jle    1162 <indent+0x52>
mov    -0xc(%rbp),%esi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<indent>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
cmp    %edi,0x2f11(%rip)
je     1135 <indent+0x25>
mov    %edi,%ebp
lea    0xeda(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,0x2ef7(%rip)
test   %ebx,%ebx
jle    1149 <indent+0x39>
lea    0xec8(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@indent.current_indent = internal global i32 0
@.str = [8 x i8] c"'in %d\0A\00"
@.str.1 = [9 x i8] c".ti -%d\0A\00"
define i32 @indent(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* @indent.current_indent
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %4
store i32 %12, i32* @indent.current_indent
br label %13
13: ; preds = %9, %2
%14 = load i32, i32* %5
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* %5
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %16, %13
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@indent.current_indent = internal unnamed_addr global i32 0
@.str = [8 x i8] c"'in %d\0A\00"
@.str.1 = [9 x i8] c".ti -%d\0A\00"
define i32 @indent(i32 %0, i32 %1) {
%3 = load i32, i32* @indent.current_indent
%4 = icmp eq i32 %3, %0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %0)
store i32 %0, i32* @indent.current_indent
br label %7
7: ; preds = %5, %2
%8 = icmp sgt i32 %1, 0
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %1)
br label %11
11: ; preds = %9, %7
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ foo(int, int);
int main(void) {
  foo(0, 1);
  foo(11, 1);
  foo(21, 0);
  foo(41, 0);
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @foo(i32 0, i32 1)
%3 = call i32 @foo(i32 11, i32 1)
%4 = call i32 @foo(i32 21, i32 0)
%5 = call i32 @foo(i32 41, i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 0, i32 1)
%2 = tail call i32 @foo(i32 11, i32 1)
%3 = tail call i32 @foo(i32 21, i32 0)
%4 = tail call i32 @foo(i32 41, i32 0)
ret i32 0
}
void ff_hevc_put_hevc_bi_w_qpel_v24_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_w_qpel_v24_12_sse4() {
ret void
}
void swap(unsigned char *pa, unsigned char *pb) {}


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

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

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

LLVM IR (-O2):
define void @swap(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f2();
int /*<<< orphan*/ printf(char *);
void f1(void) {
  printf("f1 begins\n");
  f2();
  printf("f1 returns\n");
}


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <f2@plt>
lea    0xecd(%rip),%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1030 <f2@plt>
lea    0xecf(%rip),%rdi
pop    %rax
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"f1 begins\0A\00"
@.str.1 = [12 x i8] c"f1 returns\0A\00"
define void @f1() {
%1 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @f2()
%3 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [10 x i8] c"f1 begins\00"
@str.2 = [11 x i8] c"f1 returns\00"
define void @f1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @f2()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *strncpy(char *dest, const char *src, size_t n) {
  const unsigned char *s = src;
  unsigned char *d = dest;
  while (n-- && (*d++ = *s++))
    ;
  return dest;
}


x86 assembly (clang, -O0):
<strncpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rcx
mov    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x29(%rbp)
je     116c <strncpy+0x6c>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%al
mov    -0x28(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %al,(%rcx)
movzbl %al,%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    117c <strncpy+0x7c>
jmp    1181 <strncpy+0x81>
jmp    1120 <strncpy+0x20>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %rcx,%rdx
je     1126 <strncpy+0x26>
movzbl (%rsi,%rcx,1),%edi
mov    %dil,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dil,%dil
jne    1110 <strncpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strncpy(i8* returned writeonly %0, i8* nocapture %1, i64 %2) {
br label %4
4: ; preds = %9, %3
%5 = phi i64 [ %2, %3 ], [ %10, %9 ]
%6 = phi i8* [ %1, %3 ], [ %11, %9 ]
%7 = phi i8* [ %0, %3 ], [ %13, %9 ]
%8 = icmp eq i64 %5, 0
br i1 %8, label %15, label %9
9: ; preds = %4
%10 = add i64 %5, -1
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = load i8, i8* %6
%13 = getelementptr inbounds i8, i8* %7, i64 1
store i8 %12, i8* %7
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %9
ret i8* %0
}
/* Variables and functions */
int SPI_CS_HIGH;
int SPI_getMode(int);
int SPI_setMode(int, int);
int SPI_setCSActiveHigh(int spidev_fd) {
  int mode = SPI_getMode(spidev_fd);
  if (mode < 0)
    return -1;
  return SPI_setMode(spidev_fd, mode | SPI_CS_HIGH);
}


x86 assembly (clang, -O0):
<SPI_setCSActiveHigh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <SPI_getMode@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    114c <SPI_setCSActiveHigh+0x2c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1163 <SPI_setCSActiveHigh+0x43>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    0x2e8f(%rip),%rax
or     (%rax),%esi
call   1030 <SPI_setMode@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SPI_setCSActiveHigh>:
push   %rbx
mov    %edi,%ebx
call   1040 <SPI_getMode@plt>
test   %eax,%eax
js     113f <SPI_setCSActiveHigh+0x1f>
mov    0x2eb5(%rip),%rcx
or     (%rcx),%eax
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1030 <SPI_setMode@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@SPI_CS_HIGH = global i32 0
define i32 @SPI_setCSActiveHigh(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @SPI_getMode(i32 %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 -1, i32* %2
br label %16
10: ; preds = %1
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = load i32, i32* @SPI_CS_HIGH
%14 = or i32 %12, %13
%15 = call i32 @SPI_setMode(i32 %11, i32 %14)
store i32 %15, i32* %2
br label %16
16: ; preds = %10, %9
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@SPI_CS_HIGH = global i32 0
define i32 @SPI_setCSActiveHigh(i32 %0) {
%2 = tail call i32 @SPI_getMode(i32 %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = load i32, i32* @SPI_CS_HIGH
%6 = or i32 %5, %2
%7 = tail call i32 @SPI_setMode(i32 %0, i32 %6)
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ -1, %1 ]
ret i32 %9
}
int ft_size(int nb) {
  int i;
  i = 0;
  if (!nb)
    return (1);
  while (nb) {
    nb /= 10;
    ++i;
  }
  return (i);
}


x86 assembly (clang, -O0):
<ft_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1124 <ft_size+0x24>
movl   $0x1,-0x4(%rbp)
jmp    1155 <ft_size+0x55>
jmp    1129 <ft_size+0x29>
cmpl   $0x0,-0x8(%rbp)
je     114f <ft_size+0x4f>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1129 <ft_size+0x29>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_size>:
test   %edi,%edi
je     1133 <ft_size+0x33>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
add    $0x1,%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <ft_size+0x10>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_size(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = sdiv i32 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = add i32 %5, 9
%9 = icmp ult i32 %8, 19
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 1, %1 ], [ %7, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ Triangle168(long, long, long, long, long, long);
void triangle(long x1, long y1, long x2, long y2, long x3, long y3) {
  Triangle168(x1, y1, x2, y2, x3, y3);
}


x86 assembly (clang, -O0):
<triangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
call   1030 <Triangle168@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<triangle>:
jmp    1030 <Triangle168@plt>

LLVM IR (-O0):
define void @triangle(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
store i64 %0, i64* %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i64 %3, i64* %10
store i64 %4, i64* %11
store i64 %5, i64* %12
%13 = load i64, i64* %7
%14 = load i64, i64* %8
%15 = load i64, i64* %9
%16 = load i64, i64* %10
%17 = load i64, i64* %11
%18 = load i64, i64* %12
%19 = call i32 @Triangle168(i64 %13, i64 %14, i64 %15, i64 %16, i64 %17, i64 %18)
ret void
}

LLVM IR (-O2):
define void @triangle(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
%7 = tail call i32 @Triangle168(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ASRT_Mark(char *, int, char *);
scalar_t__ ASRT_True(int);
int test_TrueOk() {
  do {
    ASRT_Mark("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/cohadar/c-learning/refs/heads/master/"
              "src/asrt_tests.c",
              45, "1");
    if (ASRT_True(!!(1))) {
      return 1;
    };
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_TrueOk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x2d,%esi
lea    0xf55(%rip),%rdx
call   1040 <ASRT_Mark@plt>
mov    $0x1,%edi
call   1030 <ASRT_True@plt>
cmp    $0x0,%rax
je     1160 <test_TrueOk+0x40>
movl   $0x1,-0x4(%rbp)
jmp    116c <test_TrueOk+0x4c>
jmp    1165 <test_TrueOk+0x45>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_TrueOk>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xf61(%rip),%rdx
mov    $0x2d,%esi
call   1040 <ASRT_Mark@plt>
mov    $0x1,%edi
call   1030 <ASRT_True@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cohadar/c-learning/refs/heads/master/src/asrt_tests.c\00"
@.str.1 = [2 x i8] c"1\00"
define i32 @test_TrueOk() {
%1 = alloca i32
br label %2
2: ; preds = %0
%3 = call i32 @ASRT_Mark(i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = call i64 @ASRT_True(i32 1)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %2
store i32 1, i32* %1
br label %9
7: ; preds = %2
br label %8
8: ; preds = %7
store i32 0, i32* %1
br label %9
9: ; preds = %8, %6
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
@.str = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/cohadar/c-learning/refs/heads/master/src/asrt_tests.c\00"
@.str.1 = [2 x i8] c"1\00"
define i32 @test_TrueOk() {
%1 = tail call i32 @ASRT_Mark(i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str, i64 0, i64 0), i32 45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i64 @ASRT_True(i32 1)
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
void _s_init() {}


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

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

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

LLVM IR (-O2):
define void @_s_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ iDoRemoteFunc(unsigned char *, unsigned int, int);
char *malloc(int);
unsigned int sprintf(char *, char *, int);
void _vRcFingerprintClose(void) {
  unsigned int uiDataLen;
  char *psFunCall = malloc(100);
  uiDataLen = sprintf(psFunCall, "%u()", 4002);
  iDoRemoteFunc((unsigned char *)psFunCall, uiDataLen, 1);
  free(psFunCall);
}


x86 assembly (clang, -O0):
<_vRcFingerprintClose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe9f(%rip),%rsi
mov    $0xfa2,%edx
call   1060 <sprintf@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    $0x1,%edx
call   1050 <iDoRemoteFunc@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_vRcFingerprintClose>:
push   %rbx
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xeab(%rip),%rsi
mov    %rax,%rdi
mov    $0xfa2,%edx
call   1060 <sprintf@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x1,%edx
call   1050 <iDoRemoteFunc@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%u()\00"
define void @_vRcFingerprintClose() {
%1 = alloca i32
%2 = alloca i8*
%3 = call i8* @malloc(i32 100)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4002)
store i32 %5, i32* %1
%6 = load i8*, i8** %2
%7 = load i32, i32* %1
%8 = call i32 @iDoRemoteFunc(i8* %6, i32 %7, i32 1)
%9 = load i8*, i8** %2
%10 = call i32 @free(i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%u()\00"
define void @_vRcFingerprintClose() {
%1 = tail call dereferenceable_or_null(100) i8* @malloc(i32 100)
%2 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4002)
%3 = tail call i32 @iDoRemoteFunc(i8* %1, i32 %2, i32 1)
%4 = tail call i32 @free(i8* %1)
ret void
}
int sys$write(struct _fab *fab, void *err, void *suc) {
  return ({
    unsigned long resultvar;
    register long int _a3 asm("rdx") = (long)(suc);
    register long int _a2 asm("rsi") = (long)(err);
    register long int _a1 asm("rdi") = (long)(fab);
    asm volatile("movq %1, %%rax\n\t"
                 "int $0x82\n\t"
                 : "=a"(resultvar)
                 : "i"(29), "r"(_a1), "r"(_a2), "r"(_a3)
                 : "memory", "cc", "r11", "cx");
    (long)resultvar;
  });
}


x86 assembly (clang, -O0):
<sys$write>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    $0x1d,%rax
int    $0x82
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys$write>:
mov    $0x1d,%rax
int    $0x82
ret

LLVM IR (-O0):
%struct._fab = type opaque
define i32 @"sys$write"(%struct._fab* %0, i8* %1, i8* %2) {
%4 = alloca %struct._fab*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store %struct._fab* %0, %struct._fab** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%12 = load i8*, i8** %6
%13 = ptrtoint i8* %12 to i64
store i64 %13, i64* %8
%14 = load i8*, i8** %5
%15 = ptrtoint i8* %14 to i64
store i64 %15, i64* %9
%16 = load %struct._fab*, %struct._fab** %4
%17 = ptrtoint %struct._fab* %16 to i64
store i64 %17, i64* %10
%18 = load i64, i64* %10
%19 = load i64, i64* %9
%20 = load i64, i64* %8
%21 = call i64 asm sideeffect "movq $1, %rax\0A\09int $$0x82\0A\09", "={ax},i,{rdi},{rsi},{rdx},~{memory},~{cc},~{r11},~{cx},~{dirflag},~{fpsr},~{flags}"(i32 29, i64 %18, i64 %19, i64 %20)
store i64 %21, i64* %7
%22 = load i64, i64* %7
store i64 %22, i64* %11
%23 = load i64, i64* %11
%24 = trunc i64 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
%struct._fab = type opaque
define i32 @"sys$write"(%struct._fab* %0, i8* %1, i8* %2) {
%4 = ptrtoint i8* %2 to i64
%5 = ptrtoint i8* %1 to i64
%6 = ptrtoint %struct._fab* %0 to i64
%7 = tail call i64 asm sideeffect "movq $1, %rax\0A\09int $$0x82\0A\09", "={ax},i,{rdi},{rsi},{rdx},~{memory},~{cc},~{r11},~{cx},~{dirflag},~{fpsr},~{flags}"(i32 29, i64 %6, i64 %5, i64 %4)
%8 = trunc i64 %7 to i32
ret i32 %8
}
int d1_getversion() { return ((1 << 16) | 4); }


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

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

LLVM IR (-O0):
define i32 @d1_getversion() {
ret i32 65540
}

LLVM IR (-O2):
define i32 @d1_getversion() {
ret i32 65540
}
int ld_bge_rr2(long double a1, long double a2) {
  return !(__builtin_isgreaterequal(a1, a2));
}


x86 assembly (clang, -O0):
<ld_bge_rr2>:
push   %rbp
mov    %rsp,%rbp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x10(%rbp)
fldt   -0x20(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
setae  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ld_bge_rr2>:
fldt   0x18(%rsp)
fldt   0x8(%rsp)
xor    %eax,%eax
fucomip %st(1),%st
fstp   %st(0)
setb   %al
ret

LLVM IR (-O0):
define i32 @ld_bge_rr2(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %3
store x86_fp80 %1, x86_fp80* %4
%5 = load x86_fp80, x86_fp80* %3
%6 = load x86_fp80, x86_fp80* %4
%7 = fcmp oge x86_fp80 %5, %6
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @ld_bge_rr2(x86_fp80 %0, x86_fp80 %1) {
%3 = fcmp ult x86_fp80 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
int conexionDB() {}


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

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

LLVM IR (-O0):
define i32 @conexionDB() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @conexionDB() {
ret i32 undef
}
/* Variables and functions */
double __ocml_asinh_f64(double);
double asinh(double x) { return __ocml_asinh_f64(x); }


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

x86 assembly (clang, -O2):
<asinh>:
jmp    1030 <__ocml_asinh_f64@plt>

LLVM IR (-O0):
define double @asinh(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @__ocml_asinh_f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @asinh(double %0) {
%2 = tail call double @__ocml_asinh_f64(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ test_create_element();
int /*<<< orphan*/ test_create_object();
void test_all(void) {
  test_create_element();
  test_create_object();
}


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

x86 assembly (clang, -O2):
<test_all>:
push   %rax
xor    %eax,%eax
call   1030 <test_create_element@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <test_create_object@plt>

LLVM IR (-O0):
define void @test_all() {
%1 = call i32 (...) @test_create_element()
%2 = call i32 (...) @test_create_object()
ret void
}

LLVM IR (-O2):
define void @test_all() {
%1 = tail call i32 (...) @test_create_element()
%2 = tail call i32 (...) @test_create_object()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void _cleanup_close(int *p) {
  if (*p != -1)
    close(*p);
}


x86 assembly (clang, -O0):
<_cleanup_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0xffffffff,(%rax)
je     1134 <_cleanup_close+0x24>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cleanup_close>:
mov    (%rdi),%edi
cmp    $0xffffffff,%edi
je     111c <_cleanup_close+0xc>
jmp    1030 <close@plt>
ret

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

LLVM IR (-O2):
define void @_cleanup_close(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, -1
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @close(i32 %2)
br label %6
6: ; preds = %4, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ string;
typedef scalar_t__ Version;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int, int, int);
const char *format_Version(unsigned long Version) {
  static char string[12];
  snprintf(string, sizeof(string), "%d.%d.%d", (int)((Version >> 16) & 0xff),
           (int)((Version >> 8) & 0xff), (int)((Version)&0xff));
  return (string);
}


x86 assembly (clang, -O0):
<format_Version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
and    $0xff,%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %eax,%r8d
mov    -0x8(%rbp),%rax
and    $0xff,%rax
mov    %eax,%r9d
lea    0x2ed8(%rip),%rdi
mov    $0xc,%esi
lea    0xea3(%rip),%rdx
call   1030 <snprintf@plt>
lea    0x2ec0(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_Version>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rax
movzbl %ah,%ebp
movzbl %al,%r9d
shr    $0x10,%eax
movzbl %al,%ecx
lea    0x2eff(%rip),%rbx
lea    0xecf(%rip),%rdx
mov    %rbx,%rdi
mov    $0xc,%esi
mov    %ebp,%r8d
call   1030 <snprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@format_Version.string = internal global [12 x i8] zeroinitializer
@.str = [9 x i8] c"%d.%d.%d\00"
define i8* @format_Version(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 255
%6 = trunc i64 %5 to i32
%7 = load i64, i64* %2
%8 = lshr i64 %7, 8
%9 = and i64 %8, 255
%10 = trunc i64 %9 to i32
%11 = load i64, i64* %2
%12 = and i64 %11, 255
%13 = trunc i64 %12 to i32
%14 = call i32 @snprintf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @format_Version.string, i64 0, i64 0), i32 12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %10, i32 %13)
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @format_Version.string, i64 0, i64 0)
}

LLVM IR (-O2):
@format_Version.string = internal global [12 x i8] zeroinitializer
@.str = [9 x i8] c"%d.%d.%d\00"
define i8* @format_Version(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = lshr i32 %2, 16
%4 = and i32 %3, 255
%5 = lshr i32 %2, 8
%6 = and i32 %5, 255
%7 = and i32 %2, 255
%8 = tail call i32 @snprintf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @format_Version.string, i64 0, i64 0), i32 12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %6, i32 %7)
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @format_Version.string, i64 0, i64 0)
}
int test_imm_65int32_reg(int val) { return ((val) & (0x65 << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_65int32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x65,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_65int32_reg>:
test   $0x65,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_65int32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 101
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 -20, i32 -40
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_imm_65int32_reg(i32 %0) {
%2 = and i32 %0, 101
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ templ(char *);
void main() {
  int x = 0;
  int n;
  while (x < n) {
    templ("(1;1)");
    x++;
  }
  if (n > 0)
    assert(x <= n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1155 <main+0x35>
lea    0xebe(%rip),%rdi
call   1030 <templ@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <main+0xf>
cmpl   $0x0,-0x8(%rbp)
jle    1172 <main+0x52>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @main() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long, int);
int /*<<< orphan*/ sleep(int);
int clone_main(void *arg) {
  unsigned long input = (unsigned long)arg;
  int secs = (input / 10) * 4;
  printf("Clone got %lu, sleeping for %i secs\n", input, secs);
  sleep(secs);
  return input + 20;
}


x86 assembly (clang, -O0):
<clone_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
shl    $0x2,%rax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
call   1040 <sleep@plt>
mov    -0x10(%rbp),%rax
add    $0x14,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clone_main>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movabs $0xcccccccccccccccd,%rcx
cc cc cc
mov    %rdi,%rax
mul    %rcx
shr    $0x3,%rdx
lea    0x0(,%rdx,4),%ebp
lea    0xeb8(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <printf@plt>
mov    %ebp,%edi
call   1040 <sleep@plt>
add    $0x14,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Clone got %lu, sleeping for %i secs\0A\00"
define i32 @clone_main(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = ptrtoint i8* %5 to i64
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = udiv i64 %7, 10
%9 = mul i64 %8, 4
%10 = trunc i64 %9 to i32
store i32 %10, i32* %4
%11 = load i64, i64* %3
%12 = load i32, i32* %4
%13 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %11, i32 %12)
%14 = load i32, i32* %4
%15 = call i32 @sleep(i32 %14)
%16 = load i64, i64* %3
%17 = add i64 %16, 20
%18 = trunc i64 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
@.str = [37 x i8] c"Clone got %lu, sleeping for %i secs\0A\00"
define i32 @clone_main(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = udiv i64 %2, 10
%4 = trunc i64 %3 to i32
%5 = shl i32 %4, 2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %2, i32 %5)
%7 = tail call i32 @sleep(i32 %5)
%8 = trunc i64 %2 to i32
%9 = add i32 %8, 20
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
void game_error(char *fmt, ...) { assert(0); }


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

x86 assembly (clang, -O2):
<game_error>:
xor    %edi,%edi
jmp    1030 <assert@plt>

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

LLVM IR (-O2):
define void @game_error(i8* nocapture readnone %0, ...) {
%2 = tail call i32 @assert(i32 0)
ret void
}
/* Variables and functions */
scalar_t__ __aeabi_uidivmod(unsigned int, unsigned int);
unsigned int __aeabi_uidiv(unsigned int value, unsigned int divisor) {
  return (unsigned int)__aeabi_uidivmod(value, divisor);
}


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

x86 assembly (clang, -O2):
<__aeabi_uidiv>:
jmp    1030 <__aeabi_uidivmod@plt>

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

LLVM IR (-O2):
define i32 @__aeabi_uidiv(i32 %0, i32 %1) {
%3 = tail call i64 @__aeabi_uidivmod(i32 %0, i32 %1)
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
size_t FileAccessOpStub() { return 0; }


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

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

LLVM IR (-O0):
define i64 @FileAccessOpStub() {
ret i64 0
}

LLVM IR (-O2):
define i64 @FileAccessOpStub() {
ret i64 0
}
int func_bool(int a, int b) { return !b; }


x86 assembly (clang, -O0):
<func_bool>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<func_bool>:
xor    %eax,%eax
test   %esi,%esi
sete   %al
ret

LLVM IR (-O0):
define i32 @func_bool(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @func_bool(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ yield();
void f_pong(void) {
  while (1) {
    printf("1");
    printf("2");
    yield();
  }
}


x86 assembly (clang, -O0):
<f_pong>:
push   %rbp
mov    %rsp,%rbp
jmp    1129 <f_pong+0x9>
lea    0xed0(%rip),%rdi
call   1040 <printf@plt>
lea    0xec6(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <yield@plt>
jmp    1129 <f_pong+0x9>

x86 assembly (clang, -O2):
<f_pong>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x31,%edi
call   1030 <putchar@plt>
mov    $0x32,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <yield@plt>
jmp    1130 <f_pong+0x10>

LLVM IR (-O0):
@.str = [2 x i8] c"1\00"
@.str.1 = [2 x i8] c"2\00"
define void @f_pong() {
br label %1
1: ; preds = %0, %1
%2 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (...) @yield()
br label %1
}

LLVM IR (-O2):
define void @f_pong() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 @putchar(i32 49)
%3 = tail call i32 @putchar(i32 50)
%4 = tail call i32 (...) @yield()
br label %1
}
/* Variables and functions */
float sqrtf(float);
float libm_sqrtf(float x) { return sqrtf(x); }


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

x86 assembly (clang, -O2):
<libm_sqrtf>:
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     111d <libm_sqrtf+0xd>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrtf@plt>

LLVM IR (-O0):
define float @libm_sqrtf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @sqrtf(float %3)
ret float %4
}

LLVM IR (-O2):
define float @libm_sqrtf(float %0) {
%2 = tail call float @sqrtf(float %0)
ret float %2
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ err_sys(char *);
int fork();
pid_t Fork(void) {
  pid_t pid;
  if ((pid = fork()) == -1)
    err_sys("fork error");
  return pid;
}


x86 assembly (clang, -O0):
<Fork>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <fork@plt>
mov    %eax,-0x4(%rbp)
cmp    $0xffffffff,%eax
jne    1147 <Fork+0x27>
lea    0xebe(%rip),%rdi
call   1030 <err_sys@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fork>:
push   %rbx
xor    %eax,%eax
call   1040 <fork@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    113b <Fork+0x1b>
lea    0xeca(%rip),%rdi
call   1030 <err_sys@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"fork error\00"
define i32 @Fork() {
%1 = alloca i32
%2 = call i32 (...) @fork()
store i32 %2, i32* %1
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @err_sys(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@.str = [11 x i8] c"fork error\00"
define i32 @Fork() {
%1 = tail call i32 (...) @fork()
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @err_sys(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret i32 %1
}