xunge/DecIR huggingface dataset:
unsigned char extract_grey(unsigned char *grey, int i) {
  unsigned char val;
  if (i % 2 == 1) {
    val = (grey[i / 2] & 0x0F) << 4;
  } else {
    val = (grey[i / 2] & 0xF0);
  }
  return val | (val >> 4);
}


x86 assembly (clang, -O0):
<extract_grey>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    114d <extract_grey+0x4d>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
and    $0xf,%eax
shl    $0x4,%eax
mov    %al,-0xd(%rbp)
jmp    1175 <extract_grey+0x75>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
and    $0xf0,%eax
mov    %al,-0xd(%rbp)
movzbl -0xd(%rbp),%eax
movzbl -0xd(%rbp),%ecx
sar    $0x4,%ecx
or     %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_grey>:
mov    %esi,%eax
shr    $0x1f,%eax
add    %esi,%eax
mov    %eax,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%esi
sar    %eax
cltq
mov    (%rdi,%rax,1),%al
mov    %eax,%ecx
shl    $0x4,%cl
and    $0xf0,%al
cmp    $0x1,%esi
movzbl %cl,%ecx
movzbl %al,%edx
cmove  %ecx,%edx
mov    %edx,%eax
shr    $0x4,%al
or     %dl,%al
ret

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

