xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ wdt_enable();
int /*<<< orphan*/ wdt_reset();
void watchdog_enable(void) {
  wdt_enable();
  wdt_reset();
}


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

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

LLVM IR (-O0):
define void @watchdog_enable() {
%1 = call i32 (...) @wdt_enable()
%2 = call i32 (...) @wdt_reset()
ret void
}

LLVM IR (-O2):
define void @watchdog_enable() {
%1 = tail call i32 (...) @wdt_enable()
%2 = tail call i32 (...) @wdt_reset()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ BIGNUM;

/* Variables and functions */
int /*<<< orphan*/ BN_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ free(int /*<<< orphan*/ **);
void poly_free(BIGNUM **p) {
  int i;
  for (i = 0; i < 2; i++)
    BN_free(p[i]);
  free(p);
}


x86 assembly (clang, -O0):
<poly_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    115c <poly_free+0x3c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <BN_free@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <poly_free+0x13>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<poly_free>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1040 <BN_free@plt>
mov    0x8(%rbx),%rdi
call   1040 <BN_free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @poly_free(i32** nocapture %0) {
%2 = load i32*, i32** %0
%3 = tail call i32 @BN_free(i32* %2)
%4 = getelementptr inbounds i32*, i32** %0, i64 1
%5 = load i32*, i32** %4
%6 = tail call i32 @BN_free(i32* %5)
%7 = tail call i32 @free(i32** %0)
ret void
}
/* Variables and functions */
int real_execve(char const *, char const **, char const **);
int /*<<< orphan*/ unsetenv(char *);
int evil_execve(const char *filename, const char *argv[], const char *envp[]) {
  int ret = 0;
  unsetenv("LD_PRELOAD");
  ret = real_execve(filename, argv, envp);
  return ret;
}


x86 assembly (clang, -O0):
<evil_execve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xebe(%rip),%rdi
call   1040 <unsetenv@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <real_execve@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evil_execve>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xecb(%rip),%rdi
call   1040 <unsetenv@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <real_execve@plt>

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

LLVM IR (-O2):
@.str = [11 x i8] c"LD_PRELOAD\00"
define i32 @evil_execve(i8* %0, i8** %1, i8** %2) {
%4 = tail call i32 @unsetenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @real_execve(i8* %0, i8** %1, i8** %2)
ret i32 %5
}
/* Type definitions */
typedef int __u8;
typedef int __u16;

/* Variables and functions */
void capimsg_setu16(void *m, int off, __u16 val) {
  ((__u8 *)m)[off] = val & 0xff;
  ((__u8 *)m)[off + 1] = (val >> 8) & 0xff;
}


x86 assembly (clang, -O0):
<capimsg_setu16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%edx
and    $0xff,%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%edx
sar    $0x8,%edx
and    $0xff,%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<capimsg_setu16>:
movzbl %dl,%eax
movslq %esi,%rcx
mov    %eax,(%rdi,%rcx,4)
movzbl %dh,%eax
mov    %eax,0x4(%rdi,%rcx,4)
ret

LLVM IR (-O0):
define void @capimsg_setu16(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* %6
%8 = and i32 %7, 255
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32, i32* %10, i64 %12
store i32 %8, i32* %13
%14 = load i32, i32* %6
%15 = ashr i32 %14, 8
%16 = and i32 %15, 255
%17 = load i8*, i8** %4
%18 = bitcast i8* %17 to i32*
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %18, i64 %21
store i32 %16, i32* %22
ret void
}

LLVM IR (-O2):
define void @capimsg_setu16(i8* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = and i32 %2, 255
%5 = bitcast i8* %0 to i32*
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i32, i32* %5, i64 %6
store i32 %4, i32* %7
%8 = lshr i32 %2, 8
%9 = and i32 %8, 255
%10 = add nsw i32 %1, 1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %5, i64 %11
store i32 %9, i32* %12
ret void
}
/* Variables and functions */
double DONTUSE__NXSwapBigDoubleToLittleEndian(double);
double VSSwapHostDoubleToLittle(double x) {
  return (DONTUSE__NXSwapBigDoubleToLittleEndian(x));
}


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

x86 assembly (clang, -O2):
<VSSwapHostDoubleToLittle>:
jmp    1030 <DONTUSE__NXSwapBigDoubleToLittleEndian@plt>

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

LLVM IR (-O2):
define double @VSSwapHostDoubleToLittle(double %0) {
%2 = tail call double @DONTUSE__NXSwapBigDoubleToLittleEndian(double %0)
ret double %2
}
int CalculatedConst(void) {
  return (unsigned char)(0x100 - 4000000 / 307200.0 + .5);
}


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

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

LLVM IR (-O0):
define i32 @CalculatedConst() {
ret i32 243
}

LLVM IR (-O2):
define i32 @CalculatedConst() {
ret i32 243
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char const *);
int /*<<< orphan*/ free(char *);
char *get_pid_file(char const *, char const *);
FILE *open_pid_file(const char *pid_dir, const char *name, const char *mode) {
  if (pid_dir == NULL)
    return NULL;
  char *location = get_pid_file(pid_dir, name);
  FILE *pid_file = fopen(location, mode);
  free(location);
  return pid_file;
}


x86 assembly (clang, -O0):
<open_pid_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115c <open_pid_file+0x2c>
movq   $0x0,-0x8(%rbp)
jmp    118f <open_pid_file+0x5f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <get_pid_file@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <free@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_pid_file>:
test   %rdi,%rdi
je     1165 <open_pid_file+0x35>
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
call   1030 <get_pid_file@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <fopen@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32* @open_pid_file(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%10 = load i8*, i8** %5
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %3
store i32* null, i32** %4
br label %23
13: ; preds = %3
%14 = load i8*, i8** %5
%15 = load i8*, i8** %6
%16 = call i8* @get_pid_file(i8* %14, i8* %15)
store i8* %16, i8** %8
%17 = load i8*, i8** %8
%18 = load i8*, i8** %7
%19 = call i32* @fopen(i8* %17, i8* %18)
store i32* %19, i32** %9
%20 = load i8*, i8** %8
%21 = call i32 @free(i8* %20)
%22 = load i32*, i32** %9
store i32* %22, i32** %4
br label %23
23: ; preds = %13, %12
%24 = load i32*, i32** %4
ret i32* %24
}

LLVM IR (-O2):
define noalias i32* @open_pid_file(i8* %0, i8* %1, i8* nocapture %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = tail call i8* @get_pid_file(i8* %0, i8* %1)
%7 = tail call i32* @fopen(i8* %6, i8* %2)
%8 = tail call i32 @free(i8* %6)
br label %9
9: ; preds = %3, %5
%10 = phi i32* [ %7, %5 ], [ null, %3 ]
ret i32* %10
}
int test(int a, int b, char flags[]) {
  int ret;
  __asm__ __volatile__("mov %3, %%edx\n\t"
                       "movw %w1, %%ax\n\t"
                       "movw %w2, %%cx\n\t"
                       "subw %%cx, %%ax\n\t"
                       "seto (%%edx)\n\t"
                       "sets 1(%%edx)\n\t"
                       "setz 2(%%edx)\n\t"
                       "setp 3(%%edx)\n\t"
                       "setc 4(%%edx)\n\t"
                       "movzwl %%ax, %%eax\n\t"
                       "mov %%eax, %0\n\t"
                       : "=m"(ret)
                       : "m"(a), "m"(b), "m"(flags)
                       : "eax", "ecx", "edx", "memory");
  return ret;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%edx
mov    -0x4(%rbp),%ax
mov    -0x8(%rbp),%cx
sub    %cx,%ax
seto   (%edx)
sets   0x1(%edx)
sete   0x2(%edx)
setp   0x3(%edx)
setb   0x4(%edx)
movzwl %ax,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
mov    %edi,-0xc(%rsp)
mov    %esi,-0x10(%rsp)
mov    %rdx,-0x8(%rsp)
mov    -0x8(%rsp),%edx
mov    -0xc(%rsp),%ax
mov    -0x10(%rsp),%cx
sub    %cx,%ax
seto   (%edx)
sets   0x1(%edx)
sete   0x2(%edx)
setp   0x3(%edx)
setb   0x4(%edx)
movzwl %ax,%eax
mov    %eax,-0x14(%rsp)
mov    -0x14(%rsp),%eax
ret

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

LLVM IR (-O2):
define i32 @test(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = bitcast i32* %7 to i8*
%9 = load i32, i32* %7
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void *thread_func(void *ptr) {
  unsigned int i = 0;
  while (1) {
    i++;
    usleep(1000);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<thread_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    %eax,-0xc(%rbp)
mov    $0x3e8,%edi
call   1030 <usleep@plt>
jmp    1123 <thread_func+0x13>

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

LLVM IR (-O0):
define i8* @thread_func(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %1, %4
%5 = load i32, i32* %3
%6 = add i32 %5, 1
store i32 %6, i32* %3
%7 = call i32 @usleep(i32 1000)
br label %4
}

LLVM IR (-O2):
define noalias i8* @thread_func(i8* nocapture readnone %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @usleep(i32 1000)
br label %2
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutexattr_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int /*<<< orphan*/ *);
int /*<<< orphan*/ abort();
int /*<<< orphan*/ log_error(int, char *);
int pthread_mutexattr_settype(int /*<<< orphan*/ *, int);
void mutexattrSettype(pthread_mutexattr_t *attrs, int type) {
  ASSERT(attrs);
  int r = pthread_mutexattr_settype(attrs, type);
  if (r != 0) {
    log_error(r, "Error pthread_mutexattr_settype()");
    abort();
  }
}


x86 assembly (clang, -O0):
<mutexattrSettype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <ASSERT@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <pthread_mutexattr_settype@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1187 <mutexattrSettype+0x47>
mov    -0x10(%rbp),%edi
lea    0xe85(%rip),%rsi
call   1040 <log_error@plt>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mutexattrSettype>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1060 <ASSERT@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <pthread_mutexattr_settype@plt>
test   %eax,%eax
jne    1162 <mutexattrSettype+0x22>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe97(%rip),%rsi
mov    %eax,%edi
call   1040 <log_error@plt>
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
@.str = [34 x i8] c"Error pthread_mutexattr_settype()\00"
define void @mutexattrSettype(i32* %0, i32 %1) {
%3 = tail call i32 @ASSERT(i32* %0)
%4 = tail call i32 @pthread_mutexattr_settype(i32* %0, i32 %1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @log_error(i32 %4, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M305_f(char *s) {
  debug("M305_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M305_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M305_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M305_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M305_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M305_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M305_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
void *realloc(void *, size_t);
void *Realloc(void *ptr, size_t size) {
  void *p = realloc(ptr, size);
  if (!p)
    error("out of memory");
  return (p);
}


x86 assembly (clang, -O0):
<Realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1158 <Realloc+0x38>
lea    0xead(%rip),%rdi
call   1040 <error@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Realloc>:
push   %rbx
call   1030 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <Realloc+0x1a>
lea    0xecb(%rip),%rdi
call   1040 <error@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"out of memory\00"
define noalias i8* @Realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
int bml_is_valid_char(char c) {
  return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
         (c >= '0' && c <= '9') || c == '-' || c == '.';
}


x86 assembly (clang, -O0):
<bml_is_valid_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1129 <bml_is_valid_char+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x7a,%ecx
mov    %al,-0x2(%rbp)
jle    1186 <bml_is_valid_char+0x86>
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1148 <bml_is_valid_char+0x48>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5a,%ecx
mov    %al,-0x2(%rbp)
jle    1186 <bml_is_valid_char+0x86>
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     1167 <bml_is_valid_char+0x67>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x39,%ecx
mov    %al,-0x2(%rbp)
jle    1186 <bml_is_valid_char+0x86>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2d,%ecx
mov    %al,-0x2(%rbp)
je     1186 <bml_is_valid_char+0x86>
movsbl -0x1(%rbp),%eax
cmp    $0x2e,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bml_is_valid_char>:
mov    %edi,%ecx
and    $0xdf,%cl
add    $0xbf,%cl
mov    $0x1,%eax
cmp    $0x1a,%cl
jb     1129 <bml_is_valid_char+0x29>
cmp    $0x2d,%dil
je     1129 <bml_is_valid_char+0x29>
lea    -0x30(%rdi),%ecx
cmp    $0xa,%cl
jb     1129 <bml_is_valid_char+0x29>
xor    %eax,%eax
cmp    $0x2e,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @bml_is_valid_char(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 97
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 122
br i1 %9, label %34, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 65
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 90
br i1 %17, label %34, label %18
18: ; preds = %14, %10
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp sge i32 %20, 48
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp sle i32 %24, 57
br i1 %25, label %34, label %26
26: ; preds = %22, %18
%27 = load i8, i8* %2
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 45
br i1 %29, label %34, label %30
30: ; preds = %26
%31 = load i8, i8* %2
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 46
br label %34
34: ; preds = %30, %26, %22, %14, %6
%35 = phi i1 [ true, %26 ], [ true, %22 ], [ true, %14 ], [ true, %6 ], [ %33, %30 ]
%36 = zext i1 %35 to i32
ret i32 %36
}

LLVM IR (-O2):
define i32 @bml_is_valid_char(i8 signext %0) {
%2 = and i8 %0, -33
%3 = add i8 %2, -65
%4 = icmp ult i8 %3, 26
br i1 %4, label %13, label %5
5: ; preds = %1
%6 = add i8 %0, -48
%7 = icmp ult i8 %6, 10
%8 = icmp eq i8 %0, 45
%9 = or i1 %8, %7
br i1 %9, label %13, label %10
10: ; preds = %5
%11 = icmp eq i8 %0, 46
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %5, %1, %10
%14 = phi i32 [ %12, %10 ], [ 1, %1 ], [ 1, %5 ]
ret i32 %14
}
/* Variables and functions */
int rand();
int RandomInt(int low, int high) { return (rand() % (high - low + 1) + low); }


x86 assembly (clang, -O0):
<RandomInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomInt>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @RandomInt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (...) @rand()
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %6, %7
%9 = add nsw i32 %8, 1
%10 = srem i32 %5, %9
%11 = load i32, i32* %3
%12 = add nsw i32 %10, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @RandomInt(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = sub i32 1, %0
%5 = add i32 %4, %1
%6 = srem i32 %3, %5
%7 = add nsw i32 %6, %0
ret i32 %7
}
int is_little_endian() {
  int val = 1;
  char *p = (char *)&val;
  return *p == val;
}


x86 assembly (clang, -O0):
<is_little_endian>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    -0x4(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @is_little_endian() {
%1 = alloca i32
%2 = alloca i8*
store i32 1, i32* %1
%3 = bitcast i32* %1 to i8*
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = load i32, i32* %1
%8 = icmp eq i32 %6, %7
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @is_little_endian() {
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int _wmo_read_any_from_file(int /*<<< orphan*/ *, void *, size_t *, int,
                            int /*<<< orphan*/);
int wmo_read_grib_from_file(FILE *f, void *buffer, size_t *len) {
  return _wmo_read_any_from_file(f, buffer, len, 1, 0);
}


x86 assembly (clang, -O0):
<wmo_read_grib_from_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x1,%ecx
xor    %r8d,%r8d
call   1030 <_wmo_read_any_from_file@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wmo_read_grib_from_file>:
mov    $0x1,%ecx
xor    %r8d,%r8d
jmp    1030 <_wmo_read_any_from_file@plt>

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

LLVM IR (-O2):
define i32 @wmo_read_grib_from_file(i32* %0, i8* %1, i64* %2) {
%4 = tail call i32 @_wmo_read_any_from_file(i32* %0, i8* %1, i64* %2, i32 1, i32 0)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ charrep(char, int);
int /*<<< orphan*/ printf(char *);
void default_pstate_table_header(__attribute__((unused)) void *report_data) {
  charrep('-', 64);
  printf("\n");
  printf("| P-state  |   min    |   max    |   avg    |   total  | hits  |\n");
}


x86 assembly (clang, -O0):
<default_pstate_table_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x2d,%edi
mov    $0x40,%esi
call   1040 <charrep@plt>
lea    0xefe(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<default_pstate_table_header>:
push   %rax
mov    $0x2d,%edi
mov    $0x40,%esi
call   1050 <charrep@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xeaf(%rip),%rdi
pop    %rax
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [66 x i8] c"| P-state | min | max | avg | total | hits |\0A\00"
define void @default_pstate_table_header(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @charrep(i8 signext 45, i32 64)
%4 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [65 x i8] c"| P-state | min | max | avg | total | hits |\00"
define void @default_pstate_table_header(i8* nocapture readnone %0) {
%2 = tail call i32 @charrep(i8 signext 45, i32 64)
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ rot16l2(int /*<<< orphan*/);
int /*<<< orphan*/ rot16r7(int /*<<< orphan*/);
void speckey(uint16_t *left, uint16_t *right) {
  *left = rot16r7(*left);
  *left += *right;
  *right = rot16l2(*right);
  *right ^= *left;
}


x86 assembly (clang, -O0):
<speckey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1040 <rot16r7@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <rot16l2@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<speckey>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1040 <rot16r7@plt>
mov    %eax,(%rbx)
add    (%r14),%eax
mov    %eax,(%rbx)
mov    (%r14),%edi
call   1030 <rot16l2@plt>
mov    %eax,(%r14)
xor    (%rbx),%eax
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @speckey(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* %5
%7 = call i32 @rot16r7(i32 %6)
%8 = load i32*, i32** %3
store i32 %7, i32* %8
%9 = load i32*, i32** %4
%10 = load i32, i32* %9
%11 = load i32*, i32** %3
%12 = load i32, i32* %11
%13 = add nsw i32 %12, %10
store i32 %13, i32* %11
%14 = load i32*, i32** %4
%15 = load i32, i32* %14
%16 = call i32 @rot16l2(i32 %15)
%17 = load i32*, i32** %4
store i32 %16, i32* %17
%18 = load i32*, i32** %3
%19 = load i32, i32* %18
%20 = load i32*, i32** %4
%21 = load i32, i32* %20
%22 = xor i32 %21, %19
store i32 %22, i32* %20
ret void
}

LLVM IR (-O2):
define void @speckey(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = tail call i32 @rot16r7(i32 %3)
store i32 %4, i32* %0
%5 = load i32, i32* %1
%6 = add nsw i32 %5, %4
store i32 %6, i32* %0
%7 = load i32, i32* %1
%8 = tail call i32 @rot16l2(i32 %7)
store i32 %8, i32* %1
%9 = load i32, i32* %0
%10 = xor i32 %9, %8
store i32 %10, i32* %1
ret void
}
void baz(int v) {
  unsigned a = (v == 1) ? 1 : 2;
  if (__builtin_constant_p(a))
    asm volatile("# constant %0" ::"i"(a));
  else
    asm volatile("# register %0" ::"r"(a));
  a = 6;
  if (__builtin_constant_p(a))
    asm volatile("# constant %0" ::"i"(a));
  else
    asm volatile("# register %0" ::"r"(a));
}


x86 assembly (clang, -O0):
<baz>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x2,%eax
mov    $0x1,%ecx
cmp    $0x1,%edx
cmove  %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movl   $0x6,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<baz>:
xor    %eax,%eax
cmp    $0x1,%edi
sete   %al
mov    $0x2,%ecx
sub    %eax,%ecx
ret

LLVM IR (-O0):
define void @baz(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 1
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 1, i32 2
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = call i1 @llvm.is.constant.i32(i32 %8)
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i32, i32* %3
br label %14
12: ; preds = %1
%13 = load i32, i32* %3
br label %14
14: ; preds = %12, %10
store i32 6, i32* %3
%15 = load i32, i32* %3
%16 = call i1 @llvm.is.constant.i32(i32 %15)
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = load i32, i32* %3
br label %21
19: ; preds = %14
%20 = load i32, i32* %3
br label %21
21: ; preds = %19, %17
ret void
}

LLVM IR (-O2):
define void @baz(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i32 1, i32 2
tail call void asm sideeffect "# register $0", "r,~{dirflag},~{fpsr},~{flags}"(i32 %3)
tail call void asm sideeffect "# constant $0", "i,~{dirflag},~{fpsr},~{flags}"(i32 6)
ret void
}
void genaddiu() {}


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

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

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

LLVM IR (-O2):
define void @genaddiu() {
ret void
}
/* Variables and functions */
char *libintl_dcngettext(char const *, char const *, char const *,
                         unsigned long, int);
char *libintl_dngettext(const char *domainname, const char *msgid1,
                        const char *msgid2, unsigned long int n) {
  return libintl_dcngettext(domainname, msgid1, msgid2, n, 1729);
}


x86 assembly (clang, -O0):
<libintl_dngettext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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
mov    $0x6c1,%r8d
call   1030 <libintl_dcngettext@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<libintl_dngettext>:
mov    $0x6c1,%r8d
jmp    1030 <libintl_dcngettext@plt>

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

LLVM IR (-O2):
define i8* @libintl_dngettext(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = tail call i8* @libintl_dcngettext(i8* %0, i8* %1, i8* %2, i64 %3, i32 1729)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char *, char *);
int is(char *a, char *b) { return (a && b && !strcmp(a, b)) ? 1 : 0; }


x86 assembly (clang, -O0):
<is>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     1158 <is+0x48>
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     1158 <is+0x48>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is>:
xor    %eax,%eax
test   %rdi,%rdi
je     112f <is+0x1f>
test   %rsi,%rsi
je     112f <is+0x1f>
push   %rax
call   1030 <strcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define i32 @is(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = tail call i32 @strcmp(i8* %0, i8* %1)
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %2
%11 = phi i32 [ 0, %2 ], [ %9, %6 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void printUsage(void) {
  fprintf(stderr,
          "Usage: check_vdr_rec [-a] <record_dir> [<record_dir> ...]\n");
}


x86 assembly (clang, -O0):
<printUsage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<printUsage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [59 x i8] c"Usage: check_vdr_rec [-a] <record_dir> [<record_dir> ...]\0A\00"
define void @printUsage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [59 x i8] c"Usage: check_vdr_rec [-a] <record_dir> [<record_dir> ...]\0A\00"
define void @printUsage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
ret void
}
void foo787(int p) {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @foo112() {
ret void
}
void bounds() {
  __asm__ __volatile__("cli");
  SetTextColor(0x04 | 0x08, 0x00);
  kprintf("\nERROR: bounds\n");
  do {
    __asm__ __volatile__("cli  \n\t"
                         "hlt");
  } while (1 == 1);
}


x86 assembly (clang, -O0):
<bounds>:
push   %rbp
mov    %rsp,%rbp
cli
mov    $0xc,%edi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <SetTextColor@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1040 <kprintf@plt>
cli
hlt
mov    $0x1,%al
test   $0x1,%al
jne    1141 <bounds+0x21>
jmp    1152 <bounds+0x32>
pop    %rbp
ret

x86 assembly (clang, -O2):
<bounds>:
push   %rax
cli
mov    $0xc,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <SetTextColor@plt>
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1040 <kprintf@plt>
xchg   %ax,%ax
cli
hlt
jmp    1140 <bounds+0x20>

LLVM IR (-O0):
@.str = [16 x i8] c"\0AERROR: bounds\0A\00"
define void @bounds() {
%1 = call i32 (i32, i32, ...) bitcast (i32 (...)* @SetTextColor to i32 (i32, i32, ...)*)(i32 12, i32 0)
%2 = call i32 (i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %4, %0
br label %4
4: ; preds = %3
br i1 true, label %3, label %5
5: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"\0AERROR: bounds\0A\00"
define void @bounds() {
tail call void asm sideeffect "cli", "~{dirflag},~{fpsr},~{flags}"()
%1 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @SetTextColor to i32 (i32, i32, ...)*)(i32 12, i32 0)
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %3
3: ; preds = %3, %0
tail call void asm sideeffect "cli \0A\09hlt", "~{dirflag},~{fpsr},~{flags}"()
br label %3
}
int server_loop() {}


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

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

LLVM IR (-O0):
define i32 @server_loop() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @server_loop() {
ret i32 undef
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ card32;
};
typedef TYPE_1__ XFontProp;

/* Variables and functions */
unsigned long get_XFontProp_card32(void *_p) {
  return (unsigned long)((XFontProp *)_p)->card32;
}


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

x86 assembly (clang, -O2):
<get_XFontProp_card32>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i64 @get_XFontProp_card32(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @get_XFontProp_card32(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
void av_vorbis_parse_frame_flags() {}


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

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

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

LLVM IR (-O2):
define void @av_vorbis_parse_frame_flags() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ubsan_report_overflow(void *, void *, void *, char *,
                                         char *);
void __ubsan_handle_divrem_overflow(void *data_raw, void *lhs_raw,
                                    void *rhs_raw) {
  ubsan_report_overflow(data_raw, lhs_raw, rhs_raw, "divrem", "/ or %");
}


x86 assembly (clang, -O0):
<__ubsan_handle_divrem_overflow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xec9(%rip),%rcx
lea    0xec9(%rip),%r8
call   1030 <ubsan_report_overflow@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ubsan_handle_divrem_overflow>:
lea    0xee9(%rip),%rcx
lea    0xee9(%rip),%r8
jmp    1030 <ubsan_report_overflow@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"divrem\00"
@.str.1 = [7 x i8] c"/ or %\00"
define void @__ubsan_handle_divrem_overflow(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = call i32 @ubsan_report_overflow(i8* %7, i8* %8, i8* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"divrem\00"
@.str.1 = [7 x i8] c"/ or %\00"
define void @__ubsan_handle_divrem_overflow(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @ubsan_report_overflow(i8* %0, i8* %1, i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main() {
  unsigned long long a;
  if (!(a = 0xfedcba9876543210ULL))
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movabs $0xfedcba9876543210,%rax
ba dc fe
mov    %rax,-0x10(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    114e <main+0x2e>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
store i64 -81985529216486896, i64* %2
br i1 true, label %5, label %3
3: ; preds = %0
%4 = call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *popen(char *, char *);
FILE *lxqt_backlight_backend_get_write_stream() {
  FILE *stream = popen("pkexec lxqt-backlight_backend --stdin", "w");
  return stream;
}


x86 assembly (clang, -O0):
<lxqt_backlight_backend_get_write_stream>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    0xf00(%rip),%rsi
call   1030 <popen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lxqt_backlight_backend_get_write_stream>:
lea    0xee9(%rip),%rdi
lea    0xf08(%rip),%rsi
jmp    1030 <popen@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"pkexec lxqt-backlight_backend --stdin\00"
@.str.1 = [2 x i8] c"w\00"
define i32* @lxqt_backlight_backend_get_write_stream() {
%1 = alloca i32*
%2 = call i32* @popen(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
ret i32* %3
}

LLVM IR (-O2):
@.str = [38 x i8] c"pkexec lxqt-backlight_backend --stdin\00"
@.str.1 = [2 x i8] c"w\00"
define noalias i32* @lxqt_backlight_backend_get_write_stream() {
%1 = tail call i32* @popen(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32* %1
}
int HEAPright(int npos) { return npos * 2 + 2; }


x86 assembly (clang, -O0):
<HEAPright>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
add    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<HEAPright>:
lea    (%rdi,%rdi,1),%eax
add    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @HEAPright(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 2
%5 = add nsw i32 %4, 2
ret i32 %5
}

LLVM IR (-O2):
define i32 @HEAPright(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = add nsw i32 %2, 2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
const char *str_from_int(int integer) {
  static char buf[64];
  sprintf(buf, "%d", integer);
  return buf;
}


x86 assembly (clang, -O0):
<str_from_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0x2f1b(%rip),%rdi
lea    0xed4(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2f08(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_from_int>:
push   %rbx
mov    %edi,%edx
lea    0x2f26(%rip),%rbx
lea    0xedf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@str_from_int.buf = internal global [64 x i8] zeroinitializer
@.str = [3 x i8] c"%d\00"
define i8* @str_from_int(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @sprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @str_from_int.buf, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @str_from_int.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@str_from_int.buf = internal global [64 x i8] zeroinitializer
@.str = [3 x i8] c"%d\00"
define i8* @str_from_int(i32 %0) {
%2 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str_from_int.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @str_from_int.buf, i64 0, i64 0)
}
/* Variables and functions */
void *dummy_note_on() { return NULL; }


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

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

LLVM IR (-O0):
define i8* @dummy_note_on() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @dummy_note_on() {
ret i8* null
}
char *bs_strcpy(char *p, const char *q) {
  while ((*p++ = *q++))
    ;
  return p;
}


x86 assembly (clang, -O0):
<bs_strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     113b <bs_strcpy+0x3b>
jmp    110c <bs_strcpy+0xc>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bs_strcpy>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rsi),%ecx
add    $0x1,%rsi
mov    %cl,(%rax)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <bs_strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @bs_strcpy(i8* writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %8, %3 ]
%5 = phi i8* [ %1, %2 ], [ %6, %3 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %7, i8* %4
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %8
}