xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, double, int, double, double);
int /*<<< orphan*/ puts(char *);
double sqrt(int);
void out_print(int z, double our_value) {
  double error, std_value;
  std_value = sqrt(z);
  error = std_value - our_value;
  puts("\n--> Results!");
  printf("\nOur sqrt(%d): %.10lf\nStandard sqrt(%d): %.10lf\nError: %.10lf\n",
         z, our_value, z, std_value, error);
}


x86 assembly (clang, -O0):
<out_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
lea    0xe9d(%rip),%rdi
call   1030 <puts@plt>
mov    -0x4(%rbp),%esi
movsd  -0x10(%rbp),%xmm0
mov    -0x4(%rbp),%edx
movsd  -0x20(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<out_print>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %edi,%ebx
call   1050 <sqrt@plt>
movsd  %xmm0,0x18(%rsp)
subsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
lea    0xea7(%rip),%rdi
mov    %ebx,%esi
movsd  0x8(%rsp),%xmm0
mov    %ebx,%edx
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
add    $0x20,%rsp
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"\0A--> Results!\00"
@.str.1 = [63 x i8] c"\0AOur sqrt(%d): %.10lf\0AStandard sqrt(%d): %.10lf\0AError: %.10lf\0A\00"
define void @out_print(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%7 = load i32, i32* %3
%8 = call double @sqrt(i32 %7)
store double %8, double* %6
%9 = load double, double* %6
%10 = load double, double* %4
%11 = fsub double %9, %10
store double %11, double* %5
%12 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %3
%14 = load double, double* %4
%15 = load i32, i32* %3
%16 = load double, double* %6
%17 = load double, double* %5
%18 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0), i32 %13, double %14, i32 %15, double %16, double %17)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"\0A--> Results!\00"
@.str.1 = [63 x i8] c"\0AOur sqrt(%d): %.10lf\0AStandard sqrt(%d): %.10lf\0AError: %.10lf\0A\00"
define void @out_print(i32 %0, double %1) {
%3 = tail call double @sqrt(i32 %0)
%4 = fsub double %3, %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0), i32 %0, double %1, i32 %0, double %3, double %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, char *, size_t);
void cmpp_pack_set_string(void *pack, size_t offset, char *val, size_t vallen,
                          size_t size) {
  if (!pack) {
    return;
  }
  size_t n;
  unsigned char *ptr = (unsigned char *)pack + offset;
  n = (vallen <= size) ? vallen : size;
  memcpy(ptr, val, n);
  return;
}


x86 assembly (clang, -O0):
<cmpp_pack_set_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113c <cmpp_pack_set_string+0x2c>
jmp    1184 <cmpp_pack_set_string+0x74>
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
ja     1163 <cmpp_pack_set_string+0x53>
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
jmp    116b <cmpp_pack_set_string+0x5b>
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1030 <memcpy@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmpp_pack_set_string>:
test   %rdi,%rdi
je     112a <cmpp_pack_set_string+0x1a>
add    %rsi,%rdi
cmp    %r8,%rcx
cmova  %r8,%rcx
mov    %rdx,%rsi
mov    %rcx,%rdx
jmp    1030 <memcpy@plt>
ret

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

