xunge/DecIR huggingface dataset:
/* Variables and functions */
int rand();
unsigned int myrand(void) {
  unsigned int result = 0;
  result += (rand() & 0xFF);
  result = result << 8;
  result += (rand() & 0xFF);
  result = result << 8;
  result += (rand() & 0xFF);
  result = result << 8;
  result += (rand() & 0xFF);
  return result;
}


x86 assembly (clang, -O0):
<myrand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
and    $0xff,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
and    $0xff,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
and    $0xff,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
and    $0xff,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myrand>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
shl    $0x18,%ebx
movzbl %bpl,%ecx
shl    $0x10,%ecx
or     %ebx,%ecx
shl    $0x8,%eax
movzwl %ax,%ebx
or     %ecx,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
movzbl %al,%eax
or     %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @myrand() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @rand()
%3 = and i32 %2, 255
%4 = load i32, i32* %1
%5 = add i32 %4, %3
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = shl i32 %6, 8
store i32 %7, i32* %1
%8 = call i32 (...) @rand()
%9 = and i32 %8, 255
%10 = load i32, i32* %1
%11 = add i32 %10, %9
store i32 %11, i32* %1
%12 = load i32, i32* %1
%13 = shl i32 %12, 8
store i32 %13, i32* %1
%14 = call i32 (...) @rand()
%15 = and i32 %14, 255
%16 = load i32, i32* %1
%17 = add i32 %16, %15
store i32 %17, i32* %1
%18 = load i32, i32* %1
%19 = shl i32 %18, 8
store i32 %19, i32* %1
%20 = call i32 (...) @rand()
%21 = and i32 %20, 255
%22 = load i32, i32* %1
%23 = add i32 %22, %21
store i32 %23, i32* %1
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
define i32 @myrand() {
%1 = tail call i32 (...) @rand()
%2 = tail call i32 (...) @rand()
%3 = tail call i32 (...) @rand()
%4 = shl i32 %1, 24
%5 = shl i32 %2, 16
%6 = and i32 %5, 16711680
%7 = or i32 %6, %4
%8 = shl i32 %3, 8
%9 = and i32 %8, 65280
%10 = or i32 %7, %9
%11 = tail call i32 (...) @rand()
%12 = and i32 %11, 255
%13 = or i32 %10, %12
ret i32 %13
}
/* Variables and functions */
int read_permission_p(char const *);
int fileutils___read_permission_p(const char *filename) {
  return (read_permission_p(filename));
}


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

x86 assembly (clang, -O2):
<fileutils___read_permission_p>:
jmp    1030 <read_permission_p@plt>