LLVM IR (-O2):
define zeroext i8 @extract_grey(i8* nocapture %0, i32 %1) {
%3 = srem i32 %1, 2
%4 = icmp eq i32 %3, 1
%5 = sdiv i32 %1, 2
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = shl i8 %8, 4
%10 = and i8 %8, -16
%11 = select i1 %4, i8 %9, i8 %10
%12 = lshr exact i8 %11, 4
%13 = or i8 %12, %11
ret i8 %13
}
int main() {
  if (1) {
    5;
    if (3) {
      30;
    }
    10;
  } else if (2) {
    15;
    return 1;
  } else {
    20;
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int test_imm_B3int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0xB3 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_B3int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 11730944
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ put8(int);
void mov_reg32_preg64preg64(int reg1, int reg2, int reg3) {
  put8(0x8B);
  put8((reg1 << 3) | 0x04);
  put8((reg2 << 3) | reg3);
}


x86 assembly (clang, -O0):
<mov_reg32_preg64preg64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0x8b,%edi
call   1030 <put8@plt>
mov    -0x4(%rbp),%edi
shl    $0x3,%edi
or     $0x4,%edi
call   1030 <put8@plt>
mov    -0x8(%rbp),%edi
shl    $0x3,%edi
or     -0xc(%rbp),%edi
call   1030 <put8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mov_reg32_preg64preg64>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
mov    $0x8b,%edi
call   1030 <put8@plt>
lea    0x4(,%rbx,8),%edi
call   1030 <put8@plt>
shl    $0x3,%ebp
or     %r14d,%ebp
mov    %ebp,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <put8@plt>

LLVM IR (-O0):
define void @mov_reg32_preg64preg64(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = call i32 @put8(i32 139)
%8 = load i32, i32* %4
%9 = shl i32 %8, 3
%10 = or i32 %9, 4
%11 = call i32 @put8(i32 %10)
%12 = load i32, i32* %5
%13 = shl i32 %12, 3
%14 = load i32, i32* %6
%15 = or i32 %13, %14
%16 = call i32 @put8(i32 %15)
ret void
}

LLVM IR (-O2):
define void @mov_reg32_preg64preg64(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @put8(i32 139)
%5 = shl i32 %0, 3
%6 = or i32 %5, 4
%7 = tail call i32 @put8(i32 %6)
%8 = shl i32 %1, 3
%9 = or i32 %8, %2
%10 = tail call i32 @put8(i32 %9)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ U_WMRNOTIMPLEMENTED_swap(char *, int);
void U_WMR65_swap(char *record, int torev) {
  U_WMRNOTIMPLEMENTED_swap(record, torev);
}


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

x86 assembly (clang, -O2):
<U_WMR65_swap>:
jmp    1030 <U_WMRNOTIMPLEMENTED_swap@plt>

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

LLVM IR (-O2):
define void @U_WMR65_swap(i8* %0, i32 %1) {
%3 = tail call i32 @U_WMRNOTIMPLEMENTED_swap(i8* %0, i32 %1)
ret void
}
void outb(unsigned short port, unsigned char v) {
  asm volatile("outb %0, %w1" : : "Ral"(v), "Nd"(port));
}


x86 assembly (clang, -O0):
<outb>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    -0x2(%rbp),%dx
out    %al,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define void @outb(i16 zeroext %0, i8 zeroext %1) {
%3 = alloca i16
%4 = alloca i8
store i16 %0, i16* %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = load i16, i16* %3
ret void
}

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void del(void *value) { free(value); }


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

x86 assembly (clang, -O2):
<del>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @del(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_001();
int /*<<< orphan*/ test_002();
int /*<<< orphan*/ test_003();
int /*<<< orphan*/ test_004();
int /*<<< orphan*/ test_005();
int main(int argc, char **argv) {
  test_001();
  test_002();
  test_003();
  test_004();
  test_005();
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <test_001@plt>
mov    $0x0,%al
call   1060 <test_002@plt>
mov    $0x0,%al
call   1040 <test_003@plt>
mov    $0x0,%al
call   1070 <test_004@plt>
mov    $0x0,%al
call   1050 <test_005@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_001@plt>
xor    %eax,%eax
call   1060 <test_002@plt>
xor    %eax,%eax
call   1040 <test_003@plt>
xor    %eax,%eax
call   1070 <test_004@plt>
xor    %eax,%eax
call   1050 <test_005@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
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 = call i32 (...) @test_001()
%7 = call i32 (...) @test_002()
%8 = call i32 (...) @test_003()
%9 = call i32 (...) @test_004()
%10 = call i32 (...) @test_005()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test_001()
%4 = tail call i32 (...) @test_002()
%5 = tail call i32 (...) @test_003()
%6 = tail call i32 (...) @test_004()
%7 = tail call i32 (...) @test_005()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ GLsizei;
typedef int /*<<< orphan*/ GLbyte;

/* Variables and functions */
int /*<<< orphan*/ GL_BYTE;
int /*<<< orphan*/ glCallLists(int /*<<< orphan*/, int /*<<< orphan*/,
                               int /*<<< orphan*/ *);
int /*<<< orphan*/ strlen(char *);
void stroke_printStrokedString(char *s) {
  GLsizei len = strlen(s);
  glCallLists(len, GL_BYTE, (GLbyte *)s);
}


x86 assembly (clang, -O0):
<stroke_printStrokedString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    0x2ea6(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rdx
call   1040 <glCallLists@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stroke_printStrokedString>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    0x2eb8(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
mov    %rbx,%rdx
pop    %rbx
jmp    1040 <glCallLists@plt>

LLVM IR (-O0):
@GL_BYTE = global i32 0
define void @stroke_printStrokedString(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = load i32, i32* @GL_BYTE
%8 = load i8*, i8** %2
%9 = bitcast i8* %8 to i32*
%10 = call i32 @glCallLists(i32 %6, i32 %7, i32* %9)
ret void
}

LLVM IR (-O2):
@GL_BYTE = global i32 0
define void @stroke_printStrokedString(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = load i32, i32* @GL_BYTE
%4 = bitcast i8* %0 to i32*
%5 = tail call i32 @glCallLists(i32 %2, i32 %3, i32* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clear();
int /*<<< orphan*/ mvaddstr(int /*<<< orphan*/, int /*<<< orphan*/, char *);
void show_keymap(void) {
  clear();
  mvaddstr(0, 0,
           "\nHELP (KEYMAP)"
           "\n"
           "\n	CTRL+CANC: Quit without saving"
           "\n	CTRL+{UP, DOWN, LEFT RIGHT}: Natural movement"
           "\n	CTRL+{PGUP PGDOWN}: "
           "\n	CTRL+W: Delete one word"
           "\n	CTRL+R: Undo last action"
           "\n	CTRL+S: Save current document"
           "\n	CTRL+Q: Quit"
           "\n	CTRL+X: Save"
           "\n	CTRL+/: Find a word"
           "\n	CTRL+N: Find next"
           "\n	CTRL+H: Horizontal selection mode"
           "\n	CTRL+V: Vertical selection mode"
           "\n	CTRL+E: Command mode"
           "\n	CTRL+O: Open file"
           "\n	CTRL+A: Raname current file buffer"
           "\n"
           "\nHELP (END)"
           "\n"
           "\n");
}


x86 assembly (clang, -O0):
<show_keymap>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <clear@plt>
xor    %esi,%esi
lea    0xecc(%rip),%rdx
mov    %esi,%edi
call   1030 <mvaddstr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_keymap>:
push   %rax
xor    %eax,%eax
call   1040 <clear@plt>
lea    0xed1(%rip),%rdx
xor    %edi,%edi
xor    %esi,%esi
pop    %rax
jmp    1030 <mvaddstr@plt>

LLVM IR (-O0):
@.str = [426 x i8] c"\0AHELP (KEYMAP)\0A\0A\09CTRL+CANC: Quit without saving\0A\09CTRL+{UP, DOWN, LEFT RIGHT}: Natural movement\0A\09CTRL+{PGUP PGDOWN}: \0A\09CTRL+W: Delete one word\0A\09CTRL+R: Undo last action\0A\09CTRL+S: Save current document\0A\09CTRL+Q: Quit\0A\09CTRL+X: Save\0A\09CTRL+/: Find a word\0A\09CTRL+N: Find next\0A\09CTRL+H: Horizontal selection mode\0A\09CTRL+V: Vertical selection mode\0A\09CTRL+E: Command mode\0A\09CTRL+O: Open file\0A\09CTRL+A: Raname current file buffer\0A\0AHELP (END)\0A\0A\00"
define void @show_keymap() {
%1 = call i32 (...) @clear()
%2 = call i32 @mvaddstr(i32 0, i32 0, i8* getelementptr inbounds ([426 x i8], [426 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [426 x i8] c"\0AHELP (KEYMAP)\0A\0A\09CTRL+CANC: Quit without saving\0A\09CTRL+{UP, DOWN, LEFT RIGHT}: Natural movement\0A\09CTRL+{PGUP PGDOWN}: \0A\09CTRL+W: Delete one word\0A\09CTRL+R: Undo last action\0A\09CTRL+S: Save current document\0A\09CTRL+Q: Quit\0A\09CTRL+X: Save\0A\09CTRL+/: Find a word\0A\09CTRL+N: Find next\0A\09CTRL+H: Horizontal selection mode\0A\09CTRL+V: Vertical selection mode\0A\09CTRL+E: Command mode\0A\09CTRL+O: Open file\0A\09CTRL+A: Raname current file buffer\0A\0AHELP (END)\0A\0A\00"
define void @show_keymap() {
%1 = tail call i32 (...) @clear()
%2 = tail call i32 @mvaddstr(i32 0, i32 0, i8* getelementptr inbounds ([426 x i8], [426 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EX_USAGE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void emit_help(void) {
  fputs("Usage: blocksig [-s 'signum ..'] command [args ..]\n", stderr);
  exit(EX_USAGE);
}


x86 assembly (clang, -O0):
<emit_help>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<emit_help>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"Usage: blocksig [-s 'signum ..'] command [args ..]\0A\00"
@stderr = global i32 0
@EX_USAGE = global i32 0
define void @emit_help() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EX_USAGE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@.str = [52 x i8] c"Usage: blocksig [-s 'signum ..'] command [args ..]\0A\00"
@stderr = global i32 0
@EX_USAGE = global i32 0
define void @emit_help() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EX_USAGE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "usage :  createtable  [-options]  ifile  ofile\n");
  fprintf(stderr, "with:\n");
  fprintf(stderr, "   -debug        debugging mode\n");
  fprintf(stderr, "   -version      display version number\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    0xef7(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
lea    0xee9(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
lea    0xef5(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf01(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xefa(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf0d(%rip),%rsi
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [48 x i8] c"usage : createtable [-options] ifile ofile\0A\00"
@.str.1 = [7 x i8] c"with:\0A\00"
@.str.2 = [33 x i8] c" -debug debugging mode\0A\00"
@.str.3 = [41 x i8] c" -version display version number\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [48 x i8] c"usage : createtable [-options] ifile ofile\0A\00"
@.str.1 = [7 x i8] c"with:\0A\00"
@.str.2 = [33 x i8] c" -debug debugging mode\0A\00"
@.str.3 = [41 x i8] c" -version display version number\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ *opendir(char const *);
int /*<<< orphan*/ stderr;
DIR *xopendir(const char *name) {
  DIR *open;
  if ((open = opendir(name)) == NULL)
    fprintf(stderr, "Error in opendir function.\n");
  return (open);
}


x86 assembly (clang, -O0):
<xopendir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <opendir@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1158 <xopendir+0x38>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
lea    0xead(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xopendir>:
push   %rbx
call   1030 <opendir@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <xopendir+0x23>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
lea    0xec2(%rip),%rsi
call   1040 <fprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"Error in opendir function.\0A\00"
define i32* @xopendir(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32* @opendir(i8* %4)
store i32* %5, i32** %3
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %7, %1
%11 = load i32*, i32** %3
ret i32* %11
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"Error in opendir function.\0A\00"
define noalias i32* @xopendir(i8* nocapture %0) {
%2 = tail call i32* @opendir(i8* %0)
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %4, %1
ret i32* %2
}
int test_imm_41int8_reg(signed char val) {
  return ((val) & (-0x41 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_41int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffffbf,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_41int8_reg>:
test   $0xbf,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_41int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -65
%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_41int8_reg(i8 signext %0) {
%2 = and i8 %0, -65
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
void store64(void *dst, uint64_t w) { *(uint64_t *)(dst) = w; }


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

x86 assembly (clang, -O2):
<store64>:
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @store64(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
void unwind_remove_table(void *handle, int init_only) {}


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

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

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

LLVM IR (-O2):
define void @unwind_remove_table(i8* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
scalar_t__ IsEndOfLine(char);
__attribute__((always_)) bool IsWhitespace(char C) {
  bool Result = ((C == ' ') || (C == '\t') || (C == '\v') || (C == '\f') ||
                 IsEndOfLine(C));
  return Result;
}


x86 assembly (clang, -O0):
<IsWhitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x9(%rbp)
je     1179 <IsWhitespace+0x69>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x9(%rbp)
je     1179 <IsWhitespace+0x69>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xb,%ecx
mov    %al,-0x9(%rbp)
je     1179 <IsWhitespace+0x69>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xc,%ecx
mov    %al,-0x9(%rbp)
je     1179 <IsWhitespace+0x69>
movsbl -0x1(%rbp),%edi
call   1030 <IsEndOfLine@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsWhitespace>:
cmp    $0x20,%dil
ja     1130 <IsWhitespace+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x100001a00,%rdx
bt     %rcx,%rdx
jae    1130 <IsWhitespace+0x20>
ret
push   %rax
movsbl %dil,%edi
call   1030 <IsEndOfLine@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @IsWhitespace(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 32
br i1 %6, label %23, label %7
7: ; preds = %1
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 9
br i1 %10, label %23, label %11
11: ; preds = %7
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 11
br i1 %14, label %23, label %15
15: ; preds = %11
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 12
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = load i8, i8* %2
%21 = call i64 @IsEndOfLine(i8 signext %20)
%22 = icmp ne i64 %21, 0
br label %23
23: ; preds = %19, %15, %11, %7, %1
%24 = phi i1 [ true, %15 ], [ true, %11 ], [ true, %7 ], [ true, %1 ], [ %22, %19 ]
%25 = zext i1 %24 to i32
store i32 %25, i32* %3
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @IsWhitespace(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %6
i8 12, label %6
i8 11, label %6
i8 9, label %6
]
2: ; preds = %1
%3 = tail call i64 @IsEndOfLine(i8 signext %0)
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i32
br label %6
6: ; preds = %1, %1, %1, %1, %2
%7 = phi i32 [ 1, %1 ], [ %5, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %7
}
void confuse() {}


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

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

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

LLVM IR (-O2):
define void @confuse() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ U_raw(int *, int *, int);
void U_r(int *a, int *b) { U_raw(a, b, 1); }


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

x86 assembly (clang, -O2):
<U_r>:
mov    $0x1,%edx
jmp    1030 <U_raw@plt>

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

LLVM IR (-O2):
define void @U_r(i32* %0, i32* %1) {
%3 = tail call i32 @U_raw(i32* %0, i32* %1, i32 1)
ret void
}
/* Type definitions */
struct timespec {
  int tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
double get_sec(struct timespec *start, struct timespec *end) {
  return (double)(end->tv_sec - start->tv_sec +
                  (end->tv_nsec - start->tv_nsec) * 1e-9);
}


x86 assembly (clang, -O0):
<get_sec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x8(%rbp),%rcx
sub    0x8(%rcx),%rax
cvtsi2sd %rax,%xmm1
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
sub    (%rcx),%eax
cvtsi2sd %eax,%xmm0
movsd  0xec7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_sec>:
mov    0x8(%rsi),%rax
sub    0x8(%rdi),%rax
cvtsi2sd %rax,%xmm1
mov    (%rsi),%eax
sub    (%rdi),%eax
cvtsi2sd %eax,%xmm0
mulsd  0xee3(%rip),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
define double @get_sec(%struct.timespec* %0, %struct.timespec* %1) {
%3 = alloca %struct.timespec*
%4 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %3
store %struct.timespec* %1, %struct.timespec** %4
%5 = load %struct.timespec*, %struct.timespec** %4
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 1
%7 = load i64, i64* %6
%8 = load %struct.timespec*, %struct.timespec** %3
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 1
%10 = load i64, i64* %9
%11 = sub nsw i64 %7, %10
%12 = sitofp i64 %11 to double
%13 = load %struct.timespec*, %struct.timespec** %4
%14 = getelementptr inbounds %struct.timespec, %struct.timespec* %13, i32 0, i32 0
%15 = load i32, i32* %14
%16 = load %struct.timespec*, %struct.timespec** %3
%17 = getelementptr inbounds %struct.timespec, %struct.timespec* %16, i32 0, i32 0
%18 = load i32, i32* %17
%19 = sub nsw i32 %15, %18
%20 = sitofp i32 %19 to double
%21 = call double @llvm.fmuladd.f64(double %20, double 1.000000e-09, double %12)
ret double %21
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
define double @get_sec(%struct.timespec* nocapture %0, %struct.timespec* nocapture %1) {
%3 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%4 = load i64, i64* %3
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%6 = load i64, i64* %5
%7 = sub nsw i64 %4, %6
%8 = sitofp i64 %7 to double
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%12 = load i32, i32* %11
%13 = sub nsw i32 %10, %12
%14 = sitofp i32 %13 to double
%15 = tail call double @llvm.fmuladd.f64(double %14, double 1.000000e-09, double %8)
ret double %15
}
void test_three(int x, int y) {
#pragma omp target parallel for collapse(1)
  for (int i = 0; i < x; i++)
    for (int i = 0; i < y; i++)
      ;
}


x86 assembly (clang, -O0):
<test_three>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1156 <test_three+0x56>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1143 <test_three+0x43>
jmp    1135 <test_three+0x35>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1124 <test_three+0x24>
jmp    1148 <test_three+0x48>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1111 <test_three+0x11>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @test_three(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ errx(int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void checked_close(int fd) {
  int err = close(fd);
  if (err != 0) {
    errx(1, "Failed to close a file: %s", strerror(errno));
  }
}


x86 assembly (clang, -O0):
<checked_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1171 <checked_close+0x41>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xe94(%rip),%rsi
call   1030 <errx@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checked_close>:
push   %rax
call   1040 <close@plt>
test   %eax,%eax
je     115c <checked_close+0x2c>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xeb1(%rip),%rsi
mov    $0x1,%edi
mov    %eax,%edx
pop    %rax
jmp    1030 <errx@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Failed to close a file: %s\00"
@errno = global i32 0
define void @checked_close(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @close(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* @errno
%10 = call i32 @strerror(i32 %9)
%11 = call i32 @errx(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Failed to close a file: %s\00"
@errno = global i32 0
define void @checked_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = load i32, i32* @errno
%6 = tail call i32 @strerror(i32 %5)
%7 = tail call i32 @errx(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %8
8: ; preds = %4, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
scalar_t__ read(int, int /*<<< orphan*/ *, int);
void read_n_bytes(int fd, uint8_t *buf, int length) {
  int n = 0;
  while (n < length) {
    n += read(fd, buf + n, length - n);
  }
}


x86 assembly (clang, -O0):
<read_n_bytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1164 <read_n_bytes+0x54>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
movslq -0x18(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x14(%rbp),%edx
sub    -0x18(%rbp),%edx
call   1030 <read@plt>
mov    %rax,%rcx
movslq -0x18(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x18(%rbp)
jmp    1129 <read_n_bytes+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_n_bytes>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edx,%edx
jle    1149 <read_n_bytes+0x39>
mov    %edx,%ebx
mov    %rsi,%r14
mov    %edi,%r15d
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movslq %eax,%rbp
lea    (%r14,%rbp,4),%rsi
mov    %ebx,%edx
sub    %ebp,%edx
mov    %r15d,%edi
call   1030 <read@plt>
add    %ebp,%eax
cmp    %ebx,%eax
jl     1130 <read_n_bytes+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @read_n_bytes(i32 %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %14
5: ; preds = %3, %5
%6 = phi i32 [ %12, %5 ], [ 0, %3 ]
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %1, i64 %7
%9 = sub nsw i32 %2, %6
%10 = tail call i64 @read(i32 %0, i32* %8, i32 %9)
%11 = trunc i64 %10 to i32
%12 = add i32 %6, %11
%13 = icmp slt i32 %12, %2
br i1 %13, label %5, label %14
14: ; preds = %5, %3
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
scalar_t__ TSC_RdReg(int, int *);
uint32_t TSC_TouchDet(void) {
  uint8_t val;
  uint32_t rtv = 0;
  if (TSC_RdReg(0x40, &val) == 0) {
    if (val & (1 << 7)) {
      rtv = 1;
    }
  }
  return (rtv);
}


x86 assembly (clang, -O0):
<TSC_TouchDet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
mov    $0x40,%edi
lea    -0x4(%rbp),%rsi
call   1030 <TSC_RdReg@plt>
cmp    $0x0,%rax
jne    1154 <TSC_TouchDet+0x44>
mov    -0x4(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     114f <TSC_TouchDet+0x3f>
movl   $0x1,-0x8(%rbp)
jmp    1154 <TSC_TouchDet+0x44>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TSC_TouchDet>:
push   %rax
lea    0x4(%rsp),%rsi
mov    $0x40,%edi
call   1030 <TSC_RdReg@plt>
mov    0x4(%rsp),%edx
shr    $0x7,%edx
and    $0x1,%edx
xor    %ecx,%ecx
test   %rax,%rax
cmove  %edx,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @TSC_TouchDet() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %2
%3 = call i64 @TSC_RdReg(i32 64, i32* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %0
%6 = load i32, i32* %1
%7 = and i32 %6, 128
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %5
store i32 1, i32* %2
br label %10
10: ; preds = %9, %5
br label %11
11: ; preds = %10, %0
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @TSC_TouchDet() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i64 @TSC_RdReg(i32 64, i32* %1)
%4 = icmp eq i64 %3, 0
%5 = load i32, i32* %1
%6 = lshr i32 %5, 7
%7 = and i32 %6, 1
%8 = select i1 %4, i32 %7, i32 0
ret i32 %8
}
/* Variables and functions */
int strcmp(char const *, char *);
int nfcmp(const char *nf, char *rec) {
  char *cp, tmp;
  int ret;
  for (cp = rec; *cp != ':'; cp++)
    ;
  tmp = *(cp + 1);
  *(cp + 1) = '\0';
  ret = strcmp(nf, rec);
  *(cp + 1) = tmp;
  return (ret);
}


x86 assembly (clang, -O0):
<nfcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
je     114e <nfcmp+0x3e>
jmp    113d <nfcmp+0x2d>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <nfcmp+0x18>
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x20(%rbp)
mov    -0x19(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nfcmp>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x3a,(%rbx)
lea    0x1(%rbx),%rbx
jne    1120 <nfcmp+0x10>
mov    (%rbx),%bpl
movb   $0x0,(%rbx)
call   1030 <strcmp@plt>
mov    %bpl,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @nfcmp(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 58
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = load i8, i8* %7
store i8 0, i8* %7
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
store i8 %9, i8* %7
ret i32 %10
}
/* Type definitions */
struct cli_def {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cli_print(struct cli_def *, char *, char const *);
int hook_exit(struct cli_def *cli, const char *command, char *argv[],
              int argc) {
  cli_print(cli, "Hook (exit): %s", command);
  return 0;
}


x86 assembly (clang, -O0):
<hook_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeca(%rip),%rsi
call   1030 <cli_print@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hook_exit>:
push   %rax
mov    %rsi,%rdx
lea    0xee5(%rip),%rsi
call   1030 <cli_print@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.cli_def = type { i32 }
@.str = [16 x i8] c"Hook (exit): %s\00"
define i32 @hook_exit(%struct.cli_def* %0, i8* %1, i8** %2, i32 %3) {
%5 = alloca %struct.cli_def*
%6 = alloca i8*
%7 = alloca i8**
%8 = alloca i32
store %struct.cli_def* %0, %struct.cli_def** %5
store i8* %1, i8** %6
store i8** %2, i8*** %7
store i32 %3, i32* %8
%9 = load %struct.cli_def*, %struct.cli_def** %5
%10 = load i8*, i8** %6
%11 = call i32 @cli_print(%struct.cli_def* %9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %10)
ret i32 0
}

LLVM IR (-O2):
%struct.cli_def = type { i32 }
@.str = [16 x i8] c"Hook (exit): %s\00"
define i32 @hook_exit(%struct.cli_def* %0, i8* %1, i8** nocapture readnone %2, i32 %3) {
%5 = tail call i32 @cli_print(%struct.cli_def* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}
int create_overcurrents() {}


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

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

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

LLVM IR (-O2):
define i32 @create_overcurrents() {
ret i32 undef
}
void early_map_cpu_to_node(unsigned int cpu, int nid) {}


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

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

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

LLVM IR (-O2):
define void @early_map_cpu_to_node(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int read(int, char *, int);
void get_message(int sock, char *msg) {
  int n;
  n = read(sock, msg, 256);
  if (n < 0) {
    printf("ERROR reading from socket");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<get_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x100,%edx
call   1040 <read@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1173 <get_message+0x43>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_message>:
push   %rax
mov    $0x100,%edx
call   1040 <read@plt>
test   %eax,%eax
js     1141 <get_message+0x11>
pop    %rax
ret
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"ERROR reading from socket\00"
define void @get_message(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
%7 = load i8*, i8** %4
%8 = call i32 @read(i32 %6, i8* %7, i32 256)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"ERROR reading from socket\00"
define void @get_message(i32 %0, i8* nocapture %1) {
%3 = tail call i32 @read(i32 %0, i8* %1, i32 256)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dump_perm(unsigned char *, unsigned char *);
int /*<<< orphan*/ make_perm(unsigned char *, unsigned char *);
int main(void) {
  unsigned char box[256];
  unsigned char ibox[256];
  make_perm(box, ibox);
  dump_perm(box, ibox);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1030 <make_perm@plt>
lea    -0x110(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1040 <dump_perm@plt>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x208,%rsp
lea    0x100(%rsp),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <make_perm@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <dump_perm@plt>
xor    %eax,%eax
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca [256 x i8]
store i32 0, i32* %1
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = call i32 @make_perm(i8* %4, i8* %5)
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%9 = call i32 @dump_perm(i8* %7, i8* %8)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = call i32 @make_perm(i8* %3, i8* %4)
%6 = call i32 @dump_perm(i8* %3, i8* %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int test_ais2ascii(void) {
  fprintf(stderr, "ais2ascii skipped (passed)\n");
  return 1;
}


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

x86 assembly (clang, -O2):
<test_ais2ascii>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"ais2ascii skipped (passed)\0A\00"
define i32 @test_ais2ascii() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"ais2ascii skipped (passed)\0A\00"
define i32 @test_ais2ascii() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret i32 1
}
/* Variables and functions */
double *malloc(int);
int /*<<< orphan*/ my_task(double *, double *);
void two_unregistered_pointers(void) {
  double *p, *q;
  p = malloc(12 * sizeof *p);
  q = malloc(23 * sizeof *q);
  my_task(p, q);
}


x86 assembly (clang, -O0):
<two_unregistered_pointers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x60,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0xb8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <my_task@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<two_unregistered_pointers>:
push   %rbx
mov    $0x60,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    $0xb8,%edi
call   1040 <malloc@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1030 <my_task@plt>

LLVM IR (-O0):
define void @two_unregistered_pointers() {
%1 = alloca double*
%2 = alloca double*
%3 = call double* @malloc(i32 96)
store double* %3, double** %1
%4 = call double* @malloc(i32 184)
store double* %4, double** %2
%5 = load double*, double** %1
%6 = load double*, double** %2
%7 = call i32 @my_task(double* %5, double* %6)
ret void
}

LLVM IR (-O2):
define void @two_unregistered_pointers() {
%1 = tail call double* @malloc(i32 96)
%2 = tail call double* @malloc(i32 184)
%3 = tail call i32 @my_task(double* %1, double* %2)
ret void
}