xunge/DecIR huggingface dataset:
/* Type definitions */
struct passwd {
  char *pw_dir;
};

/* Variables and functions */
char *getenv(char *);
struct passwd *getpwuid(int /*<<< orphan*/);
int /*<<< orphan*/ getuid();
char *get_home_directory(void) {
  char *home_directory;
  if ((home_directory = getenv("HOME")) != NULL) {
    return home_directory;
  } else {
    struct passwd *pw = getpwuid(getuid());
    return pw->pw_dir;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<get_home_directory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     115f <get_home_directory+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    117c <get_home_directory+0x4c>
mov    $0x0,%al
call   1050 <getuid@plt>
mov    %eax,%edi
call   1040 <getpwuid@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_home_directory>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1144 <get_home_directory+0x14>
pop    %rcx
ret
xor    %eax,%eax
call   1050 <getuid@plt>
mov    %eax,%edi
call   1040 <getpwuid@plt>
mov    (%rax),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.passwd = type { i8* }
@.str = [5 x i8] c"HOME\00"
define i8* @get_home_directory() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca %struct.passwd*
%4 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %4, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = load i8*, i8** %2
store i8* %7, i8** %1
br label %14
8: ; preds = %0
%9 = call i32 (...) @getuid()
%10 = call %struct.passwd* @getpwuid(i32 %9)
store %struct.passwd* %10, %struct.passwd** %3
%11 = load %struct.passwd*, %struct.passwd** %3
%12 = getelementptr inbounds %struct.passwd, %struct.passwd* %11, i32 0, i32 0
%13 = load i8*, i8** %12
store i8* %13, i8** %1
br label %14
14: ; preds = %8, %6
%15 = load i8*, i8** %1
ret i8* %15
}

LLVM IR (-O2):
%struct.passwd = type { i8* }
@.str = [5 x i8] c"HOME\00"
define i8* @get_home_directory() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = tail call i32 (...) @getuid()
%5 = tail call %struct.passwd* @getpwuid(i32 %4)
%6 = getelementptr inbounds %struct.passwd, %struct.passwd* %5, i64 0, i32 0
%7 = load i8*, i8** %6
br label %8
8: ; preds = %0, %3
%9 = phi i8* [ %7, %3 ], [ %1, %0 ]
ret i8* %9
}
int LOG2(int number) {
  int count = 0;
  if (number == 0 || (number & (number - 1))) {
    return -1;
  }
  while (number >>= 1) {
    count++;
  }
  return count;
}


x86 assembly (clang, -O0):
<LOG2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112c <LOG2+0x2c>
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1138 <LOG2+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    1163 <LOG2+0x63>
jmp    113d <LOG2+0x3d>
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     115d <LOG2+0x5d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <LOG2+0x3d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<LOG2>:
lea    -0x1(%rdi),%eax
test   %eax,%edi
setne  %al
test   %edi,%edi
sete   %cl
or     %al,%cl
mov    $0xffffffff,%eax
jne    113c <LOG2+0x3c>
xor    %eax,%eax
cmp    $0x2,%edi
jb     113c <LOG2+0x3c>
xor    %eax,%eax
mov    %edi,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
sar    %ecx
add    $0x1,%eax
cmp    $0x3,%edi
mov    %ecx,%edi
ja     1130 <LOG2+0x30>
ret

LLVM IR (-O0):
define i32 @LOG2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1
%8 = load i32, i32* %3
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 1
%11 = and i32 %8, %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %7, %1
store i32 -1, i32* %2
br label %24
14: ; preds = %7
br label %15
15: ; preds = %19, %14
%16 = load i32, i32* %3
%17 = ashr i32 %16, 1
store i32 %17, i32* %3
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %15
22: ; preds = %15
%23 = load i32, i32* %4
store i32 %23, i32* %2
br label %24
24: ; preds = %22, %13
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
define i32 @LOG2(i32 %0) {
%2 = tail call i32 @llvm.ctpop.i32(i32 %0)
%3 = icmp eq i32 %2, 1
br i1 %3, label %4, label %12
4: ; preds = %1
%5 = icmp ult i32 %0, 2
br i1 %5, label %12, label %6
6: ; preds = %4, %6
%7 = phi i32 [ %10, %6 ], [ 0, %4 ]
%8 = phi i32 [ %9, %6 ], [ %0, %4 ]
%9 = ashr i32 %8, 1
%10 = add nuw nsw i32 %7, 1
%11 = icmp ult i32 %8, 4
br i1 %11, label %12, label %6
12: ; preds = %6, %4, %1
%13 = phi i32 [ -1, %1 ], [ 0, %4 ], [ %10, %6 ]
ret i32 %13
}
int main() {
  int a = -2;
  int b = a + -~0x1234;
  int c = -b + !10;
  return sizeof(double);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0xfffffffe,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1235,%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
sub    -0xc(%rbp),%eax
add    $0x0,%eax
mov    %eax,-0x10(%rbp)
mov    $0x8,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 -2, i32* %2
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 4661
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = sub nsw i32 0, %7
%9 = add nsw i32 %8, 0
store i32 %9, i32* %4
ret i32 8
}

