xunge/DecIR huggingface dataset:
/* Variables and functions */
int max(int, int);
int Max3(int a, int b, int c) { return max(max(a, b), c); }


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

x86 assembly (clang, -O2):
<Max3>:
push   %rbx
mov    %edx,%ebx
call   1030 <max@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <max@plt>

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

LLVM IR (-O2):
define i32 @Max3(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @max(i32 %0, i32 %1)
%5 = tail call i32 @max(i32 %4, i32 %2)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ system_(char *);
int main() {
  system_("ls");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"ls\00"
define i32 @main() {
%1 = tail call i32 @system_(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
__attribute__((no, noclone)) void f4(void) {
  int *p = (int *)__builtin_calloc(3, 1);
  *p = 42;
  __builtin_free(p);
}


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x2a,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f4() {
%1 = alloca i32*
%2 = call i8* @calloc(i64 3, i64 1)
%3 = bitcast i8* %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
store i32 42, i32* %4
%5 = load i32*, i32** %1
%6 = bitcast i32* %5 to i8*
ret void
}

LLVM IR (-O2):
define void @f4() {
ret void
}
void pci_disable_ptm(struct pci_dev *dev) {}


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

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

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

LLVM IR (-O2):
%struct.pci_dev = type opaque
define void @pci_disable_ptm(%struct.pci_dev* nocapture %0) {
ret void
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ printf(char *, char *);
void *alt_bkt_malloc(size_t sz) {
  printf("%s\n", "alt_bkt_malloc");
  return malloc(sz);
}


x86 assembly (clang, -O0):
<alt_bkt_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
lea    0xeca(%rip),%rsi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alt_bkt_malloc>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
lea    0xed2(%rip),%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <malloc@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [15 x i8] c"alt_bkt_malloc\00"
define i8* @alt_bkt_malloc(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
ret i8* %5
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [15 x i8] c"alt_bkt_malloc\00"
define noalias i8* @alt_bkt_malloc(i64 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i8* @malloc(i64 %0)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
char rand();
void main() {
  char data;
  for (int i = 0; i < 100; i++) {
    data = rand();
    if (data < 0) {
      char result = data * 2;
      printf("%hhd\n", result);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    117d <main+0x5d>
mov    $0x0,%al
call   1040 <rand@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jge    116a <main+0x4a>
movsbl -0x1(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x9(%rbp)
lea    0xe9f(%rip),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <printf@plt>
jmp    116f <main+0x4f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <main+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0x64,%ebp
lea    0xed1(%rip),%rbx
jmp    1145 <main+0x25>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
je     115f <main+0x3f>
xor    %eax,%eax
call   1040 <rand@plt>
test   %al,%al
jns    1140 <main+0x20>
add    %al,%al
movsbl %al,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
jmp    1140 <main+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%hhd\0A\00"
define void @main() {
%1 = alloca i8
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %2
br label %4
4: ; preds = %20, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 100
br i1 %6, label %7, label %23
7: ; preds = %4
%8 = call signext i8 (...) @rand()
store i8 %8, i8* %1
%9 = load i8, i8* %1
%10 = sext i8 %9 to i32
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %7
%13 = load i8, i8* %1
%14 = sext i8 %13 to i32
%15 = mul nsw i32 %14, 2
%16 = trunc i32 %15 to i8
store i8 %16, i8* %3
%17 = load i8, i8* %3
%18 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext %17)
br label %19
19: ; preds = %12, %7
br label %20
20: ; preds = %19
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 1
store i32 %22, i32* %2
br label %4
23: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%hhd\0A\00"
define void @main() {
br label %2
1: ; preds = %9
ret void
2: ; preds = %0, %9
%3 = phi i32 [ 0, %0 ], [ %10, %9 ]
%4 = tail call signext i8 (...) @rand()
%5 = icmp slt i8 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = shl i8 %4, 1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext %7)
br label %9
9: ; preds = %2, %6
%10 = add nuw nsw i32 %3, 1
%11 = icmp eq i32 %10, 100
br i1 %11, label %1, label %2
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdout;
int main() {
  printf("%s", "Here goes infinite loop!");
  fflush(stdout);
  while (1)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    0xec6(%rip),%rsi
call   1030 <printf@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
jmp    1150 <main+0x30>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed4(%rip),%rsi
call   1030 <printf@plt>
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
jmp    1150 <main+0x30>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [25 x i8] c"Here goes infinite loop!\00"
@stdout = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = call i32 @fflush(i32 %3)
br label %5
5: ; preds = %0, %5
br label %5
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [25 x i8] c"Here goes infinite loop!\00"
@stdout = global i32 0
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
br label %4
4: ; preds = %0, %4
br label %4
}
/* Variables and functions */
int /*<<< orphan*/ cpc_key_press(int);
int /*<<< orphan*/ cpc_key_unpress(int);
void Joy_Opqa_Down(int value) {
  if (value) {
    cpc_key_press(0x85);
  } else {
    cpc_key_unpress(0x85);
  };
}


x86 assembly (clang, -O0):
<Joy_Opqa_Down>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1144 <Joy_Opqa_Down+0x24>
mov    $0x85,%edi
call   1030 <cpc_key_press@plt>
jmp    114e <Joy_Opqa_Down+0x2e>
mov    $0x85,%edi
call   1040 <cpc_key_unpress@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Joy_Opqa_Down>:
test   %edi,%edi
je     112e <Joy_Opqa_Down+0xe>
mov    $0x85,%edi
jmp    1030 <cpc_key_press@plt>
mov    $0x85,%edi
jmp    1040 <cpc_key_unpress@plt>

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

LLVM IR (-O2):
define void @Joy_Opqa_Down(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @cpc_key_press(i32 133)
br label %7
5: ; preds = %1
%6 = tail call i32 @cpc_key_unpress(i32 133)
br label %7
7: ; preds = %5, %3
ret void
}
void OSCC_init(void) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int chown(const char *path, uid_t owner, gid_t group) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<chown>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    0x2ed3(%rip),%rax
mov    (%rax),%ecx
mov    0x2eba(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<chown>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @chown(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 i32, i32* @ENOSYS
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @chown(i8* nocapture readnone %0, i32 %1, i32 %2) {
%4 = load i32, i32* @ENOSYS
store i32 %4, i32* @errno
ret i32 -1
}
void g_unichar_xdigit_value() {}


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

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

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

LLVM IR (-O2):
define void @g_unichar_xdigit_value() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *this) {
  fprintf(stderr,
          "Usage: %s port/setup\n"
          "	'%s help' for help\n",
          this, this);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xebc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rcx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
mov    %rcx,%rdx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [42 x i8] c"Usage: %s port/setup\0A\09'%s help' for help\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %5)
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [42 x i8] c"Usage: %s port/setup\0A\09'%s help' for help\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
void c_func(int nin, double x[], int nout, double *y[]) {
  double E = x[0];
  double F = x[1];
  double L = x[2];
  double I = x[3];
}


x86 assembly (clang, -O0):
<c_func>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @c_func(i32 %0, double* %1, i32 %2, double** %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca i32
%8 = alloca double**
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store i32 %0, i32* %5
store double* %1, double** %6
store i32 %2, i32* %7
store double** %3, double*** %8
%13 = load double*, double** %6
%14 = getelementptr inbounds double, double* %13, i64 0
%15 = load double, double* %14
store double %15, double* %9
%16 = load double*, double** %6
%17 = getelementptr inbounds double, double* %16, i64 1
%18 = load double, double* %17
store double %18, double* %10
%19 = load double*, double** %6
%20 = getelementptr inbounds double, double* %19, i64 2
%21 = load double, double* %20
store double %21, double* %11
%22 = load double*, double** %6
%23 = getelementptr inbounds double, double* %22, i64 3
%24 = load double, double* %23
store double %24, double* %12
ret void
}

LLVM IR (-O2):
define void @c_func(i32 %0, double* nocapture %1, i32 %2, double** nocapture %3) {
ret void
}
/* Type definitions */
typedef size_t uint32_t;

/* Variables and functions */
void *random_pointer();
void set_array_random(void **a, uint32_t n) {
  uint32_t i;
  for (i = 0; i < n; i++) {
    a[i] = random_pointer();
  }
}


x86 assembly (clang, -O0):
<set_array_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    115d <set_array_random+0x4d>
mov    $0x0,%al
call   1030 <random_pointer@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <set_array_random+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_array_random>:
push   %r15
push   %r14
push   %rbx
test   %rsi,%rsi
je     1144 <set_array_random+0x34>
mov    %rsi,%r15
mov    %rdi,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <random_pointer@plt>
mov    %rax,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <set_array_random+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @set_array_random(i8** nocapture writeonly %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %10, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %8, %4 ], [ 0, %2 ]
%6 = tail call i8* (...) @random_pointer()
%7 = getelementptr inbounds i8*, i8** %0, i64 %5
store i8* %6, i8** %7
%8 = add nuw i64 %5, 1
%9 = icmp eq i64 %8, %1
br i1 %9, label %10, label %4
10: ; preds = %4, %2
ret void
}
int test_imm_98uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x98 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_98uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 9961472
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ drawChar(int /*<<< orphan*/);
int /*<<< orphan*/ setCursor(int, int);
void displayString(int x, int y, unsigned char *s) {
  while ((*s)) {
    setCursor(x, y);
    drawChar(*(s++));
    x += 8;
  }
}


x86 assembly (clang, -O0):
<displayString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     116f <displayString+0x4f>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <setCursor@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movzbl (%rax),%edi
call   1040 <drawChar@plt>
mov    -0x4(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x4(%rbp)
jmp    1132 <displayString+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<displayString>:
push   %rbp
push   %r14
push   %rbx
cmpb   $0x0,(%rdx)
je     115f <displayString+0x3f>
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %edi,%ebp
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <setCursor@plt>
movzbl -0x1(%rbx),%edi
call   1040 <drawChar@plt>
add    $0x8,%ebp
cmpb   $0x0,(%rbx)
lea    0x1(%rbx),%rbx
jne    1140 <displayString+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @displayString(i32 %0, i32 %1, i8* nocapture %2) {
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %3, %6
%7 = phi i8* [ %10, %6 ], [ %2, %3 ]
%8 = phi i32 [ %14, %6 ], [ %0, %3 ]
%9 = tail call i32 @setCursor(i32 %8, i32 %1)
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = load i8, i8* %7
%12 = zext i8 %11 to i32
%13 = tail call i32 @drawChar(i32 %12)
%14 = add nsw i32 %8, 8
%15 = load i8, i8* %10
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %6
17: ; preds = %6, %3
ret void
}
int look(str)
register char *str;
{
  register int rc;
  char tokenbuf[5100];
  rc = match(tokenbuf, str);
  pbstr(tokenbuf);
  return (rc);
}


x86 assembly (clang, -O0):
<look>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1400,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x1400(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1030 <match@plt>
mov    %eax,-0xc(%rbp)
lea    -0x1400(%rbp),%rdi
mov    $0x0,%al
call   1040 <pbstr@plt>
mov    -0xc(%rbp),%eax
add    $0x1400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<look>:
push   %rbp
push   %rbx
sub    $0x13f8,%rsp
mov    %rdi,%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <match@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <pbstr@plt>
mov    %ebp,%eax
add    $0x13f8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @look(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [5100 x i8]
store i8* %0, i8** %2
%5 = getelementptr inbounds [5100 x i8], [5100 x i8]* %4, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @match to i32 (i8*, i8*, ...)*)(i8* %5, i8* %6)
store i32 %7, i32* %3
%8 = getelementptr inbounds [5100 x i8], [5100 x i8]* %4, i64 0, i64 0
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @pbstr to i32 (i8*, ...)*)(i8* %8)
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @look(i8* %0) {
%2 = alloca [5100 x i8]
%3 = getelementptr inbounds [5100 x i8], [5100 x i8]* %2, i64 0, i64 0
%4 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @match to i32 (i8*, i8*, ...)*)(i8* %3, i8* %0)
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @pbstr to i32 (i8*, ...)*)(i8* %3)
ret i32 %4
}
/* Variables and functions */
double d1mach_(int *);
double D1MACH(int *i) { return d1mach_(i); }


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

x86 assembly (clang, -O2):
<D1MACH>:
jmp    1030 <d1mach_@plt>

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

LLVM IR (-O2):
define double @D1MACH(i32* %0) {
%2 = tail call double @d1mach_(i32* %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  static int count = 1;
  printf("%d\n", count);
  count++;
  return main();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2efb(%rip),%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ee9(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ee0(%rip)
call   1040 <main@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2f11(%rip),%esi
lea    0xee2(%rip),%rbx
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    0x2efa(%rip),%esi
add    $0x1,%esi
mov    %esi,0x2ef1(%rip)
jmp    1120 <main+0x10>

LLVM IR (-O0):
@main.count = internal global i32 1
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @main.count
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = load i32, i32* @main.count
%5 = add nsw i32 %4, 1
store i32 %5, i32* @main.count
%6 = call i32 @main()
ret i32 %6
}

LLVM IR (-O2):
@main.count = internal unnamed_addr global i32 1
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = load i32, i32* @main.count
br label %2
2: ; preds = %2, %0
%3 = phi i32 [ %6, %2 ], [ %1, %0 ]
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @main.count
%6 = add nsw i32 %5, 1
store i32 %6, i32* @main.count
br label %2
}
const char *__malidrv_build_info(void) {
  return "malidrv:  API_VERSION=20 REPO_URL=r3p2-01rel1 REVISION=r3p2-01rel1 "
         "CHANGED_REVISION= CHANGE_DATE= BUILD_DATE=Sun May 12 13:29:07 CEST "
         "2013 BUILD=debug TARGET_PLATFORM=mali400-pmu MALI_PLATFORM= KDIR= "
         "OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=16 USING_UMP=y USING_PROFILING= "
         "USING_INTERNAL_PROFILING= USING_GPU_UTILIZATION=1 "
         "MALI_UPPER_HALF_SCHEDULING=1";
}


x86 assembly (clang, -O0):
<__malidrv_build_info>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__malidrv_build_info>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [346 x i8] c"malidrv: API_VERSION=20 REPO_URL=r3p2-01rel1 REVISION=r3p2-01rel1 CHANGED_REVISION= CHANGE_DATE= BUILD_DATE=Sun May 12 13:29:07 CEST 2013 BUILD=debug TARGET_PLATFORM=mali400-pmu MALI_PLATFORM= KDIR= OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=16 USING_UMP=y USING_PROFILING= USING_INTERNAL_PROFILING= USING_GPU_UTILIZATION=1 MALI_UPPER_HALF_SCHEDULING=1\00"
define i8* @__malidrv_build_info() {
ret i8* getelementptr inbounds ([346 x i8], [346 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [346 x i8] c"malidrv: API_VERSION=20 REPO_URL=r3p2-01rel1 REVISION=r3p2-01rel1 CHANGED_REVISION= CHANGE_DATE= BUILD_DATE=Sun May 12 13:29:07 CEST 2013 BUILD=debug TARGET_PLATFORM=mali400-pmu MALI_PLATFORM= KDIR= OS_MEMORY_KERNEL_BUFFER_SIZE_IN_MB=16 USING_UMP=y USING_PROFILING= USING_INTERNAL_PROFILING= USING_GPU_UTILIZATION=1 MALI_UPPER_HALF_SCHEDULING=1\00"
define i8* @__malidrv_build_info() {
ret i8* getelementptr inbounds ([346 x i8], [346 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ locale_t;

/* Variables and functions */
int /*<<< orphan*/ anvil_syslog(int /*<<< orphan*/, char *);
locale_t duplocale(locale_t locobj) {
  anvil_syslog(0, "duplocale\n");
  while (1)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<duplocale>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %edi,%edi
lea    0xedc(%rip),%rsi
call   1030 <anvil_syslog@plt>
jmp    1129 <duplocale+0x19>

x86 assembly (clang, -O2):
<duplocale>:
push   %rax
lea    0xee8(%rip),%rsi
xor    %edi,%edi
call   1030 <anvil_syslog@plt>
nop
jmp    1120 <duplocale+0x10>

LLVM IR (-O0):
@.str = [11 x i8] c"duplocale\0A\00"
define i32 @duplocale(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @anvil_syslog(i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %1, %4
br label %4
}

LLVM IR (-O2):
@.str = [11 x i8] c"duplocale\0A\00"
define i32 @duplocale(i32 %0) {
%2 = tail call i32 @anvil_syslog(i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %1, %3
br label %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
size_t fwrite(void const *, size_t, size_t, int /*<<< orphan*/ *);
void myfwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) {
  size_t bytes_written = fwrite(ptr, size, nmemb, stream);
  assert(bytes_written == nmemb);
}


x86 assembly (clang, -O0):
<myfwrite>:
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    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1040 <fwrite@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myfwrite>:
push   %rbx
mov    %rdx,%rbx
call   1040 <fwrite@plt>
xor    %edi,%edi
cmp    %rbx,%rax
sete   %dil
pop    %rbx
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @myfwrite(i8* %0, i64 %1, i64 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32*
%9 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i32* %3, i32** %8
%10 = load i8*, i8** %5
%11 = load i64, i64* %6
%12 = load i64, i64* %7
%13 = load i32*, i32** %8
%14 = call i64 @fwrite(i8* %10, i64 %11, i64 %12, i32* %13)
store i64 %14, i64* %9
%15 = load i64, i64* %9
%16 = load i64, i64* %7
%17 = icmp eq i64 %15, %16
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
ret void
}

LLVM IR (-O2):
define void @myfwrite(i8* nocapture %0, i64 %1, i64 %2, i32* nocapture %3) {
%5 = tail call i64 @fwrite(i8* %0, i64 %1, i64 %2, i32* %3)
%6 = icmp eq i64 %5, %2
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ol(char *);
zret() { ol("RET"); }


x86 assembly (clang, -O0):
<zret>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <ol@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"RET\00"
define i32 @zret() {
%1 = alloca i32
%2 = call i32 @ol(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [4 x i8] c"RET\00"
define i32 @zret() {
%1 = tail call i32 @ol(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ border_set_mask(int /*<<< orphan*/ volatile, int);
void border_set_bit(volatile uint32_t reg, uint8_t bit) {
  border_set_mask(reg, 1 << bit);
}


x86 assembly (clang, -O0):
<border_set_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%ecx
mov    $0x1,%esi
shl    %cl,%esi
call   1030 <border_set_mask@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<border_set_bit>:
mov    %esi,%ecx
mov    %edi,-0x4(%rsp)
mov    -0x4(%rsp),%edi
mov    $0x1,%esi
shl    %cl,%esi
jmp    1030 <border_set_mask@plt>

LLVM IR (-O0):
define void @border_set_bit(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store volatile i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load volatile i32, i32* %3
%6 = load i32, i32* %4
%7 = shl i32 1, %6
%8 = call i32 @border_set_mask(i32 %5, i32 %7)
ret void
}

LLVM IR (-O2):
define void @border_set_bit(i32 %0, i32 %1) {
%3 = alloca i32
store volatile i32 %0, i32* %3
%4 = load volatile i32, i32* %3
%5 = shl nuw i32 1, %1
%6 = tail call i32 @border_set_mask(i32 %4, i32 %5)
ret void
}
/* Type definitions */
struct XbusParserCallback {
  int dummy;
};
struct XbusParser {
  int dummy;
};

/* Variables and functions */
struct XbusParser *XbusParser_init(void *, struct XbusParserCallback const *);
int /*<<< orphan*/ XbusParser_mem();
void *malloc(int /*<<< orphan*/);
struct XbusParser *
XbusParser_create(struct XbusParserCallback const *callback) {
  void *mem = malloc(XbusParser_mem());
  if (mem) {
    return XbusParser_init(mem, callback);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<XbusParser_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <XbusParser_mem@plt>
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     116f <XbusParser_create+0x3f>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <XbusParser_init@plt>
mov    %rax,-0x8(%rbp)
jmp    1177 <XbusParser_create+0x47>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XbusParser_create>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <XbusParser_mem@plt>
mov    %eax,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1153 <XbusParser_create+0x23>
mov    %rax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <XbusParser_init@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.XbusParser = type { i32 }
%struct.XbusParserCallback = type { i32 }
define %struct.XbusParser* @XbusParser_create(%struct.XbusParserCallback* %0) {
%2 = alloca %struct.XbusParser*
%3 = alloca %struct.XbusParserCallback*
%4 = alloca i8*
store %struct.XbusParserCallback* %0, %struct.XbusParserCallback** %3
%5 = call i32 (...) @XbusParser_mem()
%6 = call i8* @malloc(i32 %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i8*, i8** %4
%11 = load %struct.XbusParserCallback*, %struct.XbusParserCallback** %3
%12 = call %struct.XbusParser* @XbusParser_init(i8* %10, %struct.XbusParserCallback* %11)
store %struct.XbusParser* %12, %struct.XbusParser** %2
br label %14
13: ; preds = %1
store %struct.XbusParser* null, %struct.XbusParser** %2
br label %14
14: ; preds = %13, %9
%15 = load %struct.XbusParser*, %struct.XbusParser** %2
ret %struct.XbusParser* %15
}

LLVM IR (-O2):
%struct.XbusParser = type { i32 }
%struct.XbusParserCallback = type { i32 }
define %struct.XbusParser* @XbusParser_create(%struct.XbusParserCallback* %0) {
%2 = tail call i32 (...) @XbusParser_mem()
%3 = tail call i8* @malloc(i32 %2)
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call %struct.XbusParser* @XbusParser_init(i8* %3, %struct.XbusParserCallback* %0)
br label %7
7: ; preds = %1, %5
%8 = phi %struct.XbusParser* [ %6, %5 ], [ null, %1 ]
ret %struct.XbusParser* %8
}
/* Variables and functions */
int palindrom(char *);
int /*<<< orphan*/ printf(char *, char *, int);
int main(void) {
  char *test = "test";
  char *pal = "palap";
  printf("%s %d\n", test, palindrom(test));
  printf("%s %d\n", pal, palindrom(pal));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec4(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <palindrom@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <palindrom@plt>
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rbx
mov    %rbx,%rdi
call   1040 <palindrom@plt>
lea    0xed1(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
lea    0xeb7(%rip),%rbx
mov    %rbx,%rdi
call   1040 <palindrom@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"test\00"
@.str.1 = [6 x i8] c"palap\00"
@.str.2 = [7 x i8] c"%s %d\0A\00"
define i32 @main() {
%1 = tail call i32 @palindrom(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @palindrom(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
void tokenize(char *s, size_t l) {}


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

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

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

LLVM IR (-O2):
define void @tokenize(i8* nocapture %0, i64 %1) {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int random();
uint32_t random_u32(void) {
  uint32_t a, b;
  a = random();
  b = random();
  return ((a << 4) & (uint32_t)0xFFFF0000) | (b & (uint32_t)0xFFFF);
}


x86 assembly (clang, -O0):
<random_u32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <random@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <random@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x4,%eax
and    $0xffff0000,%eax
mov    -0x8(%rbp),%ecx
and    $0xffff,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_u32>:
push   %rbx
xor    %eax,%eax
call   1030 <random@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <random@plt>
shl    $0x4,%ebx
and    $0xffff0000,%ebx
movzwl %ax,%eax
or     %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @random_u32() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @random()
store i32 %3, i32* %1
%4 = call i32 (...) @random()
store i32 %4, i32* %2
%5 = load i32, i32* %1
%6 = shl i32 %5, 4
%7 = and i32 %6, -65536
%8 = load i32, i32* %2
%9 = and i32 %8, 65535
%10 = or i32 %7, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @random_u32() {
%1 = tail call i32 (...) @random()
%2 = tail call i32 (...) @random()
%3 = shl i32 %1, 4
%4 = and i32 %3, -65536
%5 = and i32 %2, 65535
%6 = or i32 %4, %5
ret i32 %6
}
unsigned long hash_djb2(unsigned char *str) {
  unsigned long hash = 5381;
  int c;
  while ((c = *str++) != 0) {
    hash = ((hash << 5) + hash) + c;
  }
  return hash;
}


x86 assembly (clang, -O0):
<hash_djb2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1505,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     114a <hash_djb2+0x4a>
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
add    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <hash_djb2+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_djb2>:
mov    (%rdi),%cl
test   %cl,%cl
je     112c <hash_djb2+0x2c>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %rax,%rdx
shl    $0x5,%rdx
add    %rax,%rdx
movzbl %cl,%eax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash_djb2+0x10>
ret
mov    $0x1505,%eax
ret

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

LLVM IR (-O2):
define i64 @hash_djb2(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = phi i64 [ %11, %4 ], [ 5381, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = mul i64 %7, 33
%10 = zext i8 %5 to i64
%11 = add i64 %9, %10
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 5381, %1 ], [ %11, %4 ]
ret i64 %15
}
/* Variables and functions */
int /*<<< orphan*/ my_putstr_fail(char *);
int exit_malloc() {
  my_putstr_fail("Error : malloc fail.\n");
  return (-1);
}


x86 assembly (clang, -O0):
<exit_malloc>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <my_putstr_fail@plt>
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exit_malloc>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <my_putstr_fail@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Error : malloc fail.\0A\00"
define i32 @exit_malloc() {
%1 = call i32 @my_putstr_fail(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@.str = [22 x i8] c"Error : malloc fail.\0A\00"
define i32 @exit_malloc() {
%1 = tail call i32 @my_putstr_fail(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}
int test_imm_57int64_midword_reg(long long val) {
  return ((val >> 16) & (0x57 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_57int64_midword_reg(i64 %0) {
%2 = and i64 %0, 5701632
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ remove(char *);
extern void singleton_remove_lock() { remove("/var/pushr/.lock"); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"/var/pushr/.lock\00"
define void @singleton_remove_lock() {
%1 = call i32 @remove(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"/var/pushr/.lock\00"
define void @singleton_remove_lock() {
%1 = tail call i32 @remove(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}
double round_double_uint(double a) { return (double)(unsigned int)a; }


x86 assembly (clang, -O0):
<round_double_uint>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%rax
mov    %eax,%eax
cvtsi2sd %rax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_double_uint>:
cvttsd2si %xmm0,%rax
mov    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
ret

LLVM IR (-O0):
define double @round_double_uint(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptoui double %3 to i32
%5 = uitofp i32 %4 to double
ret double %5
}

LLVM IR (-O2):
define double @round_double_uint(double %0) {
%2 = fptoui double %0 to i32
%3 = uitofp i32 %2 to double
ret double %3
}
void brcm_pm_sata_add(void) {}


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

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

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

LLVM IR (-O2):
define void @brcm_pm_sata_add() {
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t calc_hash(const char *str) {
  uint16_t h = 0;
  while (*str != '\0') {
    h = h * 17 + *str++;
  }
  return h;
}


x86 assembly (clang, -O0):
<calc_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     113f <calc_hash+0x3f>
imul   $0x11,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <calc_hash+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <calc_hash+0x28>
add    $0x1,%rdi
xor    %edx,%edx
mov    %edx,%eax
xchg   %ax,%ax
movsbl %cl,%ecx
shl    $0x4,%eax
add    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
mov    %eax,%edx
test   %cl,%cl
jne    1110 <calc_hash+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @calc_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %10, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = mul nsw i32 %6, 17
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = add nsw i32 %9, %8
%12 = load i8, i8* %10
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 0, %1 ], [ %11, %4 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ error(int, char *, char *);
int write(int, char *, int);
void mwrite(int fd, char *address, int bytes) {
  if (write(fd, address, bytes) != bytes && bytes != 0)
    error(1, "Write error", ((char *)0));
}


x86 assembly (clang, -O0):
<mwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <write@plt>
cmp    -0x14(%rbp),%eax
je     1169 <mwrite+0x49>
cmpl   $0x0,-0x14(%rbp)
je     1169 <mwrite+0x49>
mov    $0x1,%edi
lea    0xea0(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mwrite>:
push   %rbx
mov    %edx,%ebx
call   1030 <write@plt>
test   %ebx,%ebx
je     1144 <mwrite+0x24>
cmp    %ebx,%eax
je     1144 <mwrite+0x24>
lea    0xec9(%rip),%rsi
mov    $0x1,%edi
xor    %edx,%edx
pop    %rbx
jmp    1040 <error@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"Write error\00"
define void @mwrite(i32 %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %2)
%5 = icmp ne i32 %4, %2
%6 = icmp ne i32 %2, 0
%7 = and i1 %6, %5
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = tail call i32 @error(i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* null)
br label %10
10: ; preds = %8, %3
ret void
}