LLVM IR (-O0):
define i32 @fileutils___read_permission_p(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @read_permission_p(i8* %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @fileutils___read_permission_p(i8* %0) {
%2 = tail call i32 @read_permission_p(i8* %0)
ret i32 %2
}
/* Variables and functions */
scalar_t__ Malloc(scalar_t__);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *Cat(char *a, char *b) {
  char *c = (char *)Malloc(strlen(a) + strlen(b) + 1);
  strcpy(c, a);
  strcat(c, b);
  return c;
}


x86 assembly (clang, -O0):
<Cat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x20(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   1030 <Malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cat>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1050 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    (%r15,%rax,1),%rdi
add    $0x1,%rdi
call   1030 <Malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @Cat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
%10 = add nsw i64 %7, %9
%11 = add nsw i64 %10, 1
%12 = call i64 @Malloc(i64 %11)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %5
%14 = load i8*, i8** %5
%15 = load i8*, i8** %3
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = load i8*, i8** %5
%18 = load i8*, i8** %4
%19 = call i32 @strcat(i8* %17, i8* %18)
%20 = load i8*, i8** %5
ret i8* %20
}

LLVM IR (-O2):
define i8* @Cat(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add i64 %3, 1
%6 = add i64 %5, %4
%7 = tail call i64 @Malloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32 @strcpy(i8* %8, i8* %0)
%10 = tail call i32 @strcat(i8* %8, i8* %1)
ret i8* %8
}
char inb(unsigned short port) {
  char data;
  __asm__("inb %1, %0" : "=a"(data) : "dN"(port));
  return data;
}


x86 assembly (clang, -O0):
<inb>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%al
mov    %al,-0x3(%rbp)
movsbl -0x3(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inb>:
mov    %edi,%edx
in     (%dx),%al
ret

LLVM IR (-O0):
define signext i8 @inb(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i8
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i8 asm "inb $1, $0", "={ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i8 %5, i8* %3
%6 = load i8, i8* %3
ret i8 %6
}

LLVM IR (-O2):
define signext i8 @inb(i16 zeroext %0) {
%2 = tail call i8 asm "inb $1, $0", "={ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i8 %2
}
char *convert_hex_to_char(unsigned hex_org) {
  static char buf[2] = " ";
  if (hex_org >= 0x20 && hex_org < 0x80) {
    buf[0] = hex_org;
  } else {
    buf[0] = ' ';
  }
  return buf;
}


x86 assembly (clang, -O0):
<convert_hex_to_char>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x20,-0x4(%rbp)
jb     112c <convert_hex_to_char+0x2c>
cmpl   $0x80,-0x4(%rbp)
jae    112c <convert_hex_to_char+0x2c>
mov    -0x4(%rbp),%eax
mov    %al,0x2ef9(%rip)
jmp    1133 <convert_hex_to_char+0x33>
movb   $0x20,0x2eed(%rip)
lea    0x2ee6(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_hex_to_char>:
lea    -0x20(%rdi),%eax
cmp    $0x60,%eax
mov    $0x20,%eax
cmovb  %edi,%eax
mov    %al,0x2f0c(%rip)
lea    0x2f05(%rip),%rax
ret

LLVM IR (-O0):
@convert_hex_to_char.buf = internal global [2 x i8] c" \00"
define i8* @convert_hex_to_char(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp uge i32 %3, 32
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp ult i32 %6, 128
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %2
%10 = trunc i32 %9 to i8
store i8 %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @convert_hex_to_char.buf, i64 0, i64 0)
br label %12
11: ; preds = %5, %1
store i8 32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @convert_hex_to_char.buf, i64 0, i64 0)
br label %12
12: ; preds = %11, %8
ret i8* getelementptr inbounds ([2 x i8], [2 x i8]* @convert_hex_to_char.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@convert_hex_to_char.buf = internal global [2 x i8] c" \00"
define i8* @convert_hex_to_char(i32 %0) {
%2 = add i32 %0, -32
%3 = icmp ult i32 %2, 96
%4 = trunc i32 %0 to i8
%5 = select i1 %3, i8 %4, i8 32
store i8 %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @convert_hex_to_char.buf, i64 0, i64 0)
ret i8* getelementptr inbounds ([2 x i8], [2 x i8]* @convert_hex_to_char.buf, i64 0, i64 0)
}
int do_966() { return 966; }


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

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

LLVM IR (-O0):
define i32 @do_966() {
ret i32 966
}

LLVM IR (-O2):
define i32 @do_966() {
ret i32 966
}
/* Type definitions */
typedef long long int64_t;

/* Variables and functions */
int64_t getPerformanceFrequency() { return 1000000000LL; }


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

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

LLVM IR (-O0):
define i64 @getPerformanceFrequency() {
ret i64 1000000000
}

LLVM IR (-O2):
define i64 @getPerformanceFrequency() {
ret i64 1000000000
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  int i, j, k;
  while (i < 10 && j < 10 || i == k) {
    printf("1\n");
    while (k < 20)
      printf("2\n");
  }
  return 0;
}


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)
cmpl   $0xa,-0x14(%rbp)
jge    113f <main+0x2f>
mov    $0x1,%al
cmpl   $0xa,-0x18(%rbp)
mov    %al,-0x1d(%rbp)
jl     114b <main+0x3b>
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
sete   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    115b <main+0x4b>
jmp    1187 <main+0x77>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x14,-0x1c(%rbp)
jge    1182 <main+0x72>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
jmp    1167 <main+0x57>
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
void MergeUVRow_SSE2() {}


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

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

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

LLVM IR (-O2):
define void @MergeUVRow_SSE2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isbdigit(int);
void t_isbdigit_0xc4() {
  Assert_real((isbdigit(196) == 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_isbdigit.c",
              985, ("isbdigit should be 0 for 0xc4"));
}


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

x86 assembly (clang, -O2):
<t_isbdigit_0xc4>:
push   %rax
mov    $0xc4,%edi
call   1040 <isbdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x3d9,%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_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0xc4\00"
define void @t_isbdigit_0xc4() {
%1 = call i64 @isbdigit(i32 196)
%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 985, 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_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0xc4\00"
define void @t_isbdigit_0xc4() {
%1 = tail call i64 @isbdigit(i32 196)
%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 985, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int start() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @start() {
ret i32 0
}
int ones(int i) {
  i = i - ((i >> 1) & 0x55555555);
  i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
  return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}


x86 assembly (clang, -O0):
<ones>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x1,%ecx
and    $0x55555555,%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x33333333,%eax
mov    -0x4(%rbp),%ecx
sar    $0x2,%ecx
and    $0x33333333,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x4,%ecx
add    %ecx,%eax
and    $0xf0f0f0f,%eax
imul   $0x1010101,%eax,%eax
sar    $0x18,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ones>:
mov    %edi,%eax
shr    %eax
and    $0x55555555,%eax
sub    %eax,%edi
mov    %edi,%eax
and    $0x33333333,%eax
shr    $0x2,%edi
and    $0x33333333,%edi
add    %eax,%edi
mov    %edi,%eax
shr    $0x4,%eax
add    %edi,%eax
and    $0xf0f0f0f,%eax
imul   $0x1010101,%eax,%eax
shr    $0x18,%eax
ret

LLVM IR (-O0):
define i32 @ones(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 1
%6 = and i32 %5, 1431655765
%7 = sub nsw i32 %3, %6
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = and i32 %8, 858993459
%10 = load i32, i32* %2
%11 = ashr i32 %10, 2
%12 = and i32 %11, 858993459
%13 = add nsw i32 %9, %12
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = load i32, i32* %2
%16 = ashr i32 %15, 4
%17 = add nsw i32 %14, %16
%18 = and i32 %17, 252645135
%19 = mul nsw i32 %18, 16843009
%20 = ashr i32 %19, 24
ret i32 %20
}

LLVM IR (-O2):
define i32 @ones(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 1431655765
%4 = sub nsw i32 %0, %3
%5 = and i32 %4, 858993459
%6 = lshr i32 %4, 2
%7 = and i32 %6, 858993459
%8 = add nuw nsw i32 %7, %5
%9 = lshr i32 %8, 4
%10 = add nuw nsw i32 %9, %8
%11 = and i32 %10, 252645135
%12 = mul nsw i32 %11, 16843009
%13 = lshr i32 %12, 24
ret i32 %13
}
int foo(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j,
        int k, int l, int m) {}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    0x40(%rbp),%eax
mov    0x38(%rbp),%eax
mov    0x30(%rbp),%eax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @foo(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12) {
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
store i32 %0, i32* %15
store i32 %1, i32* %16
store i32 %2, i32* %17
store i32 %3, i32* %18
store i32 %4, i32* %19
store i32 %5, i32* %20
store i32 %6, i32* %21
store i32 %7, i32* %22
store i32 %8, i32* %23
store i32 %9, i32* %24
store i32 %10, i32* %25
store i32 %11, i32* %26
store i32 %12, i32* %27
%28 = load i32, i32* %14
ret i32 %28
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9, i32 %10, i32 %11, i32 %12) {
ret i32 undef
}
void prune_alias_exp_Ok(int x) {
  int a[1];
  if (x + 1 != x + 1) {
    a[1] = 0;
  }
}


x86 assembly (clang, -O0):
<prune_alias_exp_Ok>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
je     1122 <prune_alias_exp_Ok+0x22>
movl   $0x0,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @prune_alias_exp_Ok(i32 %0) {
ret void
}
void RTStrCacheRelease(void) {}


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

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

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

LLVM IR (-O2):
define void @RTStrCacheRelease() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
unsigned long pluscczexta(unsigned int a, unsigned int b) {
  unsigned int sum = a + b;
  if (sum < a)
    abort();
  return sum;
}


x86 assembly (clang, -O0):
<pluscczexta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    113a <pluscczexta+0x2a>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pluscczexta>:
add    %esi,%edi
jb     1117 <pluscczexta+0x7>
mov    %edi,%eax
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i64 @pluscczexta(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 = add i32 %6, %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = load i32, i32* %3
%11 = icmp ult i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (...) @abort()
unreachable
14: ; preds = %2
%15 = load i32, i32* %5
%16 = zext i32 %15 to i64
ret i64 %16
}

LLVM IR (-O2):
define i64 @pluscczexta(i32 %0, i32 %1) {
%3 = add i32 %1, %0
%4 = icmp ult i32 %3, %0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %2
%8 = zext i32 %3 to i64
ret i64 %8
}
/* Variables and functions */
scalar_t__ eval();
int /*<<< orphan*/ pbstr(char *);
int /*<<< orphan*/ pushback(char);
int /*<<< orphan*/ sprintf(char *, char *, long);
void pragvalue() {
  char buf[510 + 1];
  sprintf(buf, "%ld", (long)eval());
  pbstr(buf);
  pushback('\n');
}


x86 assembly (clang, -O0):
<pragvalue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
lea    -0x200(%rbp),%rax
mov    %rax,-0x208(%rbp)
mov    $0x0,%al
call   1050 <eval@plt>
mov    -0x208(%rbp),%rdi
mov    %rax,%rdx
lea    0xe8f(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x200(%rbp),%rdi
call   1040 <pbstr@plt>
mov    $0xa,%edi
call   1030 <pushback@plt>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pragvalue>:
push   %rbx
sub    $0x200,%rsp
xor    %eax,%eax
call   1050 <eval@plt>
lea    0xeaa(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rax,%rdx
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <pbstr@plt>
mov    $0xa,%edi
call   1030 <pushback@plt>
add    $0x200,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%ld\00"
define void @pragvalue() {
%1 = alloca [511 x i8]
%2 = getelementptr inbounds [511 x i8], [511 x i8]* %1, i64 0, i64 0
%3 = call i64 (...) @eval()
%4 = call i32 @sprintf(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %3)
%5 = getelementptr inbounds [511 x i8], [511 x i8]* %1, i64 0, i64 0
%6 = call i32 @pbstr(i8* %5)
%7 = call i32 @pushback(i8 signext 10)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
define void @pragvalue() {
%1 = alloca [511 x i8]
%2 = getelementptr inbounds [511 x i8], [511 x i8]* %1, i64 0, i64 0
%3 = tail call i64 (...) @eval()
%4 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %3)
%5 = call i32 @pbstr(i8* %2)
%6 = call i32 @pushback(i8 signext 10)
ret void
}
void testFunction(void) {}


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

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

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

LLVM IR (-O2):
define void @testFunction() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ MC_avg4_16(int, int /*<<< orphan*/ *,
                              int /*<<< orphan*/ const *, int,
                              int /*<<< orphan*/);
void MC_avg_xy_16_mmxext(uint8_t *dest, const uint8_t *ref, int stride,
                         int height) {
  MC_avg4_16(height, dest, ref, stride, 0);
}


x86 assembly (clang, -O0):
<MC_avg_xy_16_mmxext>:
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    -0x18(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
xor    %r8d,%r8d
call   1030 <MC_avg4_16@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MC_avg_xy_16_mmxext>:
mov    %edx,%eax
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    %ecx,%edi
mov    %eax,%ecx
xor    %r8d,%r8d
jmp    1030 <MC_avg4_16@plt>

LLVM IR (-O0):
define void @MC_avg_xy_16_mmxext(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = load i32*, i32** %5
%11 = load i32*, i32** %6
%12 = load i32, i32* %7
%13 = call i32 @MC_avg4_16(i32 %9, i32* %10, i32* %11, i32 %12, i32 0)
ret void
}

LLVM IR (-O2):
define void @MC_avg_xy_16_mmxext(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = tail call i32 @MC_avg4_16(i32 %3, i32* %0, i32* %1, i32 %2, i32 0)
ret void
}
/* Type definitions */
struct timeval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
void tick(struct timeval *t) { gettimeofday(t, NULL); }


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

x86 assembly (clang, -O2):
<tick>:
xor    %esi,%esi
jmp    1030 <gettimeofday@plt>

LLVM IR (-O0):
%struct.timeval = type { i32 }
define void @tick(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %2
%3 = load %struct.timeval*, %struct.timeval** %2
%4 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define void @tick(%struct.timeval* nocapture %0) {
%2 = tail call i32 @gettimeofday(%struct.timeval* %0, i32* null)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
scalar_t__ wMalloc(scalar_t__);
char *wCopyString(char *s) {
  char *t;
  t = (char *)wMalloc(strlen(s) + 1);
  strcpy(t, s);
  return t;
}


x86 assembly (clang, -O0):
<wCopyString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <wMalloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wCopyString>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <wMalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @wCopyString(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i64 @wMalloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = load i8*, i8** %2
%11 = call i32 @strcpy(i8* %9, i8* %10)
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
define i8* @wCopyString(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i64 @wMalloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @strcpy(i8* %5, i8* %0)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int meaning = 42;
  printf("The meaning is %d.\n", meaning);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x2a,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [20 x i8] c"The meaning is %d.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 42, i32* %5
%6 = load i32, i32* %5
%7 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"The meaning is %d.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 42)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ dpotrf_(char *, int *, double *, int *, int *, int);
void mydpotrf(char *uplo, int *n, double *a, int *lda, int *info) {
  dpotrf_(uplo, n, a, lda, info, 1);
}


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

x86 assembly (clang, -O2):
<mydpotrf>:
mov    $0x1,%r9d
jmp    1030 <dpotrf_@plt>

LLVM IR (-O0):
define void @mydpotrf(i8* %0, i32* %1, double* %2, i32* %3, i32* %4) {
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca double*
%9 = alloca i32*
%10 = alloca i32*
store i8* %0, i8** %6
store i32* %1, i32** %7
store double* %2, double** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
%11 = load i8*, i8** %6
%12 = load i32*, i32** %7
%13 = load double*, double** %8
%14 = load i32*, i32** %9
%15 = load i32*, i32** %10
%16 = call i32 @dpotrf_(i8* %11, i32* %12, double* %13, i32* %14, i32* %15, i32 1)
ret void
}

LLVM IR (-O2):
define void @mydpotrf(i8* %0, i32* %1, double* %2, i32* %3, i32* %4) {
%6 = tail call i32 @dpotrf_(i8* %0, i32* %1, double* %2, i32* %3, i32* %4, i32 1)
ret void
}
/* Variables and functions */
int SIGINT;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ remove(char *);
void signalhandler(int signo) {
  if (signo == SIGINT) {
    remove("mario");
    exit(0);
  }
}


x86 assembly (clang, -O0):
<signalhandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2eb3(%rip),%rcx
cmp    (%rcx),%eax
jne    1150 <signalhandler+0x30>
lea    0xebc(%rip),%rdi
call   1030 <remove@plt>
xor    %edi,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signalhandler>:
push   %rax
mov    0x2ec0(%rip),%rax
cmp    %edi,(%rax)
je     112e <signalhandler+0xe>
pop    %rax
ret
lea    0xecb(%rip),%rdi
call   1030 <remove@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@SIGINT = global i32 0
@.str = [6 x i8] c"mario\00"
define void @signalhandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGINT
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i32 @remove(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @exit(i32 0)
unreachable
9: ; preds = %1
ret void
}

LLVM IR (-O2):
@SIGINT = global i32 0
@.str = [6 x i8] c"mario\00"
define void @signalhandler(i32 %0) {
%2 = load i32, i32* @SIGINT
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @remove(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GL_COLOR_BUFFER_BIT;
int /*<<< orphan*/ glClear(int /*<<< orphan*/);
int /*<<< orphan*/ glFinish();
void display(void) {
  glClear(GL_COLOR_BUFFER_BIT);
  glFinish();
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
mov    $0x0,%al
call   1040 <glFinish@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <glFinish@plt>

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = call i32 @glClear(i32 %1)
%3 = call i32 (...) @glFinish()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = tail call i32 @glClear(i32 %1)
%3 = tail call i32 (...) @glFinish()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sel4bench_private_switch_user_pmc(int /*<<< orphan*/);
void sel4bench_private_deinit(void *data) {
  sel4bench_private_switch_user_pmc(0);
}


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

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

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

LLVM IR (-O2):
define void @sel4bench_private_deinit(i8* nocapture readnone %0) {
%2 = tail call i32 @sel4bench_private_switch_user_pmc(i32 0)
ret void
}
signed char max(signed char a, signed char b) { return (a > b) ? a : b; }


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
movsbl -0x2(%rbp),%ecx
cmp    %ecx,%eax
jle    112c <max+0x2c>
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1133 <max+0x33>
movsbl -0x2(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
mov    %esi,%eax
cmp    %al,%dil
cmovg  %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @max(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = icmp sgt i32 %6, %8
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
br label %16
13: ; preds = %2
%14 = load i8, i8* %4
%15 = sext i8 %14 to i32
br label %16
16: ; preds = %13, %10
%17 = phi i32 [ %12, %10 ], [ %15, %13 ]
%18 = trunc i32 %17 to i8
ret i8 %18
}

LLVM IR (-O2):
define signext i8 @max(i8 signext %0, i8 signext %1) {
%3 = icmp sgt i8 %0, %1
%4 = select i1 %3, i8 %0, i8 %1
ret i8 %4
}
int winpr_dummy() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @winpr_dummy() {
ret i32 0
}
/* Variables and functions */
int strisglob(const char *s) {
  char c;
  while ((c = *s++) != '\0') {
    if (c == '[' || c == '?' || c == '*' || c == '\\')
      return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<strisglob>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     116d <strisglob+0x6d>
movsbl -0x11(%rbp),%eax
cmp    $0x5b,%eax
je     115c <strisglob+0x5c>
movsbl -0x11(%rbp),%eax
cmp    $0x3f,%eax
je     115c <strisglob+0x5c>
movsbl -0x11(%rbp),%eax
cmp    $0x2a,%eax
je     115c <strisglob+0x5c>
movsbl -0x11(%rbp),%eax
cmp    $0x5c,%eax
jne    1168 <strisglob+0x68>
movl   $0x1,-0x4(%rbp)
jmp    1174 <strisglob+0x74>
jmp    1108 <strisglob+0x8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strisglob>:
movabs $0x6000000200001,%rax
nopw   0x0(%rax,%rax,1)
movzbl (%rdi),%ecx
test   %cl,%cl
je     1132 <strisglob+0x32>
add    $0x1,%rdi
add    $0xd6,%cl
cmp    $0x32,%cl
ja     1110 <strisglob+0x10>
movzbl %cl,%ecx
bt     %rcx,%rax
jae    1110 <strisglob+0x10>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strisglob(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
switch i8 %4, label %2 [
i8 92, label %8
i8 91, label %8
i8 63, label %8
i8 42, label %8
]
8: ; preds = %2, %6, %6, %6, %6
%9 = phi i32 [ 1, %6 ], [ 1, %6 ], [ 1, %6 ], [ 1, %6 ], [ 0, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void shell_help() {
  printf(
      "Ulix Usermode Shell 0.08. Commands: %s\n",
      "help, ps, fork, ls, cat, head, cp, diff, sh,hexdump, kill, loop, test, "
      "brk, cd, ln, rm, pwd, touch, read, edit, scroll,     keys, exit");
  printf("Press [Shift+Esc] to launch kernel mode shell (reboot to get back "
         "here)\n");
}


x86 assembly (clang, -O0):
<shell_help>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xf06(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<shell_help>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xef9(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf72(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"Ulix Usermode Shell 0.08. Commands: %s\0A\00"
@.str.1 = [135 x i8] c"help, ps, fork, ls, cat, head, cp, diff, sh,hexdump, kill, loop, test, brk, cd, ln, rm, pwd, touch, read, edit, scroll, keys, exit\00"
@.str.2 = [73 x i8] c"Press [Shift+Esc] to launch kernel mode shell (reboot to get back here)\0A\00"
define void @shell_help() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"Ulix Usermode Shell 0.08. Commands: %s\0A\00"
@.str.1 = [135 x i8] c"help, ps, fork, ls, cat, head, cp, diff, sh,hexdump, kill, loop, test, brk, cd, ln, rm, pwd, touch, read, edit, scroll, keys, exit\00"
@str = [72 x i8] c"Press [Shift+Esc] to launch kernel mode shell (reboot to get back here)\00"
define void @shell_help() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str, i64 0, i64 0))
ret void
}
int ft_isblank(int c) { return (c == ' ' || c == '\t' || c == '\n'); }


x86 assembly (clang, -O0):
<ft_isblank>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     112f <ft_isblank+0x2f>
mov    $0x1,%al
cmpl   $0x9,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     112f <ft_isblank+0x2f>
cmpl   $0xa,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isblank>:
mov    $0x1,%eax
cmp    $0x9,%edi
je     110f <ft_isblank+0xf>
cmp    $0x20,%edi
jne    1110 <ft_isblank+0x10>
ret
xor    %eax,%eax
cmp    $0xa,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @ft_isblank(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 32
br i1 %4, label %11, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 9
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 10
br label %11
11: ; preds = %8, %5, %1
%12 = phi i1 [ true, %5 ], [ true, %1 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @ft_isblank(i32 %0) {
switch i32 %0, label %2 [
i32 32, label %5
i32 9, label %5
]
2: ; preds = %1
%3 = icmp eq i32 %0, 10
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ]
ret i32 %6
}
int bufferevent_enable(struct bufferevent *bufev, short event) {
  (void)bufev;
  (void)event;
  return 0;
}


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

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

LLVM IR (-O0):
%struct.bufferevent = type opaque
define i32 @bufferevent_enable(%struct.bufferevent* %0, i16 signext %1) {
%3 = alloca %struct.bufferevent*
%4 = alloca i16
store %struct.bufferevent* %0, %struct.bufferevent** %3
store i16 %1, i16* %4
%5 = load %struct.bufferevent*, %struct.bufferevent** %3
%6 = load i16, i16* %4
ret i32 0
}

LLVM IR (-O2):
%struct.bufferevent = type opaque
define i32 @bufferevent_enable(%struct.bufferevent* nocapture readnone %0, i16 signext %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bzero(unsigned char *, int);
scalar_t__ malloc(int);
unsigned char *init_memory() {
  unsigned char *mem;
  if ((mem = (unsigned char *)malloc(sizeof(unsigned char) * 666)) == NULL)
    return NULL;
  bzero(mem, 666);
  return (mem);
}


x86 assembly (clang, -O0):
<init_memory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x29a,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    114d <init_memory+0x2d>
movq   $0x0,-0x8(%rbp)
jmp    1163 <init_memory+0x43>
mov    -0x10(%rbp),%rdi
mov    $0x29a,%esi
call   1040 <bzero@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_memory>:
push   %rbx
mov    $0x29a,%edi
call   1030 <malloc@plt>
test   %rax,%rax
je     1142 <init_memory+0x22>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x29a,%esi
call   1040 <bzero@plt>
jmp    1144 <init_memory+0x24>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @init_memory() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i64 @malloc(i32 666)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %2
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %0
store i8* null, i8** %1
br label %11
7: ; preds = %0
%8 = load i8*, i8** %2
%9 = call i32 @bzero(i8* %8, i32 666)
%10 = load i8*, i8** %2
store i8* %10, i8** %1
br label %11
11: ; preds = %7, %6
%12 = load i8*, i8** %1
ret i8* %12
}

LLVM IR (-O2):
define i8* @init_memory() {
%1 = tail call i64 @malloc(i32 666)
%2 = inttoptr i64 %1 to i8*
%3 = icmp eq i64 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 @bzero(i8* %2, i32 666)
br label %6
6: ; preds = %0, %4
%7 = phi i8* [ %2, %4 ], [ null, %0 ]
ret i8* %7
}
void *bar(void) {
  foo();
  return &foo;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <foo@plt>
mov    0x2ed6(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rax
xor    %eax,%eax
call   1030 <foo@plt>
mov    0x2ed9(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @bar() {
%1 = call i32 (...) @foo()
ret i8* bitcast (i32 (...)* @foo to i8*)
}

LLVM IR (-O2):
define i8* @bar() {
%1 = tail call i32 (...) @foo()
ret i8* bitcast (i32 (...)* @foo to i8*)
}
unsigned invert(unsigned x, int p, int n) {
  unsigned m;
  m = ~(~0 << n) << (p - n + 1);
  return x ^ m;
}


x86 assembly (clang, -O0):
<invert>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
mov    -0x8(%rbp),%ecx
sub    -0xc(%rbp),%ecx
add    $0x1,%ecx
shl    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<invert>:
mov    %edx,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
sub    %edx,%esi
lea    0x1(%rsi),%ecx
shl    %cl,%eax
xor    %edi,%eax
ret

LLVM IR (-O0):
define i32 @invert(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* %6
%9 = shl i32 -1, %8
%10 = xor i32 %9, -1
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = sub nsw i32 %11, %12
%14 = add nsw i32 %13, 1
%15 = shl i32 %10, %14
store i32 %15, i32* %7
%16 = load i32, i32* %4
%17 = load i32, i32* %7
%18 = xor i32 %16, %17
ret i32 %18
}

LLVM IR (-O2):
define i32 @invert(i32 %0, i32 %1, i32 %2) {
%4 = shl nsw i32 -1, %2
%5 = xor i32 %4, -1
%6 = add i32 %1, 1
%7 = sub i32 %6, %2
%8 = shl i32 %5, %7
%9 = xor i32 %8, %0
ret i32 %9
}
int num_digits(int n) {
  if (n < 10)
    return (1);
  if (n < 100)
    return (2);
  if (n < 1000)
    return (3);
  if (n < 10000)
    return (4);
  if (n < 100000)
    return (5);
  return (6);
}


x86 assembly (clang, -O0):
<num_digits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    111d <num_digits+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    1185 <num_digits+0x85>
cmpl   $0x64,-0x8(%rbp)
jge    1133 <num_digits+0x33>
movl   $0x2,-0x4(%rbp)
jmp    1185 <num_digits+0x85>
cmpl   $0x3e8,-0x8(%rbp)
jge    114c <num_digits+0x4c>
movl   $0x3,-0x4(%rbp)
jmp    1185 <num_digits+0x85>
cmpl   $0x2710,-0x8(%rbp)
jge    1165 <num_digits+0x65>
movl   $0x4,-0x4(%rbp)
jmp    1185 <num_digits+0x85>
cmpl   $0x186a0,-0x8(%rbp)
jge    117e <num_digits+0x7e>
movl   $0x5,-0x4(%rbp)
jmp    1185 <num_digits+0x85>
movl   $0x6,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_digits>:
mov    $0x1,%eax
cmp    $0xa,%edi
jl     113c <num_digits+0x3c>
mov    $0x2,%eax
cmp    $0x64,%edi
jb     113c <num_digits+0x3c>
mov    $0x3,%eax
cmp    $0x3e8,%edi
jb     113c <num_digits+0x3c>
mov    $0x4,%eax
cmp    $0x2710,%edi
jb     113c <num_digits+0x3c>
cmp    $0x186a0,%edi
mov    $0x6,%eax
sbb    $0x0,%eax
ret

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

LLVM IR (-O2):
define i32 @num_digits(i32 %0) {
%2 = icmp slt i32 %0, 10
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 100
br i1 %4, label %12, label %5
5: ; preds = %3
%6 = icmp ult i32 %0, 1000
br i1 %6, label %12, label %7
7: ; preds = %5
%8 = icmp ult i32 %0, 10000
br i1 %8, label %12, label %9
9: ; preds = %7
%10 = icmp ult i32 %0, 100000
%11 = select i1 %10, i32 5, i32 6
br label %12
12: ; preds = %9, %7, %5, %3, %1
%13 = phi i32 [ 1, %1 ], [ 2, %3 ], [ 3, %5 ], [ 4, %7 ], [ %11, %9 ]
ret i32 %13
}
/* Variables and functions */
int POLLIN;
int POLLOUT;
int ___poll(int, int, int);
int zrwable(int fd) { return ___poll(fd, POLLIN | POLLOUT, 1); }


x86 assembly (clang, -O0):
<zrwable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
mov    0x2eca(%rip),%rax
or     (%rax),%esi
mov    $0x1,%edx
call   1030 <___poll@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zrwable>:
mov    0x2ec9(%rip),%rax
mov    0x2eda(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    $0x1,%edx
jmp    1030 <___poll@plt>

LLVM IR (-O0):
@POLLIN = global i32 0
@POLLOUT = global i32 0
define i32 @zrwable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @POLLIN
%5 = load i32, i32* @POLLOUT
%6 = or i32 %4, %5
%7 = call i32 @___poll(i32 %3, i32 %6, i32 1)
ret i32 %7
}

LLVM IR (-O2):
@POLLIN = global i32 0
@POLLOUT = global i32 0
define i32 @zrwable(i32 %0) {
%2 = load i32, i32* @POLLIN
%3 = load i32, i32* @POLLOUT
%4 = or i32 %3, %2
%5 = tail call i32 @___poll(i32 %0, i32 %4, i32 1)
ret i32 %5
}