LLVM IR (-O2):
define i32 @main() {
ret i32 8
}
void rop_0() {}


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

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

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

LLVM IR (-O2):
define void @rop_0() {
ret void
}
/* Variables and functions */
int g(int);
int f(int i) {
  int x = 5;
  g(2);
  x = i;
  return g(x);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
mov    $0x2,%edi
call   1030 <g@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <g@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbx
mov    %edi,%ebx
mov    $0x2,%edi
call   1030 <g@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <g@plt>

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 5, i32* %3
%4 = call i32 @g(i32 2)
%5 = load i32, i32* %2
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @g(i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = tail call i32 @g(i32 2)
%3 = tail call i32 @g(i32 %0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  char *pgm = "tm2txt";
  fprintf(stderr, "%s usage:\n", pgm);
  fprintf(stderr, "%s [--help] [--quiet] [files...]\n", pgm);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec2(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
mov    0x2ec5(%rip),%r14
mov    (%r14),%edi
lea    0xee2(%rip),%rsi
lea    0xed4(%rip),%rbx
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xed4(%rip),%rsi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"tm2txt\00"
@stderr = global i32 0
@.str.1 = [11 x i8] c"%s usage:\0A\00"
@.str.2 = [34 x i8] c"%s [--help] [--quiet] [files...]\0A\00"
define void @usage() {
%1 = alloca i8*
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i32, i32* @stderr
%3 = load i8*, i8** %1
%4 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"tm2txt\00"
@stderr = global i32 0
@.str.1 = [11 x i8] c"%s usage:\0A\00"
@.str.2 = [34 x i8] c"%s [--help] [--quiet] [files...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fwrite(void *, int, int, int /*<<< orphan*/ *);
int dumpFile(char *name, void *in, int size) {
  FILE *fp = fopen(name, "wb");
  if (fp == NULL) {
    return -1;
  }
  fwrite(in, 1, size, fp);
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<dumpFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    116e <dumpFile+0x3e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1193 <dumpFile+0x63>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    $0x1,%esi
call   1050 <fwrite@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumpFile>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
lea    0xebf(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     116d <dumpFile+0x3d>
mov    %rax,%rbp
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14d,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
mov    %rbp,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
jmp    1172 <dumpFile+0x42>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"wb\00"
define i32 @dumpFile(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%9 = load i8*, i8** %5
%10 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %10, i32** %8
%11 = load i32*, i32** %8
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 -1, i32* %4
br label %21
14: ; preds = %3
%15 = load i8*, i8** %6
%16 = load i32, i32* %7
%17 = load i32*, i32** %8
%18 = call i32 @fwrite(i8* %15, i32 1, i32 %16, i32* %17)
%19 = load i32*, i32** %8
%20 = call i32 @fclose(i32* %19)
store i32 0, i32* %4
br label %21
21: ; preds = %14, %13
%22 = load i32, i32* %4
ret i32 %22
}

LLVM IR (-O2):
@.str = [3 x i8] c"wb\00"
define i32 @dumpFile(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 @fwrite(i8* %1, i32 1, i32 %2, i32* %4)
%8 = tail call i32 @fclose(i32* %4)
br label %9
9: ; preds = %3, %6
%10 = phi i32 [ 0, %6 ], [ -1, %3 ]
ret i32 %10
}
void fooe() {}


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

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

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

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

/* Variables and functions */
int feof(int /*<<< orphan*/ *);
int _sys_feof(FILE *file) { return (feof(file)); }


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

x86 assembly (clang, -O2):
<_sys_feof>:
jmp    1030 <feof@plt>

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

LLVM IR (-O2):
define i32 @_sys_feof(i32* nocapture %0) {
%2 = tail call i32 @feof(i32* %0)
ret i32 %2
}
/* Variables and functions */
double fmod(double, double);
double cp_pr(double cp, double pr_cyc) {
  return fmod(cp - pr_cyc + 1500.0, 3000.0) - 1500.0;
}


x86 assembly (clang, -O0):
<cp_pr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  0xecc(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xec8(%rip),%xmm1
call   1030 <fmod@plt>
movsd  0xeb3(%rip),%xmm1
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cp_pr>:
push   %rax
subsd  %xmm1,%xmm0
addsd  0xee3(%rip),%xmm0
movsd  0xee3(%rip),%xmm1
call   1030 <fmod@plt>
addsd  0xede(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @cp_pr(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fsub double %5, %6
%8 = fadd double %7, 1.500000e+03
%9 = call double @fmod(double %8, double 3.000000e+03)
%10 = fsub double %9, 1.500000e+03
ret double %10
}

LLVM IR (-O2):
define double @cp_pr(double %0, double %1) {
%3 = fsub double %0, %1
%4 = fadd double %3, 1.500000e+03
%5 = tail call double @fmod(double %4, double 3.000000e+03)
%6 = fadd double %5, -1.500000e+03
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ show_version();
int /*<<< orphan*/ stderr;
void usage(void) {
  show_version();
  fprintf(
      stderr,
      "\n"
      "usage: smc [-hs] [-b <baud rate>] [-d <device node file>] [-r <role>]"
      "\\\n"
      "\n"
      "options:\n"
      "   -h   show this usage\n"
      "   -b   baud rate\n"
      "   -d   device node file (e.g. /dev/ttyS0, /dev/ttyUSB2)\n"
      "   -r   work role (0:transmitter, 1:receiver, 2:repeater)\n"
      "   -s   enable rssi information (only effective under role of "
      "receiver)\n"
      "   -B   run daemon in the background (comming soon)\n"
      "   -v   show hostapd version\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <show_version@plt>
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
lea    0xeb5(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
xor    %eax,%eax
call   1030 <show_version@plt>
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
lea    0xeb8(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [393 x i8] c"\0Ausage: smc [-hs] [-b <baud rate>] [-d <device node file>] [-r <role>]\\\0A\0Aoptions:\0A -h show this usage\0A -b baud rate\0A -d device node file (e.g. /dev/ttyS0, /dev/ttyUSB2)\0A -r work role (0:transmitter, 1:receiver, 2:repeater)\0A -s enable rssi information (only effective under role of receiver)\0A -B run daemon in the background (comming soon)\0A -v show hostapd version\0A\00"
define void @usage() {
%1 = call i32 (...) @show_version()
%2 = load i32, i32* @stderr
%3 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([393 x i8], [393 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [393 x i8] c"\0Ausage: smc [-hs] [-b <baud rate>] [-d <device node file>] [-r <role>]\\\0A\0Aoptions:\0A -h show this usage\0A -b baud rate\0A -d device node file (e.g. /dev/ttyS0, /dev/ttyUSB2)\0A -r work role (0:transmitter, 1:receiver, 2:repeater)\0A -s enable rssi information (only effective under role of receiver)\0A -B run daemon in the background (comming soon)\0A -v show hostapd version\0A\00"
define void @usage() {
%1 = tail call i32 (...) @show_version()
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([393 x i8], [393 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
FILE *fopfile(char *name, char *mode) {
  FILE *fp;
  if ((fp = fopen(name, mode)) == NULL) {
    fprintf(stderr, "CAN'T FOPEN FILE = %s, MODE = %s\n", name, mode);
    exit(-1);
  }
  return (fp);
}


x86 assembly (clang, -O0):
<fopfile>:
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   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1182 <fopfile+0x52>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe8d(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fopfile>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <fopen@plt>
test   %rax,%rax
je     114c <fopfile+0x1c>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
lea    0xea4(%rip),%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"CAN'T FOPEN FILE = %s, MODE = %s\0A\00"
define i32* @fopfile(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32* @fopen(i8* %6, i8* %7)
store i32* %8, i32** %5
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %3
%13 = load i8*, i8** %4
%14 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13)
%15 = call i32 @exit(i32 -1)
unreachable
16: ; preds = %2
%17 = load i32*, i32** %5
ret i32* %17
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"CAN'T FOPEN FILE = %s, MODE = %s\0A\00"
define noalias i32* @fopfile(i8* %0, i8* %1) {
%3 = tail call i32* @fopen(i8* %0, i8* %1)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%8 = tail call i32 @exit(i32 -1)
unreachable
9: ; preds = %2
ret i32* %3
}
void put_long_little(unsigned val, char *buf) {
  buf[0] = val & 0xFF;
  buf[1] = (val >> 8) & 0xFF;
  buf[2] = (val >> 16) & 0xFF;
  buf[3] = (val >> 24) & 0xFF;
}


x86 assembly (clang, -O0):
<put_long_little>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x4(%rbp),%eax
shr    $0x18,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_long_little>:
mov    %edi,(%rsi)
ret

LLVM IR (-O0):
define void @put_long_little(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = and i32 %5, 255
%7 = trunc i32 %6 to i8
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 0
store i8 %7, i8* %9
%10 = load i32, i32* %3
%11 = lshr i32 %10, 8
%12 = and i32 %11, 255
%13 = trunc i32 %12 to i8
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i64 1
store i8 %13, i8* %15
%16 = load i32, i32* %3
%17 = lshr i32 %16, 16
%18 = and i32 %17, 255
%19 = trunc i32 %18 to i8
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i64 2
store i8 %19, i8* %21
%22 = load i32, i32* %3
%23 = lshr i32 %22, 24
%24 = and i32 %23, 255
%25 = trunc i32 %24 to i8
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i64 3
store i8 %25, i8* %27
ret void
}

LLVM IR (-O2):
define void @put_long_little(i32 %0, i8* nocapture writeonly %1) {
%3 = trunc i32 %0 to i8
store i8 %3, i8* %1
%4 = lshr i32 %0, 8
%5 = trunc i32 %4 to i8
%6 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %5, i8* %6
%7 = lshr i32 %0, 16
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %8, i8* %9
%10 = lshr i32 %0, 24
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %1, i64 3
store i8 %11, i8* %12
ret void
}
/* Type definitions */
struct FontBitmapInfo {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct FontBitmapInfo *);
void FreeFontInfo(struct FontBitmapInfo *font_bitmap_info) {
  if (font_bitmap_info == NULL)
    return;
  free(font_bitmap_info);
}


x86 assembly (clang, -O0):
<FreeFontInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <FreeFontInfo+0x1c>
jmp    1135 <FreeFontInfo+0x25>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FreeFontInfo>:
test   %rdi,%rdi
je     111a <FreeFontInfo+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
%struct.FontBitmapInfo = type { i32 }
define void @FreeFontInfo(%struct.FontBitmapInfo* %0) {
%2 = alloca %struct.FontBitmapInfo*
store %struct.FontBitmapInfo* %0, %struct.FontBitmapInfo** %2
%3 = load %struct.FontBitmapInfo*, %struct.FontBitmapInfo** %2
%4 = icmp eq %struct.FontBitmapInfo* %3, null
br i1 %4, label %5, label %6
5: ; preds = %1
br label %9
6: ; preds = %1
%7 = load %struct.FontBitmapInfo*, %struct.FontBitmapInfo** %2
%8 = call i32 @free(%struct.FontBitmapInfo* %7)
br label %9
9: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
%struct.FontBitmapInfo = type { i32 }
define void @FreeFontInfo(%struct.FontBitmapInfo* %0) {
%2 = icmp eq %struct.FontBitmapInfo* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(%struct.FontBitmapInfo* %0)
br label %5
5: ; preds = %1, %3
ret void
}
int test_00(int a, int b, int *c, short *d, int x) {
  *d = x != 0;
  *c = -1;
  if (x != 0)
    return a > 0;
  return 0;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %ax,%cx
mov    -0x20(%rbp),%rax
mov    %cx,(%rax)
mov    -0x18(%rbp),%rax
movl   $0xffffffff,(%rax)
cmpl   $0x0,-0x24(%rbp)
je     1154 <test_00+0x54>
cmpl   $0x0,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    115b <test_00+0x5b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
xor    %eax,%eax
test   %r8d,%r8d
setne  %al
mov    %ax,(%rcx)
movl   $0xffffffff,(%rdx)
test   %edi,%edi
setg   %cl
and    %cl,%al
movzbl %al,%eax
ret

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

LLVM IR (-O2):
define i32 @test_00(i32 %0, i32 %1, i32* nocapture writeonly %2, i16* nocapture writeonly %3, i32 %4) {
%6 = icmp ne i32 %4, 0
%7 = zext i1 %6 to i16
store i16 %7, i16* %3
store i32 -1, i32* %2
%8 = icmp sgt i32 %0, 0
%9 = and i1 %8, %6
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ garmin();
main() { garmin(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @garmin()
ret i32 0
}
/* Type definitions */
typedef char *uint16_t;

/* Variables and functions */
__attribute__((always_, const)) uint16_t __bswap_variable_16(uint16_t x) {
  __asm__("xchgb %b0,%h0" : "=q"(x) : "0"(x));
  return x;
}


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

x86 assembly (clang, -O2):
<__bswap_variable_16>:
mov    %rdi,%rax
xchg   %ah,%al
ret

LLVM IR (-O0):
define i8* @__bswap_variable_16(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* asm "xchgb ${0:b},${0:h}", "=q,0,~{dirflag},~{fpsr},~{flags}"(i8* %3)
store i8* %4, i8** %2
%5 = load i8*, i8** %2
ret i8* %5
}

LLVM IR (-O2):
define i8* @__bswap_variable_16(i8* readnone %0) {
%2 = tail call i8* asm "xchgb ${0:b},${0:h}", "=q,0,~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret i8* %2
}
int changeValue() {
  int intArray[10];
  int *intPtr1 = intArray;
  int *intPtr2;
  intPtr2 = intPtr1 + 5;
  *intPtr2 = 351;
  return intArray[5];
}


x86 assembly (clang, -O0):
<changeValue>:
push   %rbp
mov    %rsp,%rbp
lea    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
movl   $0x15f,(%rax)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @changeValue() {
%1 = alloca [10 x i32]
%2 = alloca i32*
%3 = alloca i32*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
store i32* %4, i32** %2
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 5
store i32* %6, i32** %3
%7 = load i32*, i32** %3
store i32 351, i32* %7
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%9 = load i32, i32* %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @changeValue() {
ret i32 351
}
void __attribute__((hot)) unused_hot_fn(void) {}


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

x86 assembly (clang, -O2):
<unused_hot_fn>:
ret
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)

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

LLVM IR (-O2):
define void @unused_hot_fn() {
ret void
}
/* Type definitions */
struct __test_metadata {
  int dummy;
};
struct __fixture_variant_metadata {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ close_range_cloexec_unshare(struct __test_metadata *);
void wrapper_close_range_cloexec_unshare(
    struct __test_metadata *_metadata,
    struct __fixture_variant_metadata *variant) {
  close_range_cloexec_unshare(_metadata);
}


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

x86 assembly (clang, -O2):
<wrapper_close_range_cloexec_unshare>:
jmp    1030 <close_range_cloexec_unshare@plt>

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

LLVM IR (-O2):
%struct.__test_metadata = type { i32 }
%struct.__fixture_variant_metadata = type { i32 }
define void @wrapper_close_range_cloexec_unshare(%struct.__test_metadata* %0, %struct.__fixture_variant_metadata* nocapture readnone %1) {
%3 = tail call i32 @close_range_cloexec_unshare(%struct.__test_metadata* %0)
ret void
}
int numeric_find(int n) {
  while (1) {
    int rem = n % 8;
    if (rem == 0 || rem == 5)
      return n;
    n++;
  }
}


x86 assembly (clang, -O0):
<numeric_find>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1129 <numeric_find+0x29>
cmpl   $0x5,-0x8(%rbp)
jne    112e <numeric_find+0x2e>
mov    -0x4(%rbp),%eax
pop    %rbp
ret
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1107 <numeric_find+0x7>

x86 assembly (clang, -O2):
<numeric_find>:
jmp    111b <numeric_find+0x1b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %edi,%eax
cmp    $0x5,%ecx
je     1139 <numeric_find+0x39>
test   %ecx,%ecx
je     1139 <numeric_find+0x39>
lea    0x7(%rdi),%edx
test   %edi,%edi
cmovns %edi,%edx
and    $0xfffffff8,%edx
mov    %edi,%ecx
sub    %edx,%ecx
je     1110 <numeric_find+0x10>
cmp    $0x5,%ecx
je     1110 <numeric_find+0x10>
add    $0x1,%edi
cmp    $0x5,%ecx
jne    1117 <numeric_find+0x17>
ret

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

LLVM IR (-O2):
define i32 @numeric_find(i32 %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i32 [ %0, %1 ], [ %9, %8 ]
%4 = phi i32 [ undef, %1 ], [ %10, %8 ]
%5 = srem i32 %3, 8
switch i32 %5, label %6 [
i32 5, label %8
i32 0, label %8
]
6: ; preds = %2
%7 = add nsw i32 %3, 1
br label %8
8: ; preds = %2, %2, %6
%9 = phi i32 [ %7, %6 ], [ %3, %2 ], [ %3, %2 ]
%10 = phi i32 [ %4, %6 ], [ %3, %2 ], [ %3, %2 ]
switch i32 %5, label %2 [
i32 5, label %11
i32 0, label %11
]
11: ; preds = %8, %8
ret i32 %10
}
void w18(void *x, long long y) { *(long long *)(x + 32750) = y; }


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

x86 assembly (clang, -O2):
<w18>:
mov    %rsi,0x7fee(%rdi)
ret

LLVM IR (-O0):
define void @w18(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i8*, i8** %3
%7 = getelementptr i8, i8* %6, i64 32750
%8 = bitcast i8* %7 to i64*
store i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @w18(i8* nocapture writeonly %0, i64 %1) {
%3 = getelementptr i8, i8* %0, i64 32750
%4 = bitcast i8* %3 to i64*
store i64 %1, i64* %4
ret void
}
signed int spi_bulkread(void *handle, unsigned short addr,
                        unsigned char command, unsigned char *data,
                        unsigned int length) {
  return 0;
}


x86 assembly (clang, -O0):
<spi_bulkread>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %si,%dx
mov    %rdi,-0x8(%rbp)
mov    %dx,-0xa(%rbp)
mov    %al,-0xb(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @spi_bulkread(i8* %0, i16 zeroext %1, i8 zeroext %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i16
%8 = alloca i8
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %6
store i16 %1, i16* %7
store i8 %2, i8* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
ret i32 0
}

LLVM IR (-O2):
define i32 @spi_bulkread(i8* nocapture readnone %0, i16 zeroext %1, i8 zeroext %2, i8* nocapture readnone %3, i32 %4) {
ret i32 0
}
int test_imm_60uint16_reg(unsigned short val) {
  return ((val) & (-0x60 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_60uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffffa0,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_60uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -96
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int pthread_mutex_setprioceiling(pthread_mutex_t *a, int b, int *c) {
  assert(0);
}


x86 assembly (clang, -O0):
<pthread_mutex_setprioceiling>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
xor    %edi,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @pthread_mutex_setprioceiling(i32* nocapture readnone %0, i32 %1, i32* nocapture readnone %2) {
%4 = tail call i32 @assert(i32 0)
ret i32 undef
}
int __signbit(double x) {
  unsigned short sw;
  __asm__("fxam; fstsw %%ax;" : "=a"(sw) : "t"(x));
  return (sw & 0x0200) != 0;
}


x86 assembly (clang, -O0):
<__signbit>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
fldl   -0x18(%rbp)
fxam
fstsw  %ax
fstp   %st(0)
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
and    $0x200,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__signbit>:
movsd  %xmm0,-0x8(%rsp)
fldl   -0x8(%rsp)
fxam
fstsw  %ax
fstp   %st(0)
shr    $0x9,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @__signbit(double %0) {
%2 = alloca double
%3 = alloca i16
store double %0, double* %2
%4 = load double, double* %2
%5 = call i16 asm "fxam; fstsw %ax;", "={ax},{st},~{dirflag},~{fpsr},~{flags}"(double %4)
store i16 %5, i16* %3
%6 = load i16, i16* %3
%7 = zext i16 %6 to i32
%8 = and i32 %7, 512
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @__signbit(double %0) {
%2 = tail call i16 asm "fxam; fstsw %ax;", "={ax},{st},~{dirflag},~{fpsr},~{flags}"(double %0)
%3 = lshr i16 %2, 9
%4 = and i16 %3, 1
%5 = zext i16 %4 to i32
ret i32 %5
}
/* Variables and functions */
scalar_t__ Fork();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(void) {
  if (Fork() == 0) {
    printf("a");
  } else {
    printf("b");
    waitpid(-1, NULL, 0);
  }
  printf("c");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <Fork@plt>
cmp    $0x0,%rax
jne    1171 <main+0x31>
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
jmp    118d <main+0x4d>
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1050 <waitpid@plt>
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <Fork@plt>
test   %rax,%rax
jne    1159 <main+0x19>
mov    $0x61,%edi
call   1040 <putchar@plt>
jmp    1171 <main+0x31>
mov    $0x62,%edi
call   1040 <putchar@plt>
mov    $0xffffffff,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <waitpid@plt>
mov    $0x63,%edi
call   1040 <putchar@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
@.str.1 = [2 x i8] c"b\00"
@.str.2 = [2 x i8] c"c\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 (...) @Fork()
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %9
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @waitpid(i32 -1, i32* null, i32 0)
br label %9
9: ; preds = %6, %4
%10 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 (...) @Fork()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @putchar(i32 97)
br label %8
5: ; preds = %0
%6 = tail call i32 @putchar(i32 98)
%7 = tail call i32 @waitpid(i32 -1, i32* null, i32 0)
br label %8
8: ; preds = %5, %3
%9 = tail call i32 @putchar(i32 99)
%10 = tail call i32 @exit(i32 0)
unreachable
}
void gdk_draw_glyphs_transformed() {}


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

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

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

LLVM IR (-O2):
define void @gdk_draw_glyphs_transformed() {
ret void
}
int do_222() { return 222; }


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

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

LLVM IR (-O0):
define i32 @do_222() {
ret i32 222
}

LLVM IR (-O2):
define i32 @do_222() {
ret i32 222
}
void INT_MD(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_MD() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void Free(void *p) {
  if (p)
    free(p);
}


x86 assembly (clang, -O0):
<Free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <Free+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Free>:
test   %rdi,%rdi
je     111a <Free+0xa>
jmp    1030 <free@plt>
ret

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

LLVM IR (-O2):
define void @Free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
int ffi_test_10(int a, int b, double c, int d, float e, int f, int g, int h) {
  return a - b - c - d - e - f - g - h;
}


x86 assembly (clang, -O0):
<ffi_test_10>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movss  %xmm1,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
cvtsi2sd %eax,%xmm0
subsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
subsd  %xmm1,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
subsd  %xmm1,%xmm0
cvtsi2sdl -0x1c(%rbp),%xmm1
subsd  %xmm1,%xmm0
cvtsi2sdl -0x20(%rbp),%xmm1
subsd  %xmm1,%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffi_test_10>:
sub    %esi,%edi
cvtsi2sd %edi,%xmm2
subsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
subsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
subsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
subsd  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsi2sd %r8d,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %r9d,%xmm1
subsd  %xmm0,%xmm2
subsd  %xmm1,%xmm2
cvttsd2si %xmm2,%eax
ret

LLVM IR (-O0):
define i32 @ffi_test_10(i32 %0, i32 %1, double %2, i32 %3, float %4, i32 %5, i32 %6, i32 %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca i32
%13 = alloca float
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 %0, i32* %9
store i32 %1, i32* %10
store double %2, double* %11
store i32 %3, i32* %12
store float %4, float* %13
store i32 %5, i32* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%17 = load i32, i32* %9
%18 = load i32, i32* %10
%19 = sub nsw i32 %17, %18
%20 = sitofp i32 %19 to double
%21 = load double, double* %11
%22 = fsub double %20, %21
%23 = load i32, i32* %12
%24 = sitofp i32 %23 to double
%25 = fsub double %22, %24
%26 = load float, float* %13
%27 = fpext float %26 to double
%28 = fsub double %25, %27
%29 = load i32, i32* %14
%30 = sitofp i32 %29 to double
%31 = fsub double %28, %30
%32 = load i32, i32* %15
%33 = sitofp i32 %32 to double
%34 = fsub double %31, %33
%35 = load i32, i32* %16
%36 = sitofp i32 %35 to double
%37 = fsub double %34, %36
%38 = fptosi double %37 to i32
ret i32 %38
}

LLVM IR (-O2):
define i32 @ffi_test_10(i32 %0, i32 %1, double %2, i32 %3, float %4, i32 %5, i32 %6, i32 %7) {
%9 = sub nsw i32 %0, %1
%10 = sitofp i32 %9 to double
%11 = fsub double %10, %2
%12 = sitofp i32 %3 to double
%13 = fsub double %11, %12
%14 = fpext float %4 to double
%15 = fsub double %13, %14
%16 = sitofp i32 %5 to double
%17 = fsub double %15, %16
%18 = sitofp i32 %6 to double
%19 = fsub double %17, %18
%20 = sitofp i32 %7 to double
%21 = fsub double %19, %20
%22 = fptosi double %21 to i32
ret i32 %22
}
/* Variables and functions */
void *test_ptr_alloc_align(int);
void *align16() { return test_ptr_alloc_align(16); }


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

x86 assembly (clang, -O2):
<align16>:
mov    $0x10,%edi
jmp    1030 <test_ptr_alloc_align@plt>

LLVM IR (-O0):
define i8* @align16() {
%1 = call i8* @test_ptr_alloc_align(i32 16)
ret i8* %1
}

LLVM IR (-O2):
define i8* @align16() {
%1 = tail call i8* @test_ptr_alloc_align(i32 16)
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ clearPin(unsigned int const, unsigned int const);
int disablePin(const unsigned int port, const unsigned int pin) {
  unsigned int mask = 1 << pin;
  clearPin(port, pin);
  (*((volatile unsigned int *const)(0x40040100 + 0x0070))) |= mask;
  return 0;
}


x86 assembly (clang, -O0):
<disablePin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <clearPin@plt>
mov    -0xc(%rbp),%eax
mov    $0x40040170,%ecx
mov    (%rcx),%ecx
or     %eax,%ecx
mov    $0x40040170,%eax
mov    %ecx,(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disablePin>:
push   %rbx
mov    $0x1,%ebx
mov    %esi,%ecx
shl    %cl,%ebx
call   1030 <clearPin@plt>
or     %ebx,0x40040170
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @disablePin(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* %4
%7 = shl i32 1, %6
store i32 %7, i32* %5
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @clearPin(i32 %8, i32 %9)
%11 = load i32, i32* %5
%12 = load volatile i32, i32* inttoptr (i64 1074004336 to i32*)
%13 = or i32 %12, %11
store volatile i32 %13, i32* inttoptr (i64 1074004336 to i32*)
ret i32 0
}

LLVM IR (-O2):
define i32 @disablePin(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = tail call i32 @clearPin(i32 %0, i32 %1)
%5 = load volatile i32, i32* inttoptr (i64 1074004336 to i32*)
%6 = or i32 %5, %3
store volatile i32 %6, i32* inttoptr (i64 1074004336 to i32*)
ret i32 0
}
/* Variables and functions */
int fLen2(char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int l = fLen2("file.txt");
  printf("file size is %d\n\n", l);
  return (0);
}


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

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

LLVM IR (-O0):
@.str = [9 x i8] c"file.txt\00"
@.str.1 = [18 x i8] c"file size is %d\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @fLen2(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"file.txt\00"
@.str.1 = [18 x i8] c"file size is %d\0A\0A\00"
define i32 @main() {
%1 = tail call i32 @fLen2(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ two();
void start(void) { two(); }


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

x86 assembly (clang, -O2):
<start>:
xor    %eax,%eax
jmp    1030 <two@plt>

LLVM IR (-O0):
define void @start() {
%1 = call i32 (...) @two()
ret void
}

LLVM IR (-O2):
define void @start() {
%1 = tail call i32 (...) @two()
ret void
}