xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ strcasecmp(char *, char *);
bool match_png_suffix(char *suffix) {
  return (strcasecmp(suffix, ".png") == 0);
}


x86 assembly (clang, -O0):
<match_png_suffix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_png_suffix>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <strcasecmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c".png\00"
define i32 @match_png_suffix(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strcasecmp(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@.str = [5 x i8] c".png\00"
define i32 @match_png_suffix(i8* nocapture %0) {
%2 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
void fglog(const char *fmt, ...) { return; }


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

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

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

LLVM IR (-O2):
define void @fglog(i8* nocapture %0, ...) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
void initFile(FILE *file) { rewind(file); }


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

x86 assembly (clang, -O2):
<initFile>:
jmp    1030 <rewind@plt>

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

LLVM IR (-O2):
define void @initFile(i32* nocapture %0) {
%2 = tail call i32 @rewind(i32* %0)
ret void
}
/* Variables and functions */
scalar_t__ is_leap(int);
int __attribute__((no)) seconds_in_year(int y) {
  int n = is_leap(y) ? 366 : 365;
  return n * 675 << 7;
}


x86 assembly (clang, -O0):
<seconds_in_year>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <is_leap@plt>
mov    %rax,%rdx
mov    $0x16d,%eax
mov    $0x16e,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x8(%rbp)
imul   $0x2a3,-0x8(%rbp),%eax
shl    $0x7,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seconds_in_year>:
push   %rax
call   1030 <is_leap@plt>
test   %rax,%rax
mov    $0x1e13380,%ecx
mov    $0x1e28500,%eax
cmove  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @seconds_in_year(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 @is_leap(i32 %4)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 366, i32 365
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = mul nsw i32 %9, 675
%11 = shl i32 %10, 7
ret i32 %11
}

LLVM IR (-O2):
define i32 @seconds_in_year(i32 %0) {
%2 = tail call i64 @is_leap(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 31536000, i32 31622400
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ forward_ref();
int /*<<< orphan*/ printf(char *);
void forward_test() {
  printf("forward:\n");
  forward_ref();
  forward_ref();
}


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"forward:\0A\00"
define void @forward_test() {
%1 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @forward_ref()
%3 = call i32 (...) @forward_ref()
ret void
}

LLVM IR (-O2):
@str = [9 x i8] c"forward:\00"
define void @forward_test() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @forward_ref()
%3 = tail call i32 (...) @forward_ref()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ClearSaveSlot(int);
void SV_ClearRebornSlot(void) { ClearSaveSlot(7); }


x86 assembly (clang, -O0):
<SV_ClearRebornSlot>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7,%edi
call   1030 <ClearSaveSlot@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SV_ClearRebornSlot>:
mov    $0x7,%edi
jmp    1030 <ClearSaveSlot@plt>

LLVM IR (-O0):
define void @SV_ClearRebornSlot() {
%1 = call i32 @ClearSaveSlot(i32 7)
ret void
}

LLVM IR (-O2):
define void @SV_ClearRebornSlot() {
%1 = tail call i32 @ClearSaveSlot(i32 7)
ret void
}
double geom_J2_cyl_rpz_B(double x[], int dir) { return x[0]; }


x86 assembly (clang, -O0):
<geom_J2_cyl_rpz_B>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<geom_J2_cyl_rpz_B>:
movsd  (%rdi),%xmm0
ret

LLVM IR (-O0):
define double @geom_J2_cyl_rpz_B(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%5 = load double*, double** %3
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
ret double %7
}

LLVM IR (-O2):
define double @geom_J2_cyl_rpz_B(double* nocapture %0, i32 %1) {
%3 = load double, double* %0
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ sleep(int);
scalar_t__ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
void sig_handler(int sig) {
  while (waitpid(-1, NULL, WNOHANG) > 0)
    sleep(10);
}


x86 assembly (clang, -O0):
<sig_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <waitpid@plt>
cmp    $0x0,%rax
jle    115b <sig_handler+0x3b>
mov    $0xa,%edi
call   1040 <sleep@plt>
jmp    112b <sig_handler+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_handler>:
push   %rbx
mov    0x2ec0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%edx
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1030 <waitpid@plt>
test   %rax,%rax
jle    114f <sig_handler+0x2f>
mov    $0xa,%edi
call   1040 <sleep@plt>
jmp    1130 <sig_handler+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
define void @sig_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load i32, i32* @WNOHANG
%5 = call i64 @waitpid(i32 -1, i32* null, i32 %4)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = call i32 @sleep(i32 10)
br label %3
9: ; preds = %3
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
define void @sig_handler(i32 %0) {
%2 = load i32, i32* @WNOHANG
%3 = tail call i64 @waitpid(i32 -1, i32* null, i32 %2)
%4 = icmp sgt i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1, %5
%6 = tail call i32 @sleep(i32 10)
%7 = load i32, i32* @WNOHANG
%8 = tail call i64 @waitpid(i32 -1, i32* null, i32 %7)
%9 = icmp sgt i64 %8, 0
br i1 %9, label %5, label %10
10: ; preds = %5, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ console_printf(char *, unsigned long, unsigned long,
                                  unsigned long);
int /*<<< orphan*/ hlt();
void vmem_pagefault_handler(void *ip, void *addr, unsigned long errcode) {
  console_printf("page fault: ip=%x, addr=%x, errcode=%x.\n", (unsigned long)ip,
                 (unsigned long)addr, (unsigned long)errcode);
  while (1) {
    hlt();
  }
}


x86 assembly (clang, -O0):
<vmem_pagefault_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xeb9(%rip),%rdi
call   1040 <console_printf@plt>
mov    $0x0,%al
call   1030 <hlt@plt>
jmp    114c <vmem_pagefault_handler+0x2c>

x86 assembly (clang, -O2):
<vmem_pagefault_handler>:
push   %rax
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xecf(%rip),%rdi
call   1040 <console_printf@plt>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <hlt@plt>
jmp    1140 <vmem_pagefault_handler+0x20>

LLVM IR (-O0):
@.str = [41 x i8] c"page fault: ip=%x, addr=%x, errcode=%x.\0A\00"
define void @vmem_pagefault_handler(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = ptrtoint i8* %7 to i64
%9 = load i8*, i8** %5
%10 = ptrtoint i8* %9 to i64
%11 = load i64, i64* %6
%12 = call i32 @console_printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i64 %8, i64 %10, i64 %11)
br label %13
13: ; preds = %3, %13
%14 = call i32 (...) @hlt()
br label %13
}

LLVM IR (-O2):
@.str = [41 x i8] c"page fault: ip=%x, addr=%x, errcode=%x.\0A\00"
define void @vmem_pagefault_handler(i8* %0, i8* %1, i64 %2) {
%4 = ptrtoint i8* %0 to i64
%5 = ptrtoint i8* %1 to i64
%6 = tail call i32 @console_printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i64 %4, i64 %5, i64 %2)
br label %7
7: ; preds = %3, %7
%8 = tail call i32 (...) @hlt()
br label %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int atoi(char *);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int getbattery() {
  FILE *pp;
  char *line;
  char buf[1000];
  pp = popen("apm -l", "r");
  if (pp != NULL) {
    line = fgets(buf, sizeof buf, pp);
    pclose(pp);
  }
  return atoi(line);
}


x86 assembly (clang, -O0):
<getbattery>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
lea    0xeae(%rip),%rdi
lea    0xeae(%rip),%rsi
call   1050 <popen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     118f <getbattery+0x4f>
lea    -0x400(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x3e8,%esi
call   1040 <fgets@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pclose@plt>
mov    -0x10(%rbp),%rdi
call   1060 <atoi@plt>
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getbattery>:
push   %r14
push   %rbx
sub    $0x3e8,%rsp
lea    0xeaf(%rip),%rdi
lea    0xeaf(%rip),%rsi
call   1050 <popen@plt>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    $0x3e8,%esi
mov    %rax,%rdx
call   1040 <fgets@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <pclose@plt>
mov    %r14,%rdi
call   1060 <atoi@plt>
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"apm -l\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @getbattery() {
%1 = alloca i32*
%2 = alloca i8*
%3 = alloca [1000 x i8]
%4 = call i32* @popen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %1
%5 = load i32*, i32** %1
%6 = icmp ne i32* %5, null
br i1 %6, label %7, label %13
7: ; preds = %0
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%9 = load i32*, i32** %1
%10 = call i8* @fgets(i8* %8, i32 1000, i32* %9)
store i8* %10, i8** %2
%11 = load i32*, i32** %1
%12 = call i32 @pclose(i32* %11)
br label %13
13: ; preds = %7, %0
%14 = load i8*, i8** %2
%15 = call i32 @atoi(i8* %14)
ret i32 %15
}

LLVM IR (-O2):
@.str = [7 x i8] c"apm -l\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @getbattery() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @popen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp ne i32* %3, null
tail call void @llvm.assume(i1 %4)
%5 = call i8* @fgets(i8* %2, i32 1000, i32* %3)
%6 = call i32 @pclose(i32* %3)
%7 = call i32 @atoi(i8* %5)
ret i32 %7
}
/* Variables and functions */
int isMatch(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  printf("%d\n", isMatch(argv[1], argv[2]));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <isMatch@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1030 <isMatch@plt>
lea    0xecb(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8*, i8** %1, i64 2
%6 = load i8*, i8** %5
%7 = tail call i32 @isMatch(i8* %4, i8* %6)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
__attribute__((always_)) void BME_XOR_H(volatile uint16_t *addr,
                                        register uint16_t wdata) {
  *(volatile uint16_t *)((uint32_t)addr | (3 << 26)) = wdata;
}


x86 assembly (clang, -O0):
<BME_XOR_H>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
or     $0xc000000,%eax
cltq
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<BME_XOR_H>:
movslq %edi,%rax
or     $0xc000000,%rax
mov    %esi,(%rax)
ret

LLVM IR (-O0):
define void @BME_XOR_H(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32*, i32** %3
%7 = ptrtoint i32* %6 to i32
%8 = or i32 %7, 201326592
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
store volatile i32 %5, i32* %10
ret void
}

LLVM IR (-O2):
define void @BME_XOR_H(i32* %0, i32 %1) {
%3 = ptrtoint i32* %0 to i64
%4 = shl i64 %3, 32
%5 = ashr exact i64 %4, 32
%6 = or i64 %5, 201326592
%7 = inttoptr i64 %6 to i32*
store volatile i32 %1, i32* %7
ret void
}
/* Type definitions */
struct gdev_list {
  int dummy;
};

/* Variables and functions */
void gdev_list_add_next(struct gdev_list *, struct gdev_list *);
void gdev_list_add(struct gdev_list *entry, struct gdev_list *head) {
  return gdev_list_add_next(entry, head);
}


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

x86 assembly (clang, -O2):
<gdev_list_add>:
jmp    1030 <gdev_list_add_next@plt>

LLVM IR (-O0):
%struct.gdev_list = type { i32 }
define void @gdev_list_add(%struct.gdev_list* %0, %struct.gdev_list* %1) {
%3 = alloca %struct.gdev_list*
%4 = alloca %struct.gdev_list*
store %struct.gdev_list* %0, %struct.gdev_list** %3
store %struct.gdev_list* %1, %struct.gdev_list** %4
%5 = load %struct.gdev_list*, %struct.gdev_list** %3
%6 = load %struct.gdev_list*, %struct.gdev_list** %4
ret void
}

LLVM IR (-O2):
%struct.gdev_list = type { i32 }
define void @gdev_list_add(%struct.gdev_list* %0, %struct.gdev_list* %1) {
tail call void @gdev_list_add_next(%struct.gdev_list* %0, %struct.gdev_list* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ findmax();
int main() {
  int max, min;
  findmax();
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @findmax()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @findmax()
ret i32 0
}
/* Variables and functions */
char *U_WMRCORENONE_set(char *);
char *U_WMRE4_set(void) { return U_WMRCORENONE_set("U_WMRE4"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMRE4\00"
define i8* @U_WMRE4_set() {
%1 = call i8* @U_WMRCORENONE_set(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMRE4\00"
define i8* @U_WMRE4_set() {
%1 = tail call i8* @U_WMRCORENONE_set(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
/* Variables and functions */
char *get_nxt_word(int /*<<< orphan*/);
int /*<<< orphan*/ strcasecmp(char *, char *);
int skip_macro() {
  char *str;
  while (1) {
    str = get_nxt_word(0);
    if (!strcasecmp((str), (".ENDM")))
      break;
  }
  return 1;
}


x86 assembly (clang, -O0):
<skip_macro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1040 <get_nxt_word@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1151 <skip_macro+0x31>
jmp    1156 <skip_macro+0x36>
jmp    1128 <skip_macro+0x8>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_macro>:
push   %rbx
lea    0xed8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
call   1040 <get_nxt_word@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strcasecmp@plt>
test   %eax,%eax
jne    1130 <skip_macro+0x10>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c".ENDM\00"
define i32 @skip_macro() {
%1 = alloca i8*
br label %2
2: ; preds = %0, %8
%3 = call i8* @get_nxt_word(i32 0)
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i32 @strcasecmp(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %2
br label %9
8: ; preds = %2
br label %2
9: ; preds = %7
ret i32 1
}

LLVM IR (-O2):
@.str = [6 x i8] c".ENDM\00"
define i32 @skip_macro() {
br label %1
1: ; preds = %1, %0
%2 = tail call i8* @get_nxt_word(i32 0)
%3 = tail call i32 @strcasecmp(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %1
5: ; preds = %1
ret i32 1
}
int greaterOrEqual(int x, int y) { return (x >= y) ? 1 : 0; }


x86 assembly (clang, -O0):
<greaterOrEqual>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%esi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmovge %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<greaterOrEqual>:
xor    %eax,%eax
cmp    %esi,%edi
setge  %al
ret

LLVM IR (-O0):
define i32 @greaterOrEqual(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sge i32 %5, %6
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 1, i32 0
ret i32 %9
}

LLVM IR (-O2):
define i32 @greaterOrEqual(i32 %0, i32 %1) {
%3 = icmp sge i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int test_sat_parser_should_fail(char *);
int test07(void) { return test_sat_parser_should_fail("(a or - b)"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"(a or - b)\00"
define i32 @test07() {
%1 = call i32 @test_sat_parser_should_fail(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [11 x i8] c"(a or - b)\00"
define i32 @test07() {
%1 = tail call i32 @test_sat_parser_should_fail(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
int main() {
  void *p = bar();
  p1();
  p2();
  p3();
  if (p != p1)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <bar@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1070 <p1@plt>
mov    $0x0,%al
call   1050 <p2@plt>
mov    $0x0,%al
call   1060 <p3@plt>
mov    0x2e70(%rip),%rax
cmp    %rax,-0x10(%rbp)
je     1187 <main+0x47>
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <bar@plt>
movslq %eax,%rbx
xor    %eax,%eax
call   1070 <p1@plt>
xor    %eax,%eax
call   1050 <p2@plt>
xor    %eax,%eax
call   1060 <p3@plt>
cmp    0x2e81(%rip),%rbx
jne    116d <main+0x2d>
xor    %eax,%eax
pop    %rbx
ret
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i32 (...) @bar()
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %2
%6 = call i32 (...) @p1()
%7 = call i32 (...) @p2()
%8 = call i32 (...) @p3()
%9 = load i8*, i8** %2
%10 = icmp ne i8* %9, bitcast (i32 (...)* @p1 to i8*)
br i1 %10, label %11, label %12
11: ; preds = %0
unreachable
12: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @bar()
%2 = sext i32 %1 to i64
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 (...) @p1()
%5 = tail call i32 (...) @p2()
%6 = tail call i32 (...) @p3()
%7 = icmp eq i8* %3, bitcast (i32 (...)* @p1 to i8*)
br i1 %7, label %9, label %8
8: ; preds = %0
tail call void @abort()
unreachable
9: ; preds = %0
ret i32 0
}
/* Type definitions */
typedef scalar_t__ int64_t;

/* Variables and functions */
scalar_t__ strtoll(char *, int /*<<< orphan*/ *, int);
int str2big(int64_t *pnum, char *str) {
  *pnum = strtoll(str, NULL, 10);
  return *pnum == 0 && str[0] != '0';
}


x86 assembly (clang, -O0):
<str2big>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <strtoll@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmpq   $0x0,(%rcx)
mov    %al,-0x11(%rbp)
jne    115f <str2big+0x4f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str2big>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtoll@plt>
mov    %rax,(%r15)
test   %rax,%rax
jne    113d <str2big+0x2d>
xor    %ebx,%ebx
cmpb   $0x30,(%r14)
setne  %bl
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @str2big(i64* %0, i8* %1) {
%3 = alloca i64*
%4 = alloca i8*
store i64* %0, i64** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i64 @strtoll(i8* %5, i32* null, i32 10)
%7 = load i64*, i64** %3
store i64 %6, i64* %7
%8 = load i64*, i64** %3
%9 = load i64, i64* %8
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 48
br label %17
17: ; preds = %11, %2
%18 = phi i1 [ false, %2 ], [ %16, %11 ]
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @str2big(i64* nocapture writeonly %0, i8* nocapture %1) {
%3 = tail call i64 @strtoll(i8* nocapture %1, i32* null, i32 10)
store i64 %3, i64* %0
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i8, i8* %1
%7 = icmp ne i8 %6, 48
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %5, %2
%10 = phi i32 [ 0, %2 ], [ %8, %5 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ lmsc_pfe_setopt(int);
int /*<<< orphan*/ lmsc_pfo_setopt(int);
void lmsc_pf_setup(int dopfo, int dopfe) {
  lmsc_pfo_setopt(dopfo);
  lmsc_pfe_setopt(dopfe);
}


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

x86 assembly (clang, -O2):
<lmsc_pf_setup>:
push   %rbx
mov    %esi,%ebx
call   1030 <lmsc_pfo_setopt@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <lmsc_pfe_setopt@plt>

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

LLVM IR (-O2):
define void @lmsc_pf_setup(i32 %0, i32 %1) {
%3 = tail call i32 @lmsc_pfo_setopt(i32 %0)
%4 = tail call i32 @lmsc_pfe_setopt(i32 %1)
ret void
}
void ui_joystick_end(void) {}


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

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

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

LLVM IR (-O2):
define void @ui_joystick_end() {
ret void
}
void my_memcpy(char *dst, const char *src, unsigned int len) {
  if (len < 8)
    __builtin_abort();
  __builtin_memcpy(dst, src, len);
}


x86 assembly (clang, -O0):
<my_memcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jae    1142 <my_memcpy+0x22>
call   1030 <abort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%eax
mov    %eax,%edx
call   1040 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_memcpy>:
cmp    $0x7,%edx
jbe    112c <my_memcpy+0xc>
mov    %edx,%edx
jmp    1040 <memcpy@plt>
push   %rax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define void @my_memcpy(i8* nocapture writeonly %0, i8* nocapture %1, i32 %2) {
%4 = icmp ult i32 %2, 8
br i1 %4, label %5, label %6
5: ; preds = %3
tail call void @abort()
unreachable
6: ; preds = %3
%7 = zext i32 %2 to i64
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 %1, i64 %7, i1 false)
ret void
}
const char *dbg_snprintf_key(const struct ubifs_info *c,
                             const union ubifs_key *key, char *buffer,
                             int len) {
  return "";
}


x86 assembly (clang, -O0):
<dbg_snprintf_key>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
lea    0xee6(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.ubifs_info = type opaque
%union.ubifs_key = type opaque
@.str = [1 x i8] zeroinitializer
define i8* @dbg_snprintf_key(%struct.ubifs_info* %0, %union.ubifs_key* %1, i8* %2, i32 %3) {
%5 = alloca %struct.ubifs_info*
%6 = alloca %union.ubifs_key*
%7 = alloca i8*
%8 = alloca i32
store %struct.ubifs_info* %0, %struct.ubifs_info** %5
store %union.ubifs_key* %1, %union.ubifs_key** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.ubifs_info = type opaque
%union.ubifs_key = type opaque
@.str = [1 x i8] zeroinitializer
define i8* @dbg_snprintf_key(%struct.ubifs_info* nocapture readnone %0, %union.ubifs_key* nocapture readnone %1, i8* nocapture readnone %2, i32 %3) {
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}
int isgraph(int c) { return (c > 0x20 && c < 0x7F); }


x86 assembly (clang, -O0):
<isgraph>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jle    1120 <isgraph+0x20>
cmpl   $0x7f,-0x4(%rbp)
setl   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isgraph>:
add    $0xffffffdf,%edi
xor    %eax,%eax
cmp    $0x5e,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @isgraph(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 32
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 127
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @isgraph(i32 %0) {
%2 = add i32 %0, -33
%3 = icmp ult i32 %2, 94
%4 = zext i1 %3 to i32
ret i32 %4
}
int test_imm_A8uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0xA8 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_A8uint64_lowword_mem>:
testb  $0xa8,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_A8uint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 168
%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_A8uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 168
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void sigusr_handler(int sig) {
  printf("Handler: signal %i received.\n", sig);
  return;
}


x86 assembly (clang, -O0):
<sigusr_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigusr_handler>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"Handler: signal %i received.\0A\00"
define void @sigusr_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Handler: signal %i received.\0A\00"
define void @sigusr_handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
int commentp(char *s) { return s[0] != '\0' && s[0] == '#'; }


x86 assembly (clang, -O0):
<commentp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     112d <commentp+0x2d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<commentp>:
xor    %eax,%eax
cmpb   $0x23,(%rdi)
sete   %al
ret

LLVM IR (-O0):
define i32 @commentp(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 35
br label %14
14: ; preds = %8, %1
%15 = phi i1 [ false, %1 ], [ %13, %8 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @commentp(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 35
%4 = zext i1 %3 to i32
ret i32 %4
}
char *strpbrk(const char *string, const char *stop) {
  for (; *string != '\0'; string++) {
    if (strchr(stop, *string) != ((void *)0))
      return (char *)string;
  }
  return ((void *)0);
}


x86 assembly (clang, -O0):
<strpbrk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     116d <strpbrk+0x5d>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     1157 <strpbrk+0x47>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1175 <strpbrk+0x65>
jmp    115c <strpbrk+0x4c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <strpbrk+0x10>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strpbrk>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     113c <strpbrk+0x2c>
mov    %rsi,%r14
mov    %rdi,%rbx
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
jne    113e <strpbrk+0x2e>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <strpbrk+0x10>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @strpbrk(i8* %0, i8* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %11
%6 = phi i8 [ %13, %11 ], [ %3, %2 ]
%7 = phi i8* [ %12, %11 ], [ %0, %2 ]
%8 = sext i8 %6 to i32
%9 = tail call i8* @strchr(i8* dereferenceable(1) %1, i32 %8)
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %7, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %11, %2
%16 = phi i8* [ null, %2 ], [ null, %11 ], [ %7, %5 ]
ret i8* %16
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char *, int);
void putc(int fd, char c) { write(fd, &c, 1); }


x86 assembly (clang, -O0):
<putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x5(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putc>:
push   %rax
mov    %sil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @putc(i32 %0, i8 signext %1) {
%3 = alloca i8
store i8 %1, i8* %3
%4 = call i32 @write(i32 %0, i8* %3, i32 1)
ret void
}
int strcmp(const char *s1, const char *s2) {
  for (int i = 0; s1[i] != '\0'; ++i) {
    if (s1[i] != s2[i]) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1167 <strcmp+0x67>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1154 <strcmp+0x54>
movl   $0x1,-0x4(%rbp)
jmp    116e <strcmp+0x6e>
jmp    1159 <strcmp+0x59>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1113 <strcmp+0x13>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
mov    (%rdi),%cl
test   %cl,%cl
je     1131 <strcmp+0x31>
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
mov    %ecx,%r8d
movzbl (%rsi,%rax,1),%edx
cmp    %dl,%cl
jne    1128 <strcmp+0x28>
movzbl 0x1(%rdi,%rax,1),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strcmp+0x10>
xor    %eax,%eax
cmp    %dl,%r8b
setne  %al
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %19, label %9
5: ; preds = %9
%6 = getelementptr inbounds i8, i8* %0, i64 %15
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %2, %5
%10 = phi i64 [ %15, %5 ], [ 0, %2 ]
%11 = phi i8 [ %7, %5 ], [ %3, %2 ]
%12 = getelementptr inbounds i8, i8* %1, i64 %10
%13 = load i8, i8* %12
%14 = icmp eq i8 %11, %13
%15 = add nuw i64 %10, 1
br i1 %14, label %5, label %16
16: ; preds = %9, %5
%17 = xor i1 %14, true
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %16, %2
%20 = phi i32 [ 0, %2 ], [ %18, %16 ]
ret i32 %20
}
/* Type definitions */
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
int spi_read_byte();
int /*<<< orphan*/ spi_write_byte(int);
uint16_t read_sram(uint32_t address) {
  uint16_t data = 0;
  spi_write_byte(0x03);
  spi_write_byte(address >> 16);
  spi_write_byte(address >> 8);
  spi_write_byte(address);
  data |= spi_read_byte() << 8;
  data |= spi_read_byte();
  return data;
}


x86 assembly (clang, -O0):
<read_sram>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x3,%edi
call   1040 <spi_write_byte@plt>
mov    -0x4(%rbp),%edi
sar    $0x10,%edi
call   1040 <spi_write_byte@plt>
mov    -0x4(%rbp),%edi
sar    $0x8,%edi
call   1040 <spi_write_byte@plt>
mov    -0x4(%rbp),%edi
call   1040 <spi_write_byte@plt>
mov    $0x0,%al
call   1030 <spi_read_byte@plt>
shl    $0x8,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <spi_read_byte@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_sram>:
push   %rbx
mov    %edi,%ebx
mov    $0x3,%edi
call   1040 <spi_write_byte@plt>
mov    %ebx,%edi
sar    $0x10,%edi
call   1040 <spi_write_byte@plt>
mov    %ebx,%edi
sar    $0x8,%edi
call   1040 <spi_write_byte@plt>
mov    %ebx,%edi
call   1040 <spi_write_byte@plt>
xor    %eax,%eax
call   1030 <spi_read_byte@plt>
mov    %eax,%ebx
shl    $0x8,%ebx
xor    %eax,%eax
call   1030 <spi_read_byte@plt>
or     %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @read_sram(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = call i32 @spi_write_byte(i32 3)
%5 = load i32, i32* %2
%6 = ashr i32 %5, 16
%7 = call i32 @spi_write_byte(i32 %6)
%8 = load i32, i32* %2
%9 = ashr i32 %8, 8
%10 = call i32 @spi_write_byte(i32 %9)
%11 = load i32, i32* %2
%12 = call i32 @spi_write_byte(i32 %11)
%13 = call i32 (...) @spi_read_byte()
%14 = shl i32 %13, 8
%15 = load i32, i32* %3
%16 = or i32 %15, %14
store i32 %16, i32* %3
%17 = call i32 (...) @spi_read_byte()
%18 = load i32, i32* %3
%19 = or i32 %18, %17
store i32 %19, i32* %3
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @read_sram(i32 %0) {
%2 = tail call i32 @spi_write_byte(i32 3)
%3 = ashr i32 %0, 16
%4 = tail call i32 @spi_write_byte(i32 %3)
%5 = ashr i32 %0, 8
%6 = tail call i32 @spi_write_byte(i32 %5)
%7 = tail call i32 @spi_write_byte(i32 %0)
%8 = tail call i32 (...) @spi_read_byte()
%9 = shl i32 %8, 8
%10 = tail call i32 (...) @spi_read_byte()
%11 = or i32 %9, %10
ret i32 %11
}
int is_spacing(char c) {
  if (c == '\t' || c == ' ')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_spacing>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
je     1124 <is_spacing+0x24>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    1130 <is_spacing+0x30>
movl   $0x1,-0x4(%rbp)
jmp    1137 <is_spacing+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_spacing>:
cmp    $0x20,%dil
sete   %al
cmp    $0x9,%dil
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @is_spacing(i8 signext %0) {
%2 = icmp eq i8 %0, 32
%3 = icmp eq i8 %0, 9
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *, char *);
void eight() {
  char *s = malloc(6);
  s[0] = 'H';
  s[1] = 'e';
  s[2] = 'l';
  s[3] = 'l';
  s[4] = 'o';
  s[5] = '\0';
  printf("%s\n", s);
  free(s);
}


x86 assembly (clang, -O0):
<eight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x6,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x48,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x65,0x1(%rax)
mov    -0x8(%rbp),%rax
movb   $0x6c,0x2(%rax)
mov    -0x8(%rbp),%rax
movb   $0x6c,0x3(%rax)
mov    -0x8(%rbp),%rax
movb   $0x6f,0x4(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0x5(%rax)
mov    -0x8(%rbp),%rsi
lea    0xe80(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eight>:
push   %rbx
mov    $0x6,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
movl   $0x6c6c6548,(%rax)
movw   $0x6f,0x4(%rax)
lea    0xeaf(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @eight() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 6)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = getelementptr inbounds i8, i8* %3, i64 0
store i8 72, i8* %4
%5 = load i8*, i8** %1
%6 = getelementptr inbounds i8, i8* %5, i64 1
store i8 101, i8* %6
%7 = load i8*, i8** %1
%8 = getelementptr inbounds i8, i8* %7, i64 2
store i8 108, i8* %8
%9 = load i8*, i8** %1
%10 = getelementptr inbounds i8, i8* %9, i64 3
store i8 108, i8* %10
%11 = load i8*, i8** %1
%12 = getelementptr inbounds i8, i8* %11, i64 4
store i8 111, i8* %12
%13 = load i8*, i8** %1
%14 = getelementptr inbounds i8, i8* %13, i64 5
store i8 0, i8* %14
%15 = load i8*, i8** %1
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i8*, i8** %1
%18 = call i32 @free(i8* %17)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @eight() {
%1 = tail call dereferenceable_or_null(6) i8* @malloc(i32 6)
store i8 72, i8* %1
%2 = getelementptr inbounds i8, i8* %1, i64 1
store i8 101, i8* %2
%3 = getelementptr inbounds i8, i8* %1, i64 2
store i8 108, i8* %3
%4 = getelementptr inbounds i8, i8* %1, i64 3
store i8 108, i8* %4
%5 = getelementptr inbounds i8, i8* %1, i64 4
store i8 111, i8* %5
%6 = getelementptr inbounds i8, i8* %1, i64 5
store i8 0, i8* %6
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
%8 = tail call i32 @free(i8* %1)
ret void
}
int roccat_connect(struct hid_device *hid) { return -1; }


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

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

LLVM IR (-O0):
%struct.hid_device = type opaque
define i32 @roccat_connect(%struct.hid_device* %0) {
%2 = alloca %struct.hid_device*
store %struct.hid_device* %0, %struct.hid_device** %2
ret i32 -1
}

LLVM IR (-O2):
%struct.hid_device = type opaque
define i32 @roccat_connect(%struct.hid_device* nocapture readnone %0) {
ret i32 -1
}