xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ delwin(int /*<<< orphan*/ *);
int /*<<< orphan*/ wborder(int /*<<< orphan*/ *, char, char, char, char, char,
                           char, char, char);
int /*<<< orphan*/ wrefresh(int /*<<< orphan*/ *);
void destory_win(WINDOW *win) {
  wborder(win, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
  wrefresh(win);
  delwin(win);
}


x86 assembly (clang, -O0):
<destory_win>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x20,%r9d
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x20,(%rsp)
movl   $0x20,0x8(%rsp)
movl   $0x20,0x10(%rsp)
call   1030 <wborder@plt>
mov    -0x8(%rbp),%rdi
call   1040 <wrefresh@plt>
mov    -0x8(%rbp),%rdi
call   1050 <delwin@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<destory_win>:
push   %rbx
mov    %rdi,%rbx
sub    $0x8,%rsp
mov    $0x20,%esi
mov    $0x20,%edx
mov    $0x20,%ecx
mov    $0x20,%r8d
mov    $0x20,%r9d
push   $0x20
push   $0x20
push   $0x20
call   1030 <wborder@plt>
add    $0x20,%rsp
mov    %rbx,%rdi
call   1040 <wrefresh@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <delwin@plt>

LLVM IR (-O0):
define void @destory_win(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @wborder(i32* %3, i8 signext 32, i8 signext 32, i8 signext 32, i8 signext 32, i8 signext 32, i8 signext 32, i8 signext 32, i8 signext 32)
%5 = load i32*, i32** %2
%6 = call i32 @wrefresh(i32* %5)
%7 = load i32*, i32** %2
%8 = call i32 @delwin(i32* %7)
ret void
}

LLVM IR (-O2):
define void @destory_win(i32* %0) {
%2 = tail call i32 @wborder(i32* %0, i8 signext 32, i8 signext 32, i8 signext 32, i8 signext 32, i8 signext 32, i8 signext 32, i8 signext 32, i8 signext 32)
%3 = tail call i32 @wrefresh(i32* %0)
%4 = tail call i32 @delwin(i32* %0)
ret void
}
/* Variables and functions */
void modem_probe_samp_i(char *name, int samp[], size_t sampcnt) { return; }


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

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

LLVM IR (-O0):
define void @modem_probe_samp_i(i8* %0, i32* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i64
store i8* %0, i8** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
ret void
}

LLVM IR (-O2):
define void @modem_probe_samp_i(i8* nocapture %0, i32* nocapture %1, i64 %2) {
ret void
}
int swapOddEvenBits(int x) {
  return (((x & 0xaaaaaaaa) >> 1) | ((x & 55555555) << 1));
}


x86 assembly (clang, -O0):
<swapOddEvenBits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xaaaaaaaa,%eax
shr    $0x1,%eax
mov    -0x4(%rbp),%ecx
and    $0x34fb5e3,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapOddEvenBits>:
lea    (%rdi,%rdi,1),%eax
mov    %edi,%ecx
shr    %ecx
and    $0x55555555,%ecx
and    $0x69f6bc6,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @swapOddEvenBits(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -1431655766
%5 = lshr i32 %4, 1
%6 = load i32, i32* %2
%7 = and i32 %6, 55555555
%8 = shl i32 %7, 1
%9 = or i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @swapOddEvenBits(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 1431655765
%4 = shl i32 %0, 1
%5 = and i32 %4, 111111110
%6 = or i32 %3, %5
ret i32 %6
}
void handler_chain_init(void) {
  ;
  ;
}


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

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

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

LLVM IR (-O2):
define void @handler_chain_init() {
ret void
}
/* Variables and functions */
double frand();
int rand_binary(double freq) {
  if (frand() < freq)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<rand_binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <frand@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1142 <rand_binary+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1149 <rand_binary+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_binary>:
push   %rax
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <frand@plt>
xor    %eax,%eax
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
seta   %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @rand_binary(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = call double (...) @frand()
%5 = load double, double* %3
%6 = fcmp olt double %4, %5
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @rand_binary(double %0) {
%2 = tail call double (...) @frand()
%3 = fcmp olt double %2, %0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
double unix_size(char *);
double wfile_size(char *filename) {
  double size;
  return (unix_size(filename));
  return (size);
}


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

x86 assembly (clang, -O2):
<wfile_size>:
jmp    1030 <unix_size@plt>

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

LLVM IR (-O2):
define double @wfile_size(i8* %0) {
%2 = tail call double @unix_size(i8* %0)
ret double %2
}
const char *test2(void) { return "hi there"; }


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

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

LLVM IR (-O0):
@.str = [9 x i8] c"hi there\00"
define i8* @test2() {
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [9 x i8] c"hi there\00"
define i8* @test2() {
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t TimerValueGet(uint32_t ui32Base, uint32_t ui32Timer) {
  ;
  ;
  return ((ui32Timer == 0x000000ff)
              ? (*((volatile unsigned long *)(ui32Base + 0x00000048)))
              : (*((volatile unsigned long *)(ui32Base + 0x0000004C))));
}


x86 assembly (clang, -O0):
<TimerValueGet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0xff,-0x8(%rbp)
jne    112b <TimerValueGet+0x2b>
mov    -0x4(%rbp),%eax
add    $0x48,%eax
cltq
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
jmp    113a <TimerValueGet+0x3a>
mov    -0x4(%rbp),%eax
add    $0x4c,%eax
cltq
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerValueGet>:
xor    %eax,%eax
cmp    $0xff,%esi
setne  %al
lea    0x48(,%rax,4),%eax
movslq %edi,%rcx
mov    (%rax,%rcx,1),%rax
ret

LLVM IR (-O0):
define i32 @TimerValueGet(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 255
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 72
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i64*
%12 = load volatile i64, i64* %11
br label %19
13: ; preds = %2
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 76
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i64*
%18 = load volatile i64, i64* %17
br label %19
19: ; preds = %13, %7
%20 = phi i64 [ %12, %7 ], [ %18, %13 ]
%21 = trunc i64 %20 to i32
ret i32 %21
}

LLVM IR (-O2):
define i32 @TimerValueGet(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 255
%4 = select i1 %3, i32 72, i32 76
%5 = add nsw i32 %4, %0
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i64*
%8 = load volatile i64, i64* %7
%9 = trunc i64 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void print_usage(const char *p) {
  fprintf(stderr,
          "Usage: %s -d <DIR> -f <FILE> [-p <PORT>]\n\nOptions:\n  -d <DIR> "
          "mail queue directory path\n  -f <FILE> sqlite database file\n  -p "
          "<PORT> listening TCP port\n  -h show usage\n",
          p);
}


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

x86 assembly (clang, -O2):
<print_usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [169 x i8] c"Usage: %s -d <DIR> -f <FILE> [-p <PORT>]\0A\0AOptions:\0A -d <DIR> mail queue directory path\0A -f <FILE> sqlite database file\0A -p <PORT> listening TCP port\0A -h show usage\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [169 x i8] c"Usage: %s -d <DIR> -f <FILE> [-p <PORT>]\0A\0AOptions:\0A -d <DIR> mail queue directory path\0A -f <FILE> sqlite database file\0A -p <PORT> listening TCP port\0A -h show usage\0A\00"
define void @print_usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ OPLinkStatusHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void OPLinkStatusUpdated() { UAVObjUpdated(OPLinkStatusHandle()); }


x86 assembly (clang, -O0):
<OPLinkStatusUpdated>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <OPLinkStatusHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjUpdated@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<OPLinkStatusUpdated>:
push   %rax
xor    %eax,%eax
call   1030 <OPLinkStatusHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjUpdated@plt>

LLVM IR (-O0):
define void @OPLinkStatusUpdated() {
%1 = call i32 (...) @OPLinkStatusHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @OPLinkStatusUpdated() {
%1 = tail call i32 (...) @OPLinkStatusHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
unsigned long hash_str(char *str, int total) {
  unsigned long hash = 5381;
  int c;
  while (c = *str++)
    hash = ((hash << 5) + hash) + c;
  return hash % total;
}


x86 assembly (clang, -O0):
<hash_str>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x1505,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
je     114d <hash_str+0x4d>
mov    -0x18(%rbp),%rax
shl    $0x5,%rax
add    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
jmp    1113 <hash_str+0x13>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
xor    %edx,%edx
div    %rcx
mov    %rdx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_str>:
mov    (%rdi),%cl
test   %cl,%cl
je     112e <hash_str+0x2e>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %rax,%rdx
shl    $0x5,%rdx
add    %rax,%rdx
movsbq %cl,%rax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash_str+0x10>
jmp    1133 <hash_str+0x33>
mov    $0x1505,%eax
movslq %esi,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
je     114b <hash_str+0x4b>
xor    %edx,%edx
div    %rcx
mov    %rdx,%rax
ret
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i64 @hash_str(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %0, %2 ]
%8 = phi i64 [ %12, %5 ], [ 5381, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = mul i64 %8, 33
%11 = sext i8 %6 to i64
%12 = add i64 %10, %11
%13 = load i8, i8* %9
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i64 [ 5381, %2 ], [ %12, %5 ]
%17 = sext i32 %1 to i64
%18 = urem i64 %16, %17
ret i64 %18
}
/* Variables and functions */
int /*<<< orphan*/ nuovaDomanda();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  srand(time(NULL));
  nuovaDomanda();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1050 <nuovaDomanda@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1050 <nuovaDomanda@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @time(i32* null)
%3 = call i32 @srand(i32 %2)
%4 = call i32 (...) @nuovaDomanda()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @nuovaDomanda()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void debugErrLn(char *s) { fprintf(stderr, "%s\n", s); }


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

x86 assembly (clang, -O2):
<debugErrLn>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @debugErrLn(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int abs(int);
int abs_max(int a, int b) { return abs(a) >= abs(b) ? abs(a) : abs(b); }


x86 assembly (clang, -O0):
<abs_max>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cmp    %ecx,%eax
jl     114e <abs_max+0x3e>
mov    -0x4(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x10(%rbp)
jmp    1159 <abs_max+0x49>
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs_max>:
mov    %edi,%ecx
neg    %ecx
cmovs  %edi,%ecx
mov    %esi,%eax
neg    %eax
cmovs  %esi,%eax
cmp    %eax,%ecx
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define i32 @abs_max(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i32 @abs(i32 %5)
%7 = load i32, i32* %4
%8 = call i32 @abs(i32 %7)
%9 = icmp sge i32 %6, %8
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* %3
%12 = call i32 @abs(i32 %11)
br label %16
13: ; preds = %2
%14 = load i32, i32* %4
%15 = call i32 @abs(i32 %14)
br label %16
16: ; preds = %13, %10
%17 = phi i32 [ %12, %10 ], [ %15, %13 ]
ret i32 %17
}

LLVM IR (-O2):
define i32 @abs_max(i32 %0, i32 %1) {
%3 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%4 = tail call i32 @llvm.abs.i32(i32 %1, i1 true)
%5 = icmp ult i32 %3, %4
%6 = select i1 %5, i32 %4, i32 %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ LOG_DAEMON;
int /*<<< orphan*/ LOG_NOTICE;
int /*<<< orphan*/ LOG_PID;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ openlog(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *);
int main(int argc, char *argv[]) {
  openlog("xxxx", LOG_PID, LOG_DAEMON);
  syslog(LOG_NOTICE, "test message");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e8b(%rip),%rax
mov    (%rax),%esi
mov    0x2e92(%rip),%rax
mov    (%rax),%edx
lea    0xea1(%rip),%rdi
call   1040 <openlog@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xe91(%rip),%rsi
call   1030 <syslog@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
mov    0x2ea7(%rip),%rax
mov    (%rax),%edx
lea    0xeb6(%rip),%rdi
call   1040 <openlog@plt>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
call   1030 <syslog@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"xxxx\00"
@LOG_PID = global i32 0
@LOG_DAEMON = global i32 0
@LOG_NOTICE = global i32 0
@.str.1 = [13 x i8] c"test message\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @LOG_PID
%7 = load i32, i32* @LOG_DAEMON
%8 = call i32 @openlog(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = load i32, i32* @LOG_NOTICE
%10 = call i32 @syslog(i32 %9, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [5 x i8] c"xxxx\00"
@LOG_PID = global i32 0
@LOG_DAEMON = global i32 0
@LOG_NOTICE = global i32 0
@.str.1 = [13 x i8] c"test message\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @LOG_PID
%4 = load i32, i32* @LOG_DAEMON
%5 = tail call i32 @openlog(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
%6 = load i32, i32* @LOG_NOTICE
%7 = tail call i32 @syslog(i32 %6, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @exit(i32 0)
unreachable
}
XFree() {}


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

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

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

LLVM IR (-O2):
define i32 @XFree() {
ret i32 undef
}
int test_imm_C5int64_midword_reg(long long val) {
  return ((val >> 16) & (0xC5 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_C5int64_midword_reg(i64 %0) {
%2 = and i64 %0, 12910592
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void load(int nloop) {
  int i;
  for (i = 0; i < nloop; i++)
    ;
}


x86 assembly (clang, -O0):
<load>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    112d <load+0x2d>
jmp    111f <load+0x1f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <load+0xe>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @load(i32 %0) {
ret void
}
void dhad(int xlength, double *x, int xskip, double *y, int yskip) {
  int xi, yi = 0;
  for (xi = 0; xi < xlength; xi += xskip) {
    x[xi] *= y[yi];
    yi += yskip;
  }
}


x86 assembly (clang, -O0):
<dhad>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1166 <dhad+0x66>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%eax
add    -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    1124 <dhad+0x24>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dhad>:
test   %edi,%edi
jle    1139 <dhad+0x39>
movslq %r8d,%rax
movslq %edx,%r8
mov    %edi,%edi
shl    $0x3,%rax
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rcx),%xmm0
mulsd  (%rsi,%rdx,8),%xmm0
movsd  %xmm0,(%rsi,%rdx,8)
add    %r8,%rdx
add    %rax,%rcx
cmp    %rdi,%rdx
jl     1120 <dhad+0x20>
ret

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

LLVM IR (-O2):
define void @dhad(i32 %0, double* nocapture %1, i32 %2, double* nocapture %3, i32 %4) {
%6 = icmp sgt i32 %0, 0
br i1 %6, label %7, label %22
7: ; preds = %5
%8 = sext i32 %4 to i64
%9 = sext i32 %2 to i64
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %7, %11
%12 = phi i64 [ 0, %7 ], [ %20, %11 ]
%13 = phi i64 [ 0, %7 ], [ %19, %11 ]
%14 = getelementptr inbounds double, double* %3, i64 %13
%15 = load double, double* %14
%16 = getelementptr inbounds double, double* %1, i64 %12
%17 = load double, double* %16
%18 = fmul double %15, %17
store double %18, double* %16
%19 = add i64 %13, %8
%20 = add i64 %12, %9
%21 = icmp slt i64 %20, %10
br i1 %21, label %11, label %22
22: ; preds = %11, %5
ret void
}
int main() {
  int *p = (int *)malloc(sizeof(int));
  *p = 3;
  asm volatile("" : : "r"(p) : "memory");
  free(p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
movl   $0x3,(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i8* @malloc(i64 4)
%4 = bitcast i8* %3 to i32*
store i32* %4, i32** %2
%5 = load i32*, i32** %2
store i32 3, i32* %5
%6 = load i32*, i32** %2
%7 = load i32*, i32** %2
%8 = bitcast i32* %7 to i8*
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call dereferenceable_or_null(4) i8* @malloc(i64 4)
%2 = bitcast i8* %1 to i32*
store i32 3, i32* %2
tail call void asm sideeffect "", "r,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* %2)
tail call void @free(i8* %1)
ret i32 0
}
void ARGBCopyAlphaRow_C() {}


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

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

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

LLVM IR (-O2):
define void @ARGBCopyAlphaRow_C() {
ret void
}
void minus2hyphen(char *dst, const char *src) {
  for (; *src; src++, dst++) {
    if ('-' == *src) {
      *dst = '_';
    } else {
      *dst = *src;
    }
  }
}


x86 assembly (clang, -O0):
<minus2hyphen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1167 <minus2hyphen+0x67>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x2d,%eax
cmp    %ecx,%eax
jne    1139 <minus2hyphen+0x39>
mov    -0x8(%rbp),%rax
movb   $0x5f,(%rax)
jmp    1145 <minus2hyphen+0x45>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
jmp    114a <minus2hyphen+0x4a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <minus2hyphen+0xc>
pop    %rbp
ret

x86 assembly (clang, -O2):
<minus2hyphen>:
xor    %eax,%eax
jmp    1117 <minus2hyphen+0x17>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %dl,(%rdi,%rax,1)
add    $0x1,%rax
movzbl (%rsi,%rax,1),%ecx
mov    $0x5f,%dl
cmp    $0x2d,%cl
je     1110 <minus2hyphen+0x10>
test   %cl,%cl
je     112a <minus2hyphen+0x2a>
mov    %ecx,%edx
jmp    1110 <minus2hyphen+0x10>
ret

LLVM IR (-O0):
define void @minus2hyphen(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 = %21, %2
%6 = load i8*, i8** %4
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %26
9: ; preds = %5
%10 = load i8*, i8** %4
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 45, %12
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = load i8*, i8** %3
store i8 95, i8* %15
br label %20
16: ; preds = %9
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = load i8*, i8** %3
store i8 %18, i8* %19
br label %20
20: ; preds = %16, %14
br label %21
21: ; preds = %20
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %4
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %3
br label %5
26: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @minus2hyphen(i8* nocapture writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i8* [ %0, %2 ], [ %11, %8 ]
%5 = phi i8* [ %1, %2 ], [ %10, %8 ]
%6 = load i8, i8* %5
switch i8 %6, label %7 [
i8 0, label %12
i8 45, label %8
]
7: ; preds = %3
br label %8
8: ; preds = %3, %7
%9 = phi i8 [ %6, %7 ], [ 95, %3 ]
store i8 %9, i8* %4
%10 = getelementptr inbounds i8, i8* %5, i64 1
%11 = getelementptr inbounds i8, i8* %4, i64 1
br label %3
12: ; preds = %3
ret void
}
unsigned char passthrough(unsigned char i) { return i; }


x86 assembly (clang, -O0):
<passthrough>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<passthrough>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define zeroext i8 @passthrough(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
ret i8 %3
}

LLVM IR (-O2):
define zeroext i8 @passthrough(i8 returned zeroext %0) {
ret i8 %0
}
void caller_1_2_2_1_1_1_2() {}


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

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

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

LLVM IR (-O2):
define void @caller_1_2_2_1_1_1_2() {
ret void
}
__attribute__((no)) int bar() {
  int a = -1;
  volatile unsigned b = 1U;
  int c = 1;
  c = (a + 972195718) % (b ? 1 : 0);
  if (c == 972195717)
    ;
  else
    __builtin_abort();
  return 0;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x39f28786,%eax
mov    -0x8(%rbp),%esi
xor    %ecx,%ecx
mov    $0x1,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmpl   $0x39f28785,-0xc(%rbp)
jne    115d <bar+0x4d>
jmp    1162 <bar+0x52>
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rax
movl   $0x1,0x4(%rsp)
mov    0x4(%rsp),%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @bar() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 -1, i32* %1
store volatile i32 1, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 972195718
%6 = load volatile i32, i32* %2
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 1, i32 0
%10 = srem i32 %5, %9
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 972195717
br i1 %12, label %13, label %14
13: ; preds = %0
br label %15
14: ; preds = %0
unreachable
15: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
define i32 @bar() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store volatile i32 1, i32* %1
%3 = load volatile i32, i32* %1
tail call void @abort()
unreachable
}
signed char signedchar_ignoring_signedlonglong(signed char x,
                                               signed long long y) {
  return x;
}


x86 assembly (clang, -O0):
<signedchar_ignoring_signedlonglong>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<signedchar_ignoring_signedlonglong>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define signext i8 @signedchar_ignoring_signedlonglong(i8 returned signext %0, i64 %1) {
ret i8 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int dll_getc(int /*<<< orphan*/ *);
int __wrap_getc(FILE *stream) { return dll_getc(stream); }


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

x86 assembly (clang, -O2):
<__wrap_getc>:
jmp    1030 <dll_getc@plt>

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

LLVM IR (-O2):
define i32 @__wrap_getc(i32* %0) {
%2 = tail call i32 @dll_getc(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *my_malloc(size_t size) {
  void *ptr = malloc(size);
  if (ptr == NULL) {
    fprintf(stderr, "malloc failed!\n");
    exit(EXIT_FAILURE);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<my_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1177 <my_malloc+0x47>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_malloc>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     113d <my_malloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"malloc failed!\0A\00"
@EXIT_FAILURE = global i32 0
define i8* @my_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"malloc failed!\0A\00"
@EXIT_FAILURE = global i32 0
define noalias i8* @my_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ COLOR_PAIR(int);
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int get_cols();
int get_rows();
int /*<<< orphan*/ mvprintw(int, int, char *);
void draw_gameover() {
  int menu_top = get_rows() / 2;
  int colstart = (get_cols() / 2) - 14;
  attron(COLOR_PAIR(3));
  mvprintw(menu_top, colstart, "G A M E   O V E R");
  attroff(COLOR_PAIR(3));
}


x86 assembly (clang, -O0):
<draw_gameover>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1070 <get_rows@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <get_cols@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    $0xe,%eax
mov    %eax,-0x8(%rbp)
mov    $0x3,%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1050 <attron@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    0xe53(%rip),%rdx
call   1080 <mvprintw@plt>
mov    $0x3,%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_gameover>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1070 <get_rows@plt>
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
xor    %eax,%eax
call   1040 <get_cols@plt>
mov    %eax,%ebp
shr    $0x1f,%ebp
add    %eax,%ebp
sar    %ebp
add    $0xfffffff2,%ebp
mov    $0x3,%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1050 <attron@plt>
lea    0xe62(%rip),%rdx
mov    %ebx,%edi
mov    %ebp,%esi
call   1080 <mvprintw@plt>
mov    $0x3,%edi
call   1060 <COLOR_PAIR@plt>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <attroff@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"G A M E O V E R\00"
define void @draw_gameover() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @get_rows()
%4 = sdiv i32 %3, 2
store i32 %4, i32* %1
%5 = call i32 (...) @get_cols()
%6 = sdiv i32 %5, 2
%7 = sub nsw i32 %6, 14
store i32 %7, i32* %2
%8 = call i32 @COLOR_PAIR(i32 3)
%9 = call i32 @attron(i32 %8)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = call i32 @mvprintw(i32 %10, i32 %11, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @COLOR_PAIR(i32 3)
%14 = call i32 @attroff(i32 %13)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"G A M E O V E R\00"
define void @draw_gameover() {
%1 = tail call i32 (...) @get_rows()
%2 = sdiv i32 %1, 2
%3 = tail call i32 (...) @get_cols()
%4 = sdiv i32 %3, 2
%5 = add nsw i32 %4, -14
%6 = tail call i32 @COLOR_PAIR(i32 3)
%7 = tail call i32 @attron(i32 %6)
%8 = tail call i32 @mvprintw(i32 %2, i32 %5, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @COLOR_PAIR(i32 3)
%10 = tail call i32 @attroff(i32 %9)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int returnError(FILE *s, int error) {
  fclose(s);
  return error;
}


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

x86 assembly (clang, -O2):
<returnError>:
push   %rbx
mov    %esi,%ebx
call   1030 <fclose@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @returnError(i32* nocapture %0, i32 returned %1) {
%3 = tail call i32 @fclose(i32* %0)
ret i32 %1
}
/* Variables and functions */
const char *udev_get_run_path(void *udev) {
  if (!udev)
    return NULL;
  return "/run/udev";
}


x86 assembly (clang, -O0):
<udev_get_run_path>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1120 <udev_get_run_path+0x20>
movq   $0x0,-0x8(%rbp)
jmp    112b <udev_get_run_path+0x2b>
lea    0xed9(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<udev_get_run_path>:
test   %rdi,%rdi
lea    0xef6(%rip),%rax
cmove  %rdi,%rax
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"/run/udev\00"
define i8* @udev_get_run_path(i8* readnone %0) {
%2 = icmp eq i8* %0, null
%3 = select i1 %2, i8* null, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
/* Variables and functions */
int AMI_Dn_RegisterBit8(void *, int, int);
int /*<<< orphan*/ AMI_udelay(int);
int AMI_Standby(void *i2c_hnd) {
  int res = 0;
  res = AMI_Dn_RegisterBit8(i2c_hnd, 0x1b, 0x80);
  AMI_udelay(30);
  return (res);
}


x86 assembly (clang, -O0):
<AMI_Standby>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1b,%esi
mov    $0x80,%edx
call   1040 <AMI_Dn_RegisterBit8@plt>
mov    %eax,-0xc(%rbp)
mov    $0x1e,%edi
call   1030 <AMI_udelay@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AMI_Standby>:
push   %rbx
mov    $0x1b,%esi
mov    $0x80,%edx
call   1040 <AMI_Dn_RegisterBit8@plt>
mov    %eax,%ebx
mov    $0x1e,%edi
call   1030 <AMI_udelay@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @AMI_Standby(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = call i32 @AMI_Dn_RegisterBit8(i8* %4, i32 27, i32 128)
store i32 %5, i32* %3
%6 = call i32 @AMI_udelay(i32 30)
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @AMI_Standby(i8* %0) {
%2 = tail call i32 @AMI_Dn_RegisterBit8(i8* %0, i32 27, i32 128)
%3 = tail call i32 @AMI_udelay(i32 30)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, float *);
float get_n(void) {
  float N;
  printf("Provide a value for N (number of teeth): ");
  scanf("%f", &N);
  assert(N > 7);
  return N;
}


x86 assembly (clang, -O0):
<get_n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x4(%rbp),%xmm0
movss  0xe9f(%rip),%xmm1
ucomiss %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_n>:
push   %rax
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
xor    %edi,%edi
ucomiss 0xea3(%rip),%xmm0
seta   %dil
call   1040 <assert@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Provide a value for N (number of teeth): \00"
@.str.1 = [3 x i8] c"%f\00"
define float @get_n() {
%1 = alloca float
%2 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%4 = load float, float* %1
%5 = fcmp ogt float %4, 7.000000e+00
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load float, float* %1
ret float %8
}

LLVM IR (-O2):
@.str = [42 x i8] c"Provide a value for N (number of teeth): \00"
@.str.1 = [3 x i8] c"%f\00"
define float @get_n() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fcmp ogt float %5, 7.000000e+00
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load float, float* %1
ret float %9
}
void FreeMatrix3Int(int ***in) {
  free(in[0][0]);
  free(in[0]);
  free(in);
}


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

x86 assembly (clang, -O2):
<FreeMatrix3Int>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    (%rbx),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @FreeMatrix3Int(i32*** %0) {
%2 = alloca i32***
store i32*** %0, i32**** %2
%3 = load i32***, i32**** %2
%4 = getelementptr inbounds i32**, i32*** %3, i64 0
%5 = load i32**, i32*** %4
%6 = getelementptr inbounds i32*, i32** %5, i64 0
%7 = load i32*, i32** %6
%8 = bitcast i32* %7 to i8*
%9 = load i32***, i32**** %2
%10 = getelementptr inbounds i32**, i32*** %9, i64 0
%11 = load i32**, i32*** %10
%12 = bitcast i32** %11 to i8*
%13 = load i32***, i32**** %2
%14 = bitcast i32*** %13 to i8*
ret void
}

LLVM IR (-O2):
define void @FreeMatrix3Int(i32*** nocapture %0) {
%2 = bitcast i32*** %0 to i8***
%3 = load i8**, i8*** %2
%4 = load i8*, i8** %3
tail call void @free(i8* %4)
%5 = bitcast i32*** %0 to i8**
%6 = load i8*, i8** %5
tail call void @free(i8* %6)
%7 = bitcast i32*** %0 to i8*
tail call void @free(i8* %7)
ret void
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ putc(int, int /*<<< orphan*/ *);
void writeSilence(FILE *output, uint32_t s) {
  int n;
  for (n = 0; n < s; n++)
    putc(128, output);
}


x86 assembly (clang, -O0):
<writeSilence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    114e <writeSilence+0x3e>
mov    -0x8(%rbp),%rsi
mov    $0x80,%edi
call   1030 <putc@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <writeSilence+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeSilence>:
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
jle    1132 <writeSilence+0x22>
mov    %esi,%ebx
mov    %rdi,%r14
nopl   (%rax)
mov    $0x80,%edi
mov    %r14,%rsi
call   1030 <putc@plt>
add    $0xffffffff,%ebx
jne    1120 <writeSilence+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @writeSilence(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ 0, %2 ]
%6 = tail call i32 @putc(i32 128, i32* %0)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %1
br i1 %8, label %9, label %4
9: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void test_ok(int flag) {
  if (flag) {
    printf("PASS\n");
  } else {
    printf("ERROR\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<test_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1146 <test_ok+0x26>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
jmp    115c <test_ok+0x3c>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ok>:
test   %edi,%edi
je     1130 <test_ok+0x10>
lea    0xedb(%rip),%rdi
jmp    1030 <puts@plt>
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@str = [6 x i8] c"ERROR\00"
@str.2 = [5 x i8] c"PASS\00"
define void @test_ok(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.2, i64 0, i64 0))
ret void
5: ; preds = %1
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
}