xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ bar(double *);
double foo(double x) {
  double xxx = x + 13.0;
  bar(&xxx);
  return xxx;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <bar@plt>
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
addsd  0xee7(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    %rsp,%rdi
call   1030 <bar@plt>
movsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @foo(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fadd double %4, 1.300000e+01
store double %5, double* %3
%6 = call i32 @bar(double* %3)
%7 = load double, double* %3
ret double %7
}

LLVM IR (-O2):
define double @foo(double %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
%4 = fadd double %0, 1.300000e+01
store double %4, double* %2
%5 = call i32 @bar(double* %2)
%6 = load double, double* %2
ret double %6
}
int is42(int x) { return x == 42; }


x86 assembly (clang, -O0):
<is42>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x2a,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is42>:
xor    %eax,%eax
cmp    $0x2a,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @is42(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 42
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @is42(i32 %0) {
%2 = icmp eq i32 %0, 42
%3 = zext i1 %2 to i32
ret i32 %3
}
int test_imm_CFint8_reg(signed char val) {
  return ((val) & (-0xCF << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_CFint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffff31,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_CFint8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -207
%6 = icmp ne i32 %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_CFint8_reg(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = and i32 %2, -207
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void gencfc1() {}


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

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

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

LLVM IR (-O2):
define void @gencfc1() {
ret void
}
/* Type definitions */
struct ifreq {
  int ifr_ifindex;
};

/* Variables and functions */
int /*<<< orphan*/ SIOCGIFINDEX;
int /*<<< orphan*/ die(int /*<<< orphan*/);
int /*<<< orphan*/ errno;
int ioctl(int, int /*<<< orphan*/, struct ifreq *);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
int get_ifr_ifindex(int fd, struct ifreq *ifr) {
  if (ioctl(fd, SIOCGIFINDEX, ifr) == -1) {
    die(strerror(errno));
  }
  return ifr->ifr_ifindex;
}


x86 assembly (clang, -O0):
<get_ifr_ifindex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e87(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0xffffffff,%eax
jne    1172 <get_ifr_ifindex+0x42>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %eax,%edi
call   1040 <die@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ifr_ifindex>:
push   %rbx
mov    %rsi,%rbx
mov    0x2e95(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdx
call   1030 <ioctl@plt>
cmp    $0xffffffff,%eax
jne    115f <get_ifr_ifindex+0x2f>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %eax,%edi
call   1040 <die@plt>
mov    (%rbx),%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.ifreq = type { i32 }
@SIOCGIFINDEX = global i32 0
@errno = global i32 0
define i32 @get_ifr_ifindex(i32 %0, %struct.ifreq* %1) {
%3 = alloca i32
%4 = alloca %struct.ifreq*
store i32 %0, i32* %3
store %struct.ifreq* %1, %struct.ifreq** %4
%5 = load i32, i32* %3
%6 = load i32, i32* @SIOCGIFINDEX
%7 = load %struct.ifreq*, %struct.ifreq** %4
%8 = call i32 @ioctl(i32 %5, i32 %6, %struct.ifreq* %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i32, i32* @errno
%12 = call i32 @strerror(i32 %11)
%13 = call i32 @die(i32 %12)
br label %14
14: ; preds = %10, %2
%15 = load %struct.ifreq*, %struct.ifreq** %4
%16 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %15, i32 0, i32 0
%17 = load i32, i32* %16
ret i32 %17
}

LLVM IR (-O2):
%struct.ifreq = type { i32 }
@SIOCGIFINDEX = global i32 0
@errno = global i32 0
define i32 @get_ifr_ifindex(i32 %0, %struct.ifreq* %1) {
%3 = load i32, i32* @SIOCGIFINDEX
%4 = tail call i32 @ioctl(i32 %0, i32 %3, %struct.ifreq* %1)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* @errno
%8 = tail call i32 @strerror(i32 %7)
%9 = tail call i32 @die(i32 %8)
br label %10
10: ; preds = %6, %2
%11 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %1, i64 0, i32 0
%12 = load i32, i32* %11
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ stderr;
float *matrix_alloc() {
  float *p;
  p = (float *)malloc(8 * 8 * sizeof(float));
  if (p == NULL) {
    fprintf(stderr, "I cannot reserve host memory for the matrix.\n");
    exit(EXIT_FAILURE);
  }
  return p;
}


x86 assembly (clang, -O0):
<matrix_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x100,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1174 <matrix_alloc+0x44>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<matrix_alloc>:
push   %rax
mov    $0x100,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1142 <matrix_alloc+0x12>
pop    %rcx
ret
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xeae(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [46 x i8] c"I cannot reserve host memory for the matrix.\0A\00"
@EXIT_FAILURE = global i32 0
define float* @matrix_alloc() {
%1 = alloca float*
%2 = call i64 @malloc(i32 256)
%3 = inttoptr i64 %2 to float*
store float* %3, float** %1
%4 = load float*, float** %1
%5 = icmp eq float* %4, null
br i1 %5, label %6, label %11
6: ; preds = %0
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %0
%12 = load float*, float** %1
ret float* %12
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [46 x i8] c"I cannot reserve host memory for the matrix.\0A\00"
@EXIT_FAILURE = global i32 0
define float* @matrix_alloc() {
%1 = tail call i64 @malloc(i32 256)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %0
%9 = inttoptr i64 %1 to float*
ret float* %9
}
/* Variables and functions */
int atoi(char *);
int do_int(int *dest, int argc, char **argv) {
  if (argc < 2)
    return -1;
  *dest = atoi(argv[1]);
  return 0;
}


x86 assembly (clang, -O0):
<do_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    1139 <do_int+0x29>
movl   $0xffffffff,-0x4(%rbp)
jmp    1155 <do_int+0x45>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atoi@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_int>:
mov    $0xffffffff,%eax
cmp    $0x2,%esi
jl     112c <do_int+0x1c>
push   %rbx
mov    %rdi,%rbx
mov    0x8(%rdx),%rdi
call   1030 <atoi@plt>
mov    %eax,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @do_int(i32* nocapture writeonly %0, i32 %1, i8** nocapture %2) {
%4 = icmp slt i32 %1, 2
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = getelementptr inbounds i8*, i8** %2, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @atoi(i8* %7)
store i32 %8, i32* %0
br label %9
9: ; preds = %3, %5
%10 = phi i32 [ 0, %5 ], [ -1, %3 ]
ret i32 %10
}
/* Type definitions */
struct group {
  char *gr_name;
};
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
struct group *getgrgid(int /*<<< orphan*/);
char *gid_name(gid_t gid) {
  struct group *gr = getgrgid(gid);
  return gr ? gr->gr_name : NULL;
}


x86 assembly (clang, -O0):
<gid_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <getgrgid@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1142 <gid_name+0x32>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    114d <gid_name+0x3d>
xor    %eax,%eax
mov    %rax,-0x18(%rbp)
jmp    114d <gid_name+0x3d>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gid_name>:
push   %rax
call   1030 <getgrgid@plt>
test   %rax,%rax
je     1120 <gid_name+0x10>
mov    (%rax),%rax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.group = type { i8* }
define i8* @gid_name(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.group*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call %struct.group* @getgrgid(i32 %4)
store %struct.group* %5, %struct.group** %3
%6 = load %struct.group*, %struct.group** %3
%7 = icmp ne %struct.group* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load %struct.group*, %struct.group** %3
%10 = getelementptr inbounds %struct.group, %struct.group* %9, i32 0, i32 0
%11 = load i8*, i8** %10
br label %13
12: ; preds = %1
br label %13
13: ; preds = %12, %8
%14 = phi i8* [ %11, %8 ], [ null, %12 ]
ret i8* %14
}

LLVM IR (-O2):
%struct.group = type { i8* }
define i8* @gid_name(i32 %0) {
%2 = tail call %struct.group* @getgrgid(i32 %0)
%3 = icmp eq %struct.group* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = getelementptr inbounds %struct.group, %struct.group* %2, i64 0, i32 0
%6 = load i8*, i8** %5
br label %7
7: ; preds = %1, %4
%8 = phi i8* [ %6, %4 ], [ null, %1 ]
ret i8* %8
}
int dummy_func() { return 42; }


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

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

LLVM IR (-O0):
define i32 @dummy_func() {
ret i32 42
}

LLVM IR (-O2):
define i32 @dummy_func() {
ret i32 42
}
void fd85(int n) {
a : {
  typedef int(*b)[n];
P01A:
  goto P01A;
  {
    typedef int(*c)[n];
  P012A:
    goto P012A;
    0;
  }
P01B:
  goto P01B;
  {
    typedef int(*d)[n];
  P013A:
    goto P013A;
    0;
  }
p01C:
  goto p01C;
  goto a;
P01C:
  goto P01C;
  ;
  typedef int(*e)[n];
P014A:
  goto P014A;
  0;
};
P0B:
  goto P0B;
  {
    typedef int(*f)[n];
  P02A:
    goto P02A;
    {
      typedef int(*g)[n];
    P024A:
      goto P024A;
      0;
    };
  P02B:
    goto P02B;
    {
      typedef int(*h)[n];
    P025A:
      goto P025A;
      0;
    };
  P02C:
    goto P02C;
    ;
    typedef int(*i)[n];
  P026A:
    goto P026A;
    0;
  };
P0C:
  goto P0C;
  ;
  typedef int(*j)[n];
P03A:
  goto P03A;
  0;
P03B:
  goto P03B;
}


x86 assembly (clang, -O0):
<fd85>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    1107 <fd85+0x7>

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

LLVM IR (-O0):
define void @fd85(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1
%4 = load i32, i32* %2
%5 = zext i32 %4 to i64
br label %6
6: ; preds = %6, %3
br label %6
7: ; No predecessors!
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
br label %10
10: ; preds = %10, %7
br label %10
11: ; preds = %11
br label %11
12: ; No predecessors!
%13 = load i32, i32* %2
%14 = zext i32 %13 to i64
br label %15
15: ; preds = %15, %12
br label %15
16: ; preds = %16
br label %16
17: ; preds = %17
br label %17
18: ; No predecessors!
%19 = load i32, i32* %2
%20 = zext i32 %19 to i64
br label %21
21: ; preds = %21, %18
br label %21
22: ; preds = %22
br label %22
23: ; No predecessors!
%24 = load i32, i32* %2
%25 = zext i32 %24 to i64
br label %26
26: ; preds = %26, %23
br label %26
27: ; No predecessors!
%28 = load i32, i32* %2
%29 = zext i32 %28 to i64
br label %30
30: ; preds = %30, %27
br label %30
31: ; preds = %31
br label %31
32: ; No predecessors!
%33 = load i32, i32* %2
%34 = zext i32 %33 to i64
br label %35
35: ; preds = %35, %32
br label %35
36: ; preds = %36
br label %36
37: ; No predecessors!
%38 = load i32, i32* %2
%39 = zext i32 %38 to i64
br label %40
40: ; preds = %40, %37
br label %40
41: ; preds = %41
br label %41
42: ; No predecessors!
%43 = load i32, i32* %2
%44 = zext i32 %43 to i64
br label %45
45: ; preds = %45, %42
br label %45
46: ; preds = %46
br label %46
}

LLVM IR (-O2):
define void @fd85(i32 %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ expand(char *, char *);
int /*<<< orphan*/ mgetline(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char s1[100], s2[100];
  mgetline(s1, 100);
  expand(s1, s2);
  printf("%s", s2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
mov    $0x64,%esi
call   1040 <mgetline@plt>
lea    -0x70(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
call   1050 <expand@plt>
lea    -0xe0(%rbp),%rsi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xd8,%rsp
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x64,%esi
call   1040 <mgetline@plt>
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <expand@plt>
lea    0xe9f(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
store i32 0, i32* %1
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @mgetline(i8* %4, i32 100)
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%8 = call i32 @expand(i8* %6, i8* %7)
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @mgetline(i8* %3, i32 100)
%6 = call i32 @expand(i8* %3, i8* %4)
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
int track_bbox_top(int ch, int i) {}


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

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

LLVM IR (-O0):
define i32 @track_bbox_top(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* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @track_bbox_top(i32 %0, i32 %1) {
ret i32 undef
}
int get_elf_endian(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @get_elf_endian() {
ret i32 1
}

LLVM IR (-O2):
define i32 @get_elf_endian() {
ret i32 1
}
void bprg_free(struct bprg_ctx *ctx) {}


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

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

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

LLVM IR (-O2):
%struct.bprg_ctx = type opaque
define void @bprg_free(%struct.bprg_ctx* nocapture %0) {
ret void
}
/* Variables and functions */
double round(double);
long long duration_get(long long on, long long off) {
  long long duration;
  double d;
  d = (float)(on - off);
  d *= (3 / 8.0);
  d = round(d);
  return ((long long)d);
}


x86 assembly (clang, -O0):
<duration_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
sub    -0x10(%rbp),%rax
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xec2(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <round@plt>
movsd  %xmm0,-0x20(%rbp)
cvttsd2si -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<duration_get>:
push   %rax
sub    %rsi,%rdi
cvtsi2ss %rdi,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xedb(%rip),%xmm0
call   1030 <round@plt>
cvttsd2si %xmm0,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @duration_get(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca double
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = load i64, i64* %4
%9 = sub nsw i64 %7, %8
%10 = sitofp i64 %9 to float
%11 = fpext float %10 to double
store double %11, double* %6
%12 = load double, double* %6
%13 = fmul double %12, 3.750000e-01
store double %13, double* %6
%14 = load double, double* %6
%15 = call double @llvm.round.f64(double %14)
store double %15, double* %6
%16 = load double, double* %6
%17 = fptosi double %16 to i64
ret i64 %17
}

LLVM IR (-O2):
define i64 @duration_get(i64 %0, i64 %1) {
%3 = sub nsw i64 %0, %1
%4 = sitofp i64 %3 to float
%5 = fpext float %4 to double
%6 = fmul double %5, 3.750000e-01
%7 = tail call double @llvm.round.f64(double %6)
%8 = fptosi double %7 to i64
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  if (argc != 2) {
    printf("\33[?25l");
  } else {
    printf("\33[?25h");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1141 <main+0x31>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
jmp    114d <main+0x3d>
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
lea    0xeec(%rip),%rax
lea    0xede(%rip),%rdi
cmove  %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"\1B[?25l\00"
@.str.1 = [7 x i8] c"\1B[?25h\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp eq i32 %0, 2
%4 = select i1 %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
%5 = tail call i32 @printf(i8* dereferenceable(1) %4)
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int UINT32_MAX;
uint32_t prefix_len_to_subnet_mask(int prefix_len) {
  uint32_t netmask = UINT32_MAX;
  netmask <<= 32 - prefix_len;
  return netmask;
}


x86 assembly (clang, -O0):
<prefix_len_to_subnet_mask>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2eea(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    $0x20,%ecx
sub    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%eax
shl    %cl,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<prefix_len_to_subnet_mask>:
mov    %edi,%ecx
mov    0x2eef(%rip),%rax
mov    (%rax),%eax
neg    %cl
shl    %cl,%eax
ret

LLVM IR (-O0):
@UINT32_MAX = global i32 0
define i32 @prefix_len_to_subnet_mask(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* @UINT32_MAX
store i32 %4, i32* %3
%5 = load i32, i32* %2
%6 = sub nsw i32 32, %5
%7 = load i32, i32* %3
%8 = shl i32 %7, %6
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
@UINT32_MAX = global i32 0
define i32 @prefix_len_to_subnet_mask(i32 %0) {
%2 = load i32, i32* @UINT32_MAX
%3 = sub nsw i32 32, %0
%4 = shl i32 %2, %3
ret i32 %4
}
extern double s1s2d1(float s1, float s2, double d1) { return s1 + s2 + d1; }


x86 assembly (clang, -O0):
<s1s2d1>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movsd  %xmm2,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<s1s2d1>:
addss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
addsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @s1s2d1(float %0, float %1, double %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca double
store float %0, float* %4
store float %1, float* %5
store double %2, double* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = fadd float %7, %8
%10 = fpext float %9 to double
%11 = load double, double* %6
%12 = fadd double %10, %11
ret double %12
}

LLVM IR (-O2):
define double @s1s2d1(float %0, float %1, double %2) {
%4 = fadd float %0, %1
%5 = fpext float %4 to double
%6 = fadd double %5, %2
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ Merge(int *, int, int, int);
void MergeSort(int A[], int p, int q) {
  if (p < q) {
    int m = (p + q) / 2;
    MergeSort(A, p, m);
    MergeSort(A, m + 1, q);
    Merge(A, p, m, q);
  }
}


x86 assembly (clang, -O0):
<MergeSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1182 <MergeSort+0x62>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <MergeSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <MergeSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1030 <Merge@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MergeSort>:
cmp    %edx,%esi
jge    1172 <MergeSort+0x52>
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r12d
mov    %rdi,%r15
lea    (%r14,%r12,1),%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
mov    %ebx,%edx
call   1040 <MergeSort@plt>
lea    0x1(%rbx),%esi
mov    %r15,%rdi
mov    %r14d,%edx
call   1040 <MergeSort@plt>
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <Merge@plt>
ret

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

LLVM IR (-O2):
define void @MergeSort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %6, label %5
5: ; preds = %3, %6
ret void
6: ; preds = %3
%7 = add nsw i32 %2, %1
%8 = sdiv i32 %7, 2
tail call void @MergeSort(i32* %0, i32 %1, i32 %8)
%9 = add nsw i32 %8, 1
tail call void @MergeSort(i32* %0, i32 %9, i32 %2)
%10 = tail call i32 @Merge(i32* %0, i32 %1, i32 %8, i32 %2)
br label %5
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
int getascii(char *block, char *s, int off, int max) {
  memcpy(s, block + off, max);
  s[max] = 0;
  return max;
}


x86 assembly (clang, -O0):
<getascii>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x14(%rbp),%rax
add    %rax,%rsi
mov    -0x18(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @getascii(i8* %0, i8* %1, i32 %2, i32 returned %3) {
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = tail call i32 @memcpy(i8* %1, i8* %6, i32 %3)
%8 = sext i32 %3 to i64
%9 = getelementptr inbounds i8, i8* %1, i64 %8
store i8 0, i8* %9
ret i32 %3
}
/* Variables and functions */
int partition(int, int);
void quickSort(int l, int r) {
  int j;
  if (l < r) {
    j = partition(l, r);
    quickSort(l, j - 1);
    quickSort(j + 1, r);
  }
}


x86 assembly (clang, -O0):
<quickSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1164 <quickSort+0x44>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <partition@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1040 <quickSort@plt>
mov    -0xc(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
call   1040 <quickSort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quickSort>:
push   %rbp
push   %r14
push   %rbx
cmp    %esi,%edi
jge    1150 <quickSort+0x30>
mov    %esi,%r14d
mov    %edi,%ebp
nopl   (%rax)
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%esi
mov    %ebp,%edi
call   1040 <quickSort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1130 <quickSort+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @quickSort(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 = icmp slt i32 %6, %7
br i1 %8, label %9, label %19
9: ; preds = %2
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call i32 @partition(i32 %10, i32 %11)
store i32 %12, i32* %5
%13 = load i32, i32* %3
%14 = load i32, i32* %5
%15 = sub nsw i32 %14, 1
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
%18 = load i32, i32* %4
br label %19
19: ; preds = %9, %2
ret void
}

LLVM IR (-O2):
define void @quickSort(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
br i1 %3, label %4, label %10
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ %0, %2 ]
%6 = tail call i32 @partition(i32 %5, i32 %1)
%7 = add nsw i32 %6, -1
tail call void @quickSort(i32 %5, i32 %7)
%8 = add nsw i32 %6, 1
%9 = icmp slt i32 %8, %1
br i1 %9, label %4, label %10
10: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_io_bit(int, int);
void TOSH_SET_PW4_PIN() { set_io_bit(0x40, 4); }


x86 assembly (clang, -O0):
<TOSH_SET_PW4_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40,%edi
mov    $0x4,%esi
call   1030 <set_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_SET_PW4_PIN>:
mov    $0x40,%edi
mov    $0x4,%esi
jmp    1030 <set_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_SET_PW4_PIN() {
%1 = call i32 @set_io_bit(i32 64, i32 4)
ret void
}

LLVM IR (-O2):
define void @TOSH_SET_PW4_PIN() {
%1 = tail call i32 @set_io_bit(i32 64, i32 4)
ret void
}
long get_grid_index_single_mesh(const long address[3], const long mesh[3]) {
  return (address[2] * mesh[0] * (long)(mesh[1]) + address[1] * mesh[0] +
          address[0]);
}


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

x86 assembly (clang, -O2):
<get_grid_index_single_mesh>:
mov    0x8(%rsi),%rax
imul   0x10(%rdi),%rax
add    0x8(%rdi),%rax
imul   (%rsi),%rax
add    (%rdi),%rax
ret

LLVM IR (-O0):
define i64 @get_grid_index_single_mesh(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 = getelementptr inbounds i64, i64* %5, i64 2
%7 = load i64, i64* %6
%8 = load i64*, i64** %4
%9 = getelementptr inbounds i64, i64* %8, i64 0
%10 = load i64, i64* %9
%11 = mul nsw i64 %7, %10
%12 = load i64*, i64** %4
%13 = getelementptr inbounds i64, i64* %12, i64 1
%14 = load i64, i64* %13
%15 = mul nsw i64 %11, %14
%16 = load i64*, i64** %3
%17 = getelementptr inbounds i64, i64* %16, i64 1
%18 = load i64, i64* %17
%19 = load i64*, i64** %4
%20 = getelementptr inbounds i64, i64* %19, i64 0
%21 = load i64, i64* %20
%22 = mul nsw i64 %18, %21
%23 = add nsw i64 %15, %22
%24 = load i64*, i64** %3
%25 = getelementptr inbounds i64, i64* %24, i64 0
%26 = load i64, i64* %25
%27 = add nsw i64 %23, %26
ret i64 %27
}

LLVM IR (-O2):
define i64 @get_grid_index_single_mesh(i64* nocapture %0, i64* nocapture %1) {
%3 = getelementptr inbounds i64, i64* %0, i64 2
%4 = load i64, i64* %3
%5 = load i64, i64* %1
%6 = getelementptr inbounds i64, i64* %1, i64 1
%7 = load i64, i64* %6
%8 = mul i64 %7, %4
%9 = getelementptr inbounds i64, i64* %0, i64 1
%10 = load i64, i64* %9
%11 = load i64, i64* %0
%12 = add i64 %10, %8
%13 = mul i64 %12, %5
%14 = add i64 %13, %11
ret i64 %14
}
int main(void) {
  __asm__ __volatile__("mov $0x1918632, %eax\n\t"
                       "shr $0x10, %eax\n\t"
                       "add $0x913, %eax\n\t"
                       "and $0x1fff, %eax\n\t"
                       "mov %eax, %ecx\n\t"
                       "mov $0x10000, %ecx\n\t"
                       "mov $0x1918632, %eax\n\t"
                       "and $0x600, %ecx\n\t"
                       "mov $0x800, %ecx\n\t");
  printf("deadcode sample bin.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1918632,%eax
shr    $0x10,%eax
add    $0x913,%eax
and    $0x1fff,%eax
mov    %eax,%ecx
mov    $0x10000,%ecx
mov    $0x1918632,%eax
and    $0x600,%ecx
mov    $0x800,%ecx
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1918632,%eax
shr    $0x10,%eax
add    $0x913,%eax
and    $0x1fff,%eax
mov    %eax,%ecx
mov    $0x10000,%ecx
mov    $0x1918632,%eax
and    $0x600,%ecx
mov    $0x800,%ecx
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"deadcode sample bin.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [21 x i8] c"deadcode sample bin.\00"
define i32 @main() {
tail call void asm sideeffect "mov $$0x1918632, %eax\0A\09shr $$0x10, %eax\0A\09add $$0x913, %eax\0A\09and $$0x1fff, %eax\0A\09mov %eax, %ecx\0A\09mov $$0x10000, %ecx\0A\09mov $$0x1918632, %eax\0A\09and $$0x600, %ecx\0A\09mov $$0x800, %ecx\0A\09", "~{dirflag},~{fpsr},~{flags}"()
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ AES_KEY;

/* Variables and functions */
int OAES_SET_DECRYPT_KEY(unsigned char const *, int const,
                         int /*<<< orphan*/ *);
int hash_proto_aes_set_decrypt_key(const unsigned char *userKey, const int bits,
                                   AES_KEY *key) {
  return OAES_SET_DECRYPT_KEY(userKey, bits, key);
}


x86 assembly (clang, -O0):
<hash_proto_aes_set_decrypt_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <OAES_SET_DECRYPT_KEY@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_proto_aes_set_decrypt_key>:
jmp    1030 <OAES_SET_DECRYPT_KEY@plt>

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

LLVM IR (-O2):
define i32 @hash_proto_aes_set_decrypt_key(i8* %0, i32 %1, i32* %2) {
%4 = tail call i32 @OAES_SET_DECRYPT_KEY(i8* %0, i32 %1, i32* %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void clear_screen() { system("clear"); }


x86 assembly (clang, -O0):
<clear_screen>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <system@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
define void @clear_screen() {
%1 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
define void @clear_screen() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isodigit(int);
void t_isodigit_0x80() {
  Assert_real((isodigit(128) == 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_isodigit.c",
              645, ("isodigit should be 0 for 0x80"));
}


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

x86 assembly (clang, -O2):
<t_isodigit_0x80>:
push   %rax
mov    $0x80,%edi
call   1040 <isodigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x285,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 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_isodigit.c\00"
@.str.1 = [30 x i8] c"isodigit should be 0 for 0x80\00"
define void @t_isodigit_0x80() {
%1 = call i64 @isodigit(i32 128)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 645, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 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_isodigit.c\00"
@.str.1 = [30 x i8] c"isodigit should be 0 for 0x80\00"
define void @t_isodigit_0x80() {
%1 = tail call i64 @isodigit(i32 128)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 645, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void __both2(void) {}


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

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

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

LLVM IR (-O2):
define void @__both2() {
ret void
}
/* Variables and functions */
int rand();
int main(int argc, char **argv) {
  int x;
  int i;
  for (i = 0; i < 10; i++) {
    x = rand();
  }
  return x;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jge    114f <main+0x3f>
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112d <main+0x1d>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
xor    %eax,%eax
call   1030 <rand@plt>
xor    %eax,%eax
call   1030 <rand@plt>
xor    %eax,%eax
call   1030 <rand@plt>
xor    %eax,%eax
call   1030 <rand@plt>
xor    %eax,%eax
call   1030 <rand@plt>
xor    %eax,%eax
call   1030 <rand@plt>
xor    %eax,%eax
call   1030 <rand@plt>
xor    %eax,%eax
call   1030 <rand@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <rand@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %8
8: ; preds = %13, %2
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = call i32 (...) @rand()
store i32 %12, i32* %6
br label %13
13: ; preds = %11
%14 = load i32, i32* %7
%15 = add nsw i32 %14, 1
store i32 %15, i32* %7
br label %8
16: ; preds = %8
%17 = load i32, i32* %6
ret i32 %17
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @rand()
%4 = tail call i32 (...) @rand()
%5 = tail call i32 (...) @rand()
%6 = tail call i32 (...) @rand()
%7 = tail call i32 (...) @rand()
%8 = tail call i32 (...) @rand()
%9 = tail call i32 (...) @rand()
%10 = tail call i32 (...) @rand()
%11 = tail call i32 (...) @rand()
%12 = tail call i32 (...) @rand()
ret i32 %12
}
unsigned long convert_timer_to_ms(unsigned long ticks) { return ticks / 24; }


x86 assembly (clang, -O0):
<convert_timer_to_ms>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x18,%ecx
xor    %edx,%edx
div    %rcx
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_timer_to_ms>:
mov    %rdi,%rax
movabs $0xaaaaaaaaaaaaaaab,%rcx
aa aa aa
mul    %rcx
mov    %rdx,%rax
shr    $0x4,%rax
ret

LLVM IR (-O0):
define i64 @convert_timer_to_ms(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = udiv i64 %3, 24
ret i64 %4
}

LLVM IR (-O2):
define i64 @convert_timer_to_ms(i64 %0) {
%2 = udiv i64 %0, 24
ret i64 %2
}
/* Variables and functions */
int EOF;
int /*<<< orphan*/ printf(char *, int);
main() {
  int c;
  c = EOF;
  printf("The value of 'EOF' is: %i\n", c);
}


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

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

LLVM IR (-O0):
@EOF = global i32 0
@.str = [27 x i8] c"The value of 'EOF' is: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = load i32, i32* @EOF
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [27 x i8] c"The value of 'EOF' is: %i\0A\00"
define i32 @main() {
%1 = load i32, i32* @EOF
%2 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __ct_init_test(int, char **);
int __ct_run_test();
int main(int argc, char **argv) {
  __ct_init_test(argc, argv);
  return __ct_run_test();
}


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @__ct_init_test(i32 %6, i8** %7)
%9 = call i32 (...) @__ct_run_test()
ret i32 %9
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @__ct_init_test(i32 %0, i8** %1)
%4 = tail call i32 (...) @__ct_run_test()
ret i32 %4
}
/* Variables and functions */
char *filenameof(char *);
char *strchr(char *, char);
char *basenameof(char *fname) {
  char *p;
  fname = filenameof(fname);
  p = strchr(fname, '.');
  if (p)
    *p = 0;
  return fname;
}


x86 assembly (clang, -O0):
<basenameof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <filenameof@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115d <basenameof+0x3d>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basenameof>:
push   %rbx
call   1040 <filenameof@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x2e,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     113e <basenameof+0x1e>
movb   $0x0,(%rax)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @basenameof(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @filenameof(i8* %4)
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @strchr(i8* %6, i8 signext 46)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i8*, i8** %3
store i8 0, i8* %11
br label %12
12: ; preds = %10, %1
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
define i8* @basenameof(i8* %0) {
%2 = tail call i8* @filenameof(i8* %0)
%3 = tail call i8* @strchr(i8* dereferenceable(1) %2, i8 signext 46)
%4 = icmp eq i8* %3, null
br i1 %4, label %6, label %5
5: ; preds = %1
store i8 0, i8* %3
br label %6
6: ; preds = %5, %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ db_reset_startup_failures(char const *);
int /*<<< orphan*/ printlog(char *, char const *);
int /*<<< orphan*/ project_manager_restart_processes(char const *);
void project_manager_projectname_configfile_changed(const char *projname) {
  printlog("Project '%s' config change. Restart processes", projname);
  db_reset_startup_failures(projname);
  project_manager_restart_processes(projname);
}


x86 assembly (clang, -O0):
<project_manager_projectname_configfile_changed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1050 <printlog@plt>
mov    -0x8(%rbp),%rdi
call   1030 <db_reset_startup_failures@plt>
mov    -0x8(%rbp),%rdi
call   1040 <project_manager_restart_processes@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<project_manager_projectname_configfile_changed>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printlog@plt>
mov    %rbx,%rdi
call   1030 <db_reset_startup_failures@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <project_manager_restart_processes@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"Project '%s' config change. Restart processes\00"
define void @project_manager_projectname_configfile_changed(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printlog(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @db_reset_startup_failures(i8* %5)
%7 = load i8*, i8** %2
%8 = call i32 @project_manager_restart_processes(i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [46 x i8] c"Project '%s' config change. Restart processes\00"
define void @project_manager_projectname_configfile_changed(i8* %0) {
%2 = tail call i32 @printlog(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @db_reset_startup_failures(i8* %0)
%4 = tail call i32 @project_manager_restart_processes(i8* %0)
ret void
}
/* Variables and functions */
short inb(short);
short inpout32_in(short PortAddress) { return inb(PortAddress); }


x86 assembly (clang, -O0):
<inpout32_in>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edi
call   1030 <inb@plt>
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inpout32_in>:
jmp    1030 <inb@plt>

LLVM IR (-O0):
define signext i16 @inpout32_in(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = call signext i16 @inb(i16 signext %3)
ret i16 %4
}

LLVM IR (-O2):
define signext i16 @inpout32_in(i16 signext %0) {
%2 = tail call signext i16 @inb(i16 signext %0)
ret i16 %2
}