LLVM IR (-O2):
define void @cmpp_pack_set_string(i8* %0, i64 %1, i8* %2, i64 %3, i64 %4) {
%6 = icmp eq i8* %0, null
br i1 %6, label %12, label %7
7: ; preds = %5
%8 = getelementptr inbounds i8, i8* %0, i64 %1
%9 = icmp ugt i64 %3, %4
%10 = select i1 %9, i64 %4, i64 %3
%11 = tail call i32 @memcpy(i8* %8, i8* %2, i64 %10)
br label %12
12: ; preds = %5, %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assertTrue(char *, int);
void primitive_voidp_receiver(void *p) {
  int *pi = (int *)p;
  assertTrue("*pi == 96", *pi == 96);
  ;
}


x86 assembly (clang, -O0):
<primitive_voidp_receiver>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x60,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xec6(%rip),%rdi
call   1030 <assertTrue@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<primitive_voidp_receiver>:
xor    %esi,%esi
cmpl   $0x60,(%rdi)
sete   %sil
lea    0xee0(%rip),%rdi
jmp    1030 <assertTrue@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"*pi == 96\00"
define void @primitive_voidp_receiver(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 96
%9 = zext i1 %8 to i32
%10 = call i32 @assertTrue(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"*pi == 96\00"
define void @primitive_voidp_receiver(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 96
%5 = zext i1 %4 to i32
%6 = tail call i32 @assertTrue(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}
int main() {
  return 0;
  return 1;
  return 10;
  return 3;
  return 17;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int sstrlen(register char *s) {
  register char *b;
  for (b = s; *s; s++)
    ;
  return (s - b);
}


x86 assembly (clang, -O0):
<sstrlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1133 <sstrlen+0x33>
jmp    1122 <sstrlen+0x22>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <sstrlen+0x10>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sstrlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <sstrlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @sstrlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
ret i32 %11
}
/* Type definitions */
struct sembuf {
  int sem_num;
  int sem_op;
  int /*<<< orphan*/ sem_flg;
};

/* Variables and functions */
int /*<<< orphan*/ SEM_UNDO;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
scalar_t__ semop(int, struct sembuf *, int);
void P(int sem_id, int key) {
  struct sembuf *bf;
  bf->sem_num = key;
  bf->sem_op = 1;
  bf->sem_flg = SEM_UNDO;
  if (semop(sem_id, bf, 1) < 0) {
    perror("P failed\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<P>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,0x4(%rax)
mov    0x2e97(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1040 <semop@plt>
cmp    $0x0,%rax
jge    1193 <P+0x63>
lea    0xe7c(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
%struct.sembuf = type { i32, i32, i32 }
@SEM_UNDO = global i32 0
@.str = [10 x i8] c"P failed\0A\00"
define void @P(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.sembuf*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = load %struct.sembuf*, %struct.sembuf** %5
%8 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %7, i32 0, i32 0
store i32 %6, i32* %8
%9 = load %struct.sembuf*, %struct.sembuf** %5
%10 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %9, i32 0, i32 1
store i32 1, i32* %10
%11 = load i32, i32* @SEM_UNDO
%12 = load %struct.sembuf*, %struct.sembuf** %5
%13 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %12, i32 0, i32 2
store i32 %11, i32* %13
%14 = load i32, i32* %3
%15 = load %struct.sembuf*, %struct.sembuf** %5
%16 = call i64 @semop(i32 %14, %struct.sembuf* %15, i32 1)
%17 = icmp slt i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %2
ret void
}

LLVM IR (-O2):
void resetA(double *a) {}


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

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

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

LLVM IR (-O2):
define void @resetA(double* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
void server_disconnect_cb(int fd, short events) {
  (void)events;
  fprintf(stderr, "server::disconnected to %d\n", fd);
}


x86 assembly (clang, -O0):
<server_disconnect_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    0x2eb7(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xecb(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<server_disconnect_cb>:
mov    %edi,%edx
mov    0x2ec7(%rip),%rax
mov    (%rax),%edi
lea    0xede(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"server::disconnected to %d\0A\00"
define void @server_disconnect_cb(i32 %0, i16 signext %1) {
%3 = alloca i32
%4 = alloca i16
store i32 %0, i32* %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = load i32, i32* @stderr
%7 = load i32, i32* %3
%8 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"server::disconnected to %d\0A\00"
define void @server_disconnect_cb(i32 %0, i16 signext %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Type definitions */
struct list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ failure(char *);
int /*<<< orphan*/ list_empty(struct list *);
int /*<<< orphan*/ test_size(struct list *, int /*<<< orphan*/);
void test_empty(struct list *list) {
  test_size(list, 0);
  if (!list_empty(list))
    failure("empty list should have been empty");
}


x86 assembly (clang, -O0):
<test_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <test_size@plt>
mov    -0x8(%rbp),%rdi
call   1050 <list_empty@plt>
cmp    $0x0,%eax
jne    1165 <test_empty+0x35>
lea    0xea0(%rip),%rdi
call   1040 <failure@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_empty>:
push   %rbx
mov    %rdi,%rbx
xor    %esi,%esi
call   1030 <test_size@plt>
mov    %rbx,%rdi
call   1050 <list_empty@plt>
test   %eax,%eax
je     1149 <test_empty+0x19>
pop    %rbx
ret
lea    0xeb0(%rip),%rdi
pop    %rbx
jmp    1040 <failure@plt>

LLVM IR (-O0):
%struct.list = type { i32 }
@.str = [34 x i8] c"empty list should have been empty\00"
define void @test_empty(%struct.list* %0) {
%2 = alloca %struct.list*
store %struct.list* %0, %struct.list** %2
%3 = load %struct.list*, %struct.list** %2
%4 = call i32 @test_size(%struct.list* %3, i32 0)
%5 = load %struct.list*, %struct.list** %2
%6 = call i32 @list_empty(%struct.list* %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @failure(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
%struct.list = type { i32 }
@.str = [34 x i8] c"empty list should have been empty\00"
define void @test_empty(%struct.list* %0) {
%2 = tail call i32 @test_size(%struct.list* %0, i32 0)
%3 = tail call i32 @list_empty(%struct.list* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @failure(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *xfiredb_alloc(size_t len) {
  void *region;
  if (len)
    region = malloc(len);
  else
    return NULL;
  if (!region) {
    fputs("Memory allocation failed!\n", stderr);
    abort();
  }
  return region;
}


x86 assembly (clang, -O0):
<xfiredb_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1159 <xfiredb_alloc+0x29>
mov    -0x10(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
jmp    1166 <xfiredb_alloc+0x36>
movq   $0x0,-0x8(%rbp)
jmp    1195 <xfiredb_alloc+0x65>
cmpq   $0x0,-0x18(%rbp)
jne    118d <xfiredb_alloc+0x5d>
mov    0x2e68(%rip),%rax
mov    (%rax),%esi
lea    0xe7f(%rip),%rdi
call   1040 <fputs@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfiredb_alloc>:
push   %rax
test   %rdi,%rdi
je     1142 <xfiredb_alloc+0x12>
call   1050 <malloc@plt>
test   %rax,%rax
je     1146 <xfiredb_alloc+0x16>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e93(%rip),%rax
mov    (%rax),%esi
lea    0xeaa(%rip),%rdi
call   1040 <fputs@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Memory allocation failed!\0A\00"
@stderr = global i32 0
define i8* @xfiredb_alloc(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
%5 = load i64, i64* %3
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i64, i64* %3
%9 = call i8* @malloc(i64 %8)
store i8* %9, i8** %4
br label %11
10: ; preds = %1
store i8* null, i8** %2
br label %20
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = icmp ne i8* %12, null
br i1 %13, label %18, label %14
14: ; preds = %11
%15 = load i32, i32* @stderr
%16 = call i32 @fputs(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = call i32 (...) @abort()
unreachable
18: ; preds = %11
%19 = load i8*, i8** %4
store i8* %19, i8** %2
br label %20
20: ; preds = %18, %10
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
@.str = [27 x i8] c"Memory allocation failed!\0A\00"
@stderr = global i32 0
define noalias i8* @xfiredb_alloc(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i8* @malloc(i64 %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fputs(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %3, %1
%11 = phi i8* [ null, %1 ], [ %4, %3 ]
ret i8* %11
}
int fs450_set_tv_output(int output) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @fs450_set_tv_output(i32 %0) {
ret i32 0
}
void deallocateSpace(double **data, int size) {
  int row;
  for (row = 0; row < size; row++) {
    free(data[row]);
  }
  free(data);
  return;
}


x86 assembly (clang, -O0):
<deallocateSpace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <deallocateSpace+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <deallocateSpace+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deallocateSpace>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <deallocateSpace+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <deallocateSpace+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @deallocateSpace(double** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds double*, double** %0, i64 %7
%9 = bitcast double** %8 to i8**
%10 = load i8*, i8** %9
tail call void @free(i8* %10)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = bitcast double** %0 to i8*
tail call void @free(i8* %14)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ flush_input();
int /*<<< orphan*/ getch();
int /*<<< orphan*/ nodelay(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdscr;
void wait_for_key(int how_long) {
  sleep(how_long);
  flush_input();
  nodelay(stdscr, FALSE);
  getch();
}


x86 assembly (clang, -O0):
<wait_for_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <sleep@plt>
mov    $0x0,%al
call   1050 <flush_input@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
mov    0x2e6e(%rip),%rax
mov    (%rax),%esi
call   1030 <nodelay@plt>
mov    $0x0,%al
call   1040 <getch@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_for_key>:
push   %rax
call   1060 <sleep@plt>
xor    %eax,%eax
call   1050 <flush_input@plt>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
mov    0x2e7b(%rip),%rax
mov    (%rax),%esi
call   1030 <nodelay@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <getch@plt>

LLVM IR (-O0):
@stdscr = global i32 0
@FALSE = global i32 0
define void @wait_for_key(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @sleep(i32 %3)
%5 = call i32 (...) @flush_input()
%6 = load i32, i32* @stdscr
%7 = load i32, i32* @FALSE
%8 = call i32 @nodelay(i32 %6, i32 %7)
%9 = call i32 (...) @getch()
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@FALSE = global i32 0
define void @wait_for_key(i32 %0) {
%2 = tail call i32 @sleep(i32 %0)
%3 = tail call i32 (...) @flush_input()
%4 = load i32, i32* @stdscr
%5 = load i32, i32* @FALSE
%6 = tail call i32 @nodelay(i32 %4, i32 %5)
%7 = tail call i32 (...) @getch()
ret void
}
/* Type definitions */
struct item {
  int dummy;
};

/* Variables and functions */
struct item *create_data_item(char *, int);
struct item *create_data_item_from_char(char i) {
  return create_data_item(&i, (int)sizeof(char));
}


x86 assembly (clang, -O0):
<create_data_item_from_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    -0x1(%rbp),%rdi
mov    $0x1,%esi
call   1030 <create_data_item@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_data_item_from_char>:
push   %rax
mov    %dil,0x7(%rsp)
lea    0x7(%rsp),%rdi
mov    $0x1,%esi
call   1030 <create_data_item@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.item = type { i32 }
define %struct.item* @create_data_item_from_char(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call %struct.item* @create_data_item(i8* %2, i32 1)
ret %struct.item* %3
}

LLVM IR (-O2):
%struct.item = type { i32 }
define %struct.item* @create_data_item_from_char(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call %struct.item* @create_data_item(i8* %2, i32 1)
ret %struct.item* %3
}
void setup_signal_handlers() {}


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

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

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

LLVM IR (-O2):
define void @setup_signal_handlers() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isascii(int);
void t_isascii_0xb2() {
  Assert_real((isascii(178) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isascii.c",
              895, ("isascii should be 0 for 0xb2"));
}


x86 assembly (clang, -O0):
<t_isascii_0xb2>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb2,%edi
call   1030 <isascii@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x37f,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isascii_0xb2>:
push   %rax
mov    $0xb2,%edi
call   1030 <isascii@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x37f,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [29 x i8] c"isascii should be 0 for 0xb2\00"
define void @t_isascii_0xb2() {
%1 = call i64 @isascii(i32 178)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 895, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isascii.c\00"
@.str.1 = [29 x i8] c"isascii should be 0 for 0xb2\00"
define void @t_isascii_0xb2() {
%1 = tail call i64 @isascii(i32 178)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 895, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void foo751() {}


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

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

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

LLVM IR (-O2):
define void @foo751() {
ret void
}
char convert_from_32(unsigned long X, int bit) {
  char c = 0;
  return c;
}


x86 assembly (clang, -O0):
<convert_from_32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movb   $0x0,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define signext i8 @convert_from_32(i64 %0, i32 %1) {
ret i8 0
}
/* Variables and functions */
int errno;
int __get_errno(void) { return errno; }


x86 assembly (clang, -O0):
<__get_errno>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@errno = global i32 0
define i32 @__get_errno() {
%1 = load i32, i32* @errno
ret i32 %1
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @__get_errno() {
%1 = load i32, i32* @errno
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
void _wait(void) {
  for (;;) {
    sleep(60);
  }
}


x86 assembly (clang, -O0):
<_wait>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <_wait+0x9>
mov    $0x3c,%edi
call   1030 <sleep@plt>
jmp    1119 <_wait+0x9>

x86 assembly (clang, -O2):
<_wait>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x3c,%edi
call   1030 <sleep@plt>
jmp    1120 <_wait+0x10>

LLVM IR (-O0):
define void @_wait() {
br label %1
1: ; preds = %1, %0
%2 = call i32 @sleep(i32 60)
br label %1
}

LLVM IR (-O2):
define void @_wait() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @sleep(i32 60)
br label %1
}
/* Type definitions */
struct Cyc___cycFILE {
  int dummy;
};
struct Cyc_Interface_I {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ Cyc_Interface_parse(struct Cyc___cycFILE *);
struct Cyc_Interface_I *Cyc_Interface_load(struct Cyc___cycFILE *f) {
  return ({ Cyc_Interface_parse(f); });
}


x86 assembly (clang, -O0):
<Cyc_Interface_load>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <Cyc_Interface_parse@plt>
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_Interface_load>:
push   %rax
call   1030 <Cyc_Interface_parse@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
%struct.Cyc_Interface_I = type { i32 }
%struct.Cyc___cycFILE = type { i32 }
define %struct.Cyc_Interface_I* @Cyc_Interface_load(%struct.Cyc___cycFILE* %0) {
%2 = alloca %struct.Cyc___cycFILE*
%3 = alloca i32
store %struct.Cyc___cycFILE* %0, %struct.Cyc___cycFILE** %2
%4 = load %struct.Cyc___cycFILE*, %struct.Cyc___cycFILE** %2
%5 = call i32 @Cyc_Interface_parse(%struct.Cyc___cycFILE* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to %struct.Cyc_Interface_I*
ret %struct.Cyc_Interface_I* %8
}

LLVM IR (-O2):
%struct.Cyc_Interface_I = type { i32 }
%struct.Cyc___cycFILE = type { i32 }
define %struct.Cyc_Interface_I* @Cyc_Interface_load(%struct.Cyc___cycFILE* %0) {
%2 = tail call i32 @Cyc_Interface_parse(%struct.Cyc___cycFILE* %0)
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to %struct.Cyc_Interface_I*
ret %struct.Cyc_Interface_I* %4
}
/* Variables and functions */
int esp_sdio_init();
int rockchip_wifi_init_module_esp8089(void) { return esp_sdio_init(); }


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

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

LLVM IR (-O0):
define i32 @rockchip_wifi_init_module_esp8089() {
%1 = call i32 (...) @esp_sdio_init()
ret i32 %1
}

LLVM IR (-O2):
define i32 @rockchip_wifi_init_module_esp8089() {
%1 = tail call i32 (...) @esp_sdio_init()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ output(char *, int);
int /*<<< orphan*/ sscanf(char const *, char *, int *);
void print24DiskTotalInfo(const char *cmd) {
  int id;
  sscanf(cmd + 9, "%d", &id);
  output("Disk %d Total Load\t0\t0\tKB/s\n", id);
}


x86 assembly (clang, -O0):
<print24DiskTotalInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x9,%rdi
lea    0xec5(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <sscanf@plt>
mov    -0xc(%rbp),%esi
lea    0xeb5(%rip),%rdi
call   1030 <output@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print24DiskTotalInfo>:
push   %rax
add    $0x9,%rdi
lea    0xed4(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1040 <sscanf@plt>
mov    0x4(%rsp),%esi
lea    0xec2(%rip),%rdi
call   1030 <output@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [29 x i8] c"Disk %d Total Load\090\090\09KB/s\0A\00"
define void @print24DiskTotalInfo(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 9
%6 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = call i32 @output(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [29 x i8] c"Disk %d Total Load\090\090\09KB/s\0A\00"
define void @print24DiskTotalInfo(i8* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = getelementptr inbounds i8, i8* %0, i64 9
%5 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = call i32 @output(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret void
}
int choosePivot(int lo, int hi) { return ((hi - lo) / 2) + lo; }


x86 assembly (clang, -O0):
<choosePivot>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<choosePivot>:
sub    %edi,%esi
mov    %esi,%eax
shr    $0x1f,%eax
add    %esi,%eax
sar    %eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @choosePivot(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 = load i32, i32* %3
%7 = sub nsw i32 %5, %6
%8 = sdiv i32 %7, 2
%9 = load i32, i32* %3
%10 = add nsw i32 %8, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @choosePivot(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
%4 = sdiv i32 %3, 2
%5 = add nsw i32 %4, %0
ret i32 %5
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
int32_t _read(int32_t fd, char *ptr, int32_t len) {
  int32_t ret = 0;
  if (0 == len) {
    return 0;
  }
  return ret;
}


x86 assembly (clang, -O0):
<_read>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    1131 <_read+0x31>
movq   $0x0,-0x8(%rbp)
jmp    1139 <_read+0x39>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @_read(i64 %0, i8* nocapture readnone %1, i64 %2) {
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
int main() {
  foo(42);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2a,%edi
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 42)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 42)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ tprintf(char *, double, double, double);
void putCirclePicture(double cx, double cy, double r) {
  tprintf("\\put(%3.4f,%3.4f){\\circle{%3.4f}}\n", cx, cy, r);
}


x86 assembly (clang, -O0):
<putCirclePicture>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
lea    0xec3(%rip),%rdi
call   1030 <tprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [35 x i8] c"\\put(%3.4f,%3.4f){\\circle{%3.4f}}\0A\00"
define void @putCirclePicture(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = load double, double* %6
%10 = call i32 @tprintf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), double %7, double %8, double %9)
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"\\put(%3.4f,%3.4f){\\circle{%3.4f}}\0A\00"
define void @putCirclePicture(double %0, double %1, double %2) {
%4 = tail call i32 @tprintf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), double %0, double %1, double %2)
ret void
}
void clearMonsterFlashes() {}


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

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

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

LLVM IR (-O2):
define void @clearMonsterFlashes() {
ret void
}
char *tolower_str(str)
char *str;
{
  static char temp_str[256];
  char *ptr;
  strcpy(temp_str, str);
  ptr = temp_str;
  while (*ptr = (char)tolower((int)*ptr))
    ptr++;
  return (temp_str);
}


x86 assembly (clang, -O0):
<tolower_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0x2f09(%rip),%rdi
call   1030 <strcpy@plt>
lea    0x2efd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <tolower@plt>
mov    -0x10(%rbp),%rcx
mov    %al,(%rcx)
cmp    $0x0,%al
je     1172 <tolower_str+0x52>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1147 <tolower_str+0x27>
lea    0x2ec7(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tolower_str>:
push   %rbx
mov    %rdi,%rsi
lea    0x2f15(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%rbx),%edi
call   1040 <tolower@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
test   %al,%al
jne    1140 <tolower_str+0x20>
lea    0x2ee7(%rip),%rax
pop    %rbx
ret

LLVM IR (-O0):
@tolower_str.temp_str = internal global [256 x i8] zeroinitializer
define i8* @tolower_str(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strcpy(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @tolower_str.temp_str, i64 0, i64 0), i8* %4)
store i8* getelementptr inbounds ([256 x i8], [256 x i8]* @tolower_str.temp_str, i64 0, i64 0), i8** %3
br label %6
6: ; preds = %14, %1
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = call i32 @tolower(i32 %9)
%11 = trunc i32 %10 to i8
%12 = load i8*, i8** %3
store i8 %11, i8* %12
%13 = icmp ne i8 %11, 0
br i1 %13, label %14, label %17
14: ; preds = %6
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %3
br label %6
17: ; preds = %6
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @tolower_str.temp_str, i64 0, i64 0)
}

LLVM IR (-O2):
@tolower_str.temp_str = internal global [256 x i8] zeroinitializer
define i8* @tolower_str(i8* nocapture %0) {
%2 = tail call i8* @strcpy(i8* dereferenceable(1) getelementptr inbounds ([256 x i8], [256 x i8]* @tolower_str.temp_str, i64 0, i64 0), i8* dereferenceable(1) %0)
br label %3
3: ; preds = %3, %1
%4 = phi i8* [ getelementptr inbounds ([256 x i8], [256 x i8]* @tolower_str.temp_str, i64 0, i64 0), %1 ], [ %10, %3 ]
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = tail call i32 @tolower(i32 %6)
%8 = trunc i32 %7 to i8
store i8 %8, i8* %4
%9 = icmp eq i8 %8, 0
%10 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %9, label %11, label %3
11: ; preds = %3
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @tolower_str.temp_str, i64 0, i64 0)
}
int test_imm_B1int64_midword_reg(long long val) {
  return ((val >> 16) & (0xB1 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_B1int64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x10,%rdx
and    $0xb1,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_B1int64_midword_reg>:
test   $0xb10000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_B1int64_midword_reg(i64 %0) {
%2 = and i64 %0, 11599872
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
long double tanl(long double);
__attribute__((__weak__, __always___)) long double
softboundcets_tanl(long double x) {
  return tanl(x);
}


x86 assembly (clang, -O0):
<softboundcets_tanl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <tanl@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<softboundcets_tanl>:
jmp    1030 <tanl@plt>

LLVM IR (-O0):
define weak x86_fp80 @softboundcets_tanl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call x86_fp80 @tanl(x86_fp80 %3)
ret x86_fp80 %4
}

LLVM IR (-O2):
define weak x86_fp80 @softboundcets_tanl(x86_fp80 %0) {
%2 = tail call x86_fp80 @tanl(x86_fp80 %0)
ret x86_fp80 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int getpid();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
extern void child_code(int delay) {
  printf("child %d here, will sleep for %d seconds\n", getpid(), delay);
  sleep(delay);
  printf("child done, about to exit\n");
  exit(17);
}


x86 assembly (clang, -O0):
<child_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
mov    -0x4(%rbp),%edx
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1060 <sleep@plt>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x11,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<child_code>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xe9f(%rip),%rdi
mov    %eax,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%edi
call   1070 <sleep@plt>
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
mov    $0x11,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"child %d here, will sleep for %d seconds\0A\00"
@.str.1 = [27 x i8] c"child done, about to exit\0A\00"
define void @child_code(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @getpid()
%4 = load i32, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
%6 = load i32, i32* %2
%7 = call i32 @sleep(i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @exit(i32 17)
unreachable
}

LLVM IR (-O2):
@.str = [42 x i8] c"child %d here, will sleep for %d seconds\0A\00"
@str = [26 x i8] c"child done, about to exit\00"
define void @child_code(i32 %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %0)
%4 = tail call i32 @sleep(i32 %0)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 17)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(void) {
  int p;
  if (p)
    puts("p is true");
  if (!p)
    puts("p is false");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1135 <main+0x25>
lea    0xed0(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,-0x8(%rbp)
jne    114b <main+0x3b>
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"p is true\00"
@.str.1 = [11 x i8] c"p is false\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = call i32 @puts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [11 x i8] c"p is false\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
uint64_t test0(uint64_t x, uint64_t y) { return x + y; }


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

x86 assembly (clang, -O2):
<test0>:
lea    (%rdi,%rsi,1),%rax
ret

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

LLVM IR (-O2):
define i64 @test0(i64 %0, i64 %1) {
%3 = add nsw i64 %1, %0
ret i64 %3
}
void call_func(void (*sel)(void)) { sel(); }


x86 assembly (clang, -O0):
<call_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
call   *-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_func>:
jmp    *%rdi

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

LLVM IR (-O2):
define void @call_func(void ()* nocapture %0) {
tail call void %0()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gds_swap2bytes(unsigned char *);
int /*<<< orphan*/ write(int, short *, int);
void gds_write_endel(int fd) {
  static short int count, token;
  count = 4;
  gds_swap2bytes((unsigned char *)&count);
  write(fd, &count, 2);
  token = 0x1100;
  gds_swap2bytes((unsigned char *)&token);
  write(fd, &token, 2);
}


x86 assembly (clang, -O0):
<gds_write_endel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movw   $0x4,0x2efe(%rip)
lea    0x2ef7(%rip),%rdi
call   1040 <gds_swap2bytes@plt>
mov    -0x4(%rbp),%edi
lea    0x2ee8(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
movw   $0x1100,0x2ed7(%rip)
lea    0x2ed0(%rip),%rdi
call   1040 <gds_swap2bytes@plt>
mov    -0x4(%rbp),%edi
lea    0x2ec1(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gds_write_endel>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
movw   $0x4,0x2f03(%rip)
lea    0x2efc(%rip),%r14
mov    %r14,%rdi
call   1040 <gds_swap2bytes@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x2,%edx
call   1030 <write@plt>
movw   $0x1100,0x2ede(%rip)
lea    0x2ed7(%rip),%r14
mov    %r14,%rdi
call   1040 <gds_swap2bytes@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x2,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <write@plt>

LLVM IR (-O0):
@gds_write_endel.count = internal global i16 0
@gds_write_endel.token = internal global i16 0
define void @gds_write_endel(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
store i16 4, i16* @gds_write_endel.count
%3 = call i32 @gds_swap2bytes(i8* bitcast (i16* @gds_write_endel.count to i8*))
%4 = load i32, i32* %2
%5 = call i32 @write(i32 %4, i16* @gds_write_endel.count, i32 2)
store i16 4352, i16* @gds_write_endel.token
%6 = call i32 @gds_swap2bytes(i8* bitcast (i16* @gds_write_endel.token to i8*))
%7 = load i32, i32* %2
%8 = call i32 @write(i32 %7, i16* @gds_write_endel.token, i32 2)
ret void
}

LLVM IR (-O2):
@gds_write_endel.count = internal global i16 0
@gds_write_endel.token = internal global i16 0
define void @gds_write_endel(i32 %0) {
store i16 4, i16* @gds_write_endel.count
%2 = tail call i32 @gds_swap2bytes(i8* bitcast (i16* @gds_write_endel.count to i8*))
%3 = tail call i32 @write(i32 %0, i16* @gds_write_endel.count, i32 2)
store i16 4352, i16* @gds_write_endel.token
%4 = tail call i32 @gds_swap2bytes(i8* bitcast (i16* @gds_write_endel.token to i8*))
%5 = tail call i32 @write(i32 %0, i16* @gds_write_endel.token, i32 2)
ret void
}