xunge/DecIR huggingface dataset:
char digit2hex(int digit) {
  if (digit < 10)
    return '0' + digit;
  else
    return 'a' + digit - 10;
}


x86 assembly (clang, -O0):
<digit2hex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    111f <digit2hex+0x1f>
mov    -0x8(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x1(%rbp)
jmp    112b <digit2hex+0x2b>
mov    -0x8(%rbp),%eax
add    $0x61,%eax
sub    $0xa,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<digit2hex>:
cmp    $0xa,%edi
mov    $0x30,%ecx
mov    $0x57,%eax
cmovl  %ecx,%eax
add    %dil,%al
ret

LLVM IR (-O0):
define signext i8 @digit2hex(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 10
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = add nsw i32 48, %7
%9 = trunc i32 %8 to i8
store i8 %9, i8* %2
br label %15
10: ; preds = %1
%11 = load i32, i32* %3
%12 = add nsw i32 97, %11
%13 = sub nsw i32 %12, 10
%14 = trunc i32 %13 to i8
store i8 %14, i8* %2
br label %15
15: ; preds = %10, %6
%16 = load i8, i8* %2
ret i8 %16
}

LLVM IR (-O2):
define signext i8 @digit2hex(i32 %0) {
%2 = icmp slt i32 %0, 10
%3 = trunc i32 %0 to i8
%4 = select i1 %2, i8 48, i8 87
%5 = add i8 %4, %3
ret i8 %5
}
/* Variables and functions */
int errno;
int unlink(char const *);
int unlink_file(const char *file) {
  int err;
  err = unlink(file);
  if (err)
    return -errno;
  return 0;
}


x86 assembly (clang, -O0):
<unlink_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <unlink@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1145 <unlink_file+0x35>
xor    %eax,%eax
mov    0x2ea5(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    114c <unlink_file+0x3c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unlink_file>:
push   %rax
call   1030 <unlink@plt>
mov    0x2ec3(%rip),%rcx
xor    %edx,%edx
sub    (%rcx),%edx
test   %eax,%eax
cmovne %edx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@errno = global i32 0
define i32 @unlink_file(i8* nocapture %0) {
%2 = tail call i32 @unlink(i8* %0)
%3 = icmp eq i32 %2, 0
%4 = load i32, i32* @errno
%5 = sub nsw i32 0, %4
%6 = select i1 %3, i32 0, i32 %5
ret i32 %6
}
char *langRomTypeKonamiWordPro() { return "Konami Word Pro"; }


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"Konami Word Pro\00"
define i8* @langRomTypeKonamiWordPro() {
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [16 x i8] c"Konami Word Pro\00"
define i8* @langRomTypeKonamiWordPro() {
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0)
}
int reachNumber(int target) {
  int ret = 0, curr = 0;
  if (target < 0) {
    target = -target;
  }
  while (curr < target || (curr - target) % 2 != 0) {
    ++ret;
    curr += ret;
  }
  return ret;
}


x86 assembly (clang, -O0):
<reachNumber>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1127 <reachNumber+0x27>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    112c <reachNumber+0x2c>
mov    -0xc(%rbp),%ecx
mov    $0x1,%al
cmp    -0x4(%rbp),%ecx
mov    %al,-0xd(%rbp)
jl     1154 <reachNumber+0x54>
mov    -0xc(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1164 <reachNumber+0x64>
jmp    117b <reachNumber+0x7b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    112c <reachNumber+0x2c>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reachNumber>:
mov    %edi,%ecx
neg    %ecx
cmovs  %edi,%ecx
xor    %eax,%eax
xor    %edx,%edx
jmp    1118 <reachNumber+0x18>
nopl   (%rax)
add    %eax,%edx
add    $0x1,%edx
add    $0x1,%eax
mov    %edx,%esi
sub    %ecx,%esi
jb     1110 <reachNumber+0x10>
test   $0x1,%sil
jne    1110 <reachNumber+0x10>
ret

LLVM IR (-O0):
define i32 @reachNumber(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = sub nsw i32 0, %8
store i32 %9, i32* %2
br label %10
10: ; preds = %7, %1
br label %11
11: ; preds = %23, %10
%12 = load i32, i32* %4
%13 = load i32, i32* %2
%14 = icmp slt i32 %12, %13
br i1 %14, label %21, label %15
15: ; preds = %11
%16 = load i32, i32* %4
%17 = load i32, i32* %2
%18 = sub nsw i32 %16, %17
%19 = srem i32 %18, 2
%20 = icmp ne i32 %19, 0
br label %21
21: ; preds = %15, %11
%22 = phi i1 [ true, %11 ], [ %20, %15 ]
br i1 %22, label %23, label %29
23: ; preds = %21
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = add nsw i32 %27, %26
store i32 %28, i32* %4
br label %11
29: ; preds = %21
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
define i32 @reachNumber(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
br label %3
3: ; preds = %11, %1
%4 = phi i32 [ 0, %1 ], [ %12, %11 ]
%5 = phi i32 [ 0, %1 ], [ %13, %11 ]
%6 = icmp ult i32 %5, %2
br i1 %6, label %11, label %7
7: ; preds = %3
%8 = sub nsw i32 %5, %2
%9 = and i32 %8, 1
%10 = icmp eq i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %3, %7
%12 = add nuw nsw i32 %4, 1
%13 = add nuw nsw i32 %5, %12
br label %3
14: ; preds = %7
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void configureMultiProtocolPatch(void) {
  uint8_t *pPatchTab = (uint8_t *)(0x21000000 + 0x03D4);
  pPatchTab[76] = 0;
  pPatchTab[62] = 1;
  pPatchTab[64] = 2;
  pPatchTab[91] = 3;
  pPatchTab[79] = 4;
}


x86 assembly (clang, -O0):
<configureMultiProtocolPatch>:
push   %rbp
mov    %rsp,%rbp
mov    $0x210003d4,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,0x130(%rax)
mov    -0x8(%rbp),%rax
movl   $0x1,0xf8(%rax)
mov    -0x8(%rbp),%rax
movl   $0x2,0x100(%rax)
mov    -0x8(%rbp),%rax
movl   $0x3,0x16c(%rax)
mov    -0x8(%rbp),%rax
movl   $0x4,0x13c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<configureMultiProtocolPatch>:
movl   $0x0,0x21000504
movl   $0x1,0x210004cc
movl   $0x2,0x210004d4
movl   $0x3,0x21000540
movl   $0x4,0x21000510
ret

LLVM IR (-O0):
define void @configureMultiProtocolPatch() {
%1 = alloca i32*
store i32* inttoptr (i64 553649108 to i32*), i32** %1
%2 = load i32*, i32** %1
%3 = getelementptr inbounds i32, i32* %2, i64 76
store i32 0, i32* %3
%4 = load i32*, i32** %1
%5 = getelementptr inbounds i32, i32* %4, i64 62
store i32 1, i32* %5
%6 = load i32*, i32** %1
%7 = getelementptr inbounds i32, i32* %6, i64 64
store i32 2, i32* %7
%8 = load i32*, i32** %1
%9 = getelementptr inbounds i32, i32* %8, i64 91
store i32 3, i32* %9
%10 = load i32*, i32** %1
%11 = getelementptr inbounds i32, i32* %10, i64 79
store i32 4, i32* %11
ret void
}

LLVM IR (-O2):
define void @configureMultiProtocolPatch() {
store i32 0, i32* inttoptr (i64 553649412 to i32*)
store i32 1, i32* inttoptr (i64 553649356 to i32*)
store i32 2, i32* inttoptr (i64 553649364 to i32*)
store i32 3, i32* inttoptr (i64 553649472 to i32*)
store i32 4, i32* inttoptr (i64 553649424 to i32*)
ret void
}
/* Variables and functions */
int judgeCircle(char *);
char *whenUL_ShouldReturnFalse() {
  int result = judgeCircle("UL");
  do {
    if (!(1 != result))
      return "When moves are UP-LEFT, the result should be 0";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<whenUL_ShouldReturnFalse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <judgeCircle@plt>
mov    %eax,-0xc(%rbp)
mov    $0x1,%eax
cmp    -0xc(%rbp),%eax
jne    1145 <whenUL_ShouldReturnFalse+0x35>
lea    0xec7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1152 <whenUL_ShouldReturnFalse+0x42>
jmp    114a <whenUL_ShouldReturnFalse+0x3a>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<whenUL_ShouldReturnFalse>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <judgeCircle@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
lea    0xeda(%rip),%rax
cmove  %rax,%rcx
mov    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"UL\00"
@.str.1 = [47 x i8] c"When moves are UP-LEFT, the result should be 0\00"
define i8* @whenUL_ShouldReturnFalse() {
%1 = alloca i8*
%2 = alloca i32
%3 = call i32 @judgeCircle(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %3, i32* %2
br label %4
4: ; preds = %0
%5 = load i32, i32* %2
%6 = icmp ne i32 1, %5
br i1 %6, label %8, label %7
7: ; preds = %4
store i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %10
8: ; preds = %4
br label %9
9: ; preds = %8
store i8* null, i8** %1
br label %10
10: ; preds = %9, %7
%11 = load i8*, i8** %1
ret i8* %11
}

LLVM IR (-O2):
@.str = [3 x i8] c"UL\00"
@.str.1 = [47 x i8] c"When moves are UP-LEFT, the result should be 0\00"
define i8* @whenUL_ShouldReturnFalse() {
%1 = tail call i32 @judgeCircle(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 1
%3 = select i1 %2, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i8* null
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ test_qml_comment_entities();
int /*<<< orphan*/ test_qml_comments();
void all_qml_tests() {
  test_qml_comments();
  test_qml_comment_entities();
}


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

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

LLVM IR (-O0):
define void @all_qml_tests() {
%1 = call i32 (...) @test_qml_comments()
%2 = call i32 (...) @test_qml_comment_entities()
ret void
}

LLVM IR (-O2):
define void @all_qml_tests() {
%1 = tail call i32 (...) @test_qml_comments()
%2 = tail call i32 (...) @test_qml_comment_entities()
ret void
}
int getI32(unsigned char *buf) {
  return (buf[0] + (buf[1] << 8) + (buf[2] << 16) + (buf[3] << 24));
}


x86 assembly (clang, -O0):
<getI32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
shl    $0x18,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getI32>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @getI32(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = shl i32 %10, 8
%12 = add nsw i32 %6, %11
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 2
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = shl i32 %16, 16
%18 = add nsw i32 %12, %17
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i64 3
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = shl i32 %22, 24
%24 = add nsw i32 %18, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @getI32(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl nuw nsw i32 %6, 8
%8 = or i32 %7, %3
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl nuw nsw i32 %11, 16
%13 = or i32 %8, %12
%14 = getelementptr inbounds i8, i8* %0, i64 3
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = shl nuw i32 %16, 24
%18 = or i32 %13, %17
ret i32 %18
}
int main() {
  int i;
  i = 0;
  if (i) {
    i = 12;
  } else {
    if (!(i == 10)) {
      i = 0;
    }
  }
  return i;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1128 <main+0x28>
movl   $0xc,-0x8(%rbp)
jmp    113e <main+0x3e>
cmpl   $0xa,-0x8(%rbp)
je     1139 <main+0x39>
movl   $0x0,-0x8(%rbp)
jmp    113e <main+0x3e>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ancestrymap2lfmm(char *, char *, int *, int *);
int /*<<< orphan*/ print_convert(int, int);
void R_ancestrymap2lfmm(char **R_input_file, char **R_output_file, int *N,
                        int *M) {
  ancestrymap2lfmm(*R_input_file, *R_output_file, N, M);
  print_convert(*N, *M);
}


x86 assembly (clang, -O0):
<R_ancestrymap2lfmm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <ancestrymap2lfmm@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
call   1040 <print_convert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<R_ancestrymap2lfmm>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
mov    (%rdi),%rdi
mov    (%rsi),%rsi
call   1030 <ancestrymap2lfmm@plt>
mov    (%rbx),%edi
mov    (%r14),%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <print_convert@plt>

LLVM IR (-O0):
define void @R_ancestrymap2lfmm(i8** %0, i8** %1, i32* %2, i32* %3) {
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i32*
%8 = alloca i32*
store i8** %0, i8*** %5
store i8** %1, i8*** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i8**, i8*** %5
%10 = load i8*, i8** %9
%11 = load i8**, i8*** %6
%12 = load i8*, i8** %11
%13 = load i32*, i32** %7
%14 = load i32*, i32** %8
%15 = call i32 @ancestrymap2lfmm(i8* %10, i8* %12, i32* %13, i32* %14)
%16 = load i32*, i32** %7
%17 = load i32, i32* %16
%18 = load i32*, i32** %8
%19 = load i32, i32* %18
%20 = call i32 @print_convert(i32 %17, i32 %19)
ret void
}

LLVM IR (-O2):
define void @R_ancestrymap2lfmm(i8** nocapture %0, i8** nocapture %1, i32* %2, i32* %3) {
%5 = load i8*, i8** %0
%6 = load i8*, i8** %1
%7 = tail call i32 @ancestrymap2lfmm(i8* %5, i8* %6, i32* %2, i32* %3)
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = tail call i32 @print_convert(i32 %8, i32 %9)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gpio_set_value(int, int /*<<< orphan*/);
void module_led_off(void) { gpio_set_value(5, 0); }


x86 assembly (clang, -O0):
<module_led_off>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
xor    %esi,%esi
call   1030 <gpio_set_value@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<module_led_off>:
mov    $0x5,%edi
xor    %esi,%esi
jmp    1030 <gpio_set_value@plt>

LLVM IR (-O0):
define void @module_led_off() {
%1 = call i32 @gpio_set_value(i32 5, i32 0)
ret void
}

LLVM IR (-O2):
define void @module_led_off() {
%1 = tail call i32 @gpio_set_value(i32 5, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *, char *);
void printHelp(char *argv[]) {
  printf("Invalid number of parameter specified.\n Usage:\n  %s -g \n %s -e "
         "<hexa_key> <plaintext_file> <output_file>\n %s -d <hexa_key> "
         "<encrypted_file> <decrypted_file> \n",
         argv[0], argv[0], argv[0]);
}


x86 assembly (clang, -O0):
<printHelp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printHelp>:
mov    (%rdi),%rcx
lea    0xee6(%rip),%rdi
mov    %rcx,%rsi
mov    %rcx,%rdx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [159 x i8] c"Invalid number of parameter specified.\0A Usage:\0A %s -g \0A %s -e <hexa_key> <plaintext_file> <output_file>\0A %s -d <hexa_key> <encrypted_file> <decrypted_file> \0A\00"
define void @printHelp(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 0
%5 = load i8*, i8** %4
%6 = load i8**, i8*** %2
%7 = getelementptr inbounds i8*, i8** %6, i64 0
%8 = load i8*, i8** %7
%9 = load i8**, i8*** %2
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @printf(i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %8, i8* %11)
ret void
}

LLVM IR (-O2):
@.str = [159 x i8] c"Invalid number of parameter specified.\0A Usage:\0A %s -g \0A %s -e <hexa_key> <plaintext_file> <output_file>\0A %s -d <hexa_key> <encrypted_file> <decrypted_file> \0A\00"
define void @printHelp(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %2, i8* %2)
ret void
}
/* Variables and functions */
int A_BOLD;
int COLOR_RED;
int rand();
int get_colour(void) {
  int attr;
  attr = (rand() % 16) + 1;
  if (attr == 1 || attr == 9)
    attr = COLOR_RED;
  if (attr > 8)
    attr |= A_BOLD;
  return (attr);
}


x86 assembly (clang, -O0):
<get_colour>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x10,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
je     1141 <get_colour+0x31>
cmpl   $0x9,-0x4(%rbp)
jne    114d <get_colour+0x3d>
mov    0x2e90(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x8,-0x4(%rbp)
jle    1166 <get_colour+0x56>
mov    0x2e82(%rip),%rax
mov    (%rax),%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_colour>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
lea    0xf(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff0,%ecx
mov    %eax,%edx
sub    %ecx,%edx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
cmp    $0x9,%eax
mov    0x2e9e(%rip),%rcx
mov    (%rcx),%ecx
cmove  %ecx,%eax
test   %edx,%edx
cmove  %ecx,%eax
cmp    $0x9,%eax
jl     1152 <get_colour+0x42>
mov    0x2e90(%rip),%rcx
mov    (%rcx),%ebx
or     %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@COLOR_RED = global i32 0
@A_BOLD = global i32 0
define i32 @get_colour() {
%1 = alloca i32
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 16
%4 = add nsw i32 %3, 1
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 1
br i1 %6, label %10, label %7
7: ; preds = %0
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 9
br i1 %9, label %10, label %12
10: ; preds = %7, %0
%11 = load i32, i32* @COLOR_RED
store i32 %11, i32* %1
br label %12
12: ; preds = %10, %7
%13 = load i32, i32* %1
%14 = icmp sgt i32 %13, 8
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i32, i32* @A_BOLD
%17 = load i32, i32* %1
%18 = or i32 %17, %16
store i32 %18, i32* %1
br label %19
19: ; preds = %15, %12
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@COLOR_RED = global i32 0
@A_BOLD = global i32 0
define i32 @get_colour() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 16
%3 = add nsw i32 %2, 1
%4 = icmp eq i32 %2, 0
%5 = icmp eq i32 %3, 9
%6 = select i1 %4, i1 true, i1 %5
%7 = load i32, i32* @COLOR_RED
%8 = select i1 %6, i32 %7, i32 %3
%9 = icmp sgt i32 %8, 8
%10 = load i32, i32* @A_BOLD
%11 = select i1 %9, i32 %10, i32 0
%12 = or i32 %11, %8
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ wcscoll(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
void uninitvar_wcscoll(void) {
  wchar_t *cs;
  wchar_t *ct;
  (void)wcscoll(cs, ct);
}


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

x86 assembly (clang, -O2):
<uninitvar_wcscoll>:
jmp    1030 <wcscoll@plt>

LLVM IR (-O0):
define void @uninitvar_wcscoll() {
%1 = alloca i32*
%2 = alloca i32*
%3 = load i32*, i32** %1
%4 = load i32*, i32** %2
%5 = call i32 @wcscoll(i32* %3, i32* %4)
ret void
}

LLVM IR (-O2):
define void @uninitvar_wcscoll() {
%1 = tail call i32 @wcscoll(i32* undef, i32* undef)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void _close_fd(int fd) { close(fd); }


x86 assembly (clang, -O0):
<_close_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_close_fd>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @_close_fd(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
double vec_mag_sq(double x, double y) { return x * x + y * y; }


x86 assembly (clang, -O0):
<vec_mag_sq>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec_mag_sq>:
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @vec_mag_sq(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %3
%7 = load double, double* %4
%8 = load double, double* %4
%9 = fmul double %7, %8
%10 = call double @llvm.fmuladd.f64(double %5, double %6, double %9)
ret double %10
}

LLVM IR (-O2):
define double @vec_mag_sq(double %0, double %1) {
%3 = fmul double %1, %1
%4 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %3)
ret double %4
}
/* Variables and functions */
char *smp_str_trimLF(char *);
char *smp_str_trimCRLF(char *str) { return smp_str_trimLF(str); }


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

x86 assembly (clang, -O2):
<smp_str_trimCRLF>:
jmp    1030 <smp_str_trimLF@plt>

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

LLVM IR (-O2):
define i8* @smp_str_trimCRLF(i8* %0) {
%2 = tail call i8* @smp_str_trimLF(i8* %0)
ret i8* %2
}
int tlm_iodev_is_ram(int iodev) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @tlm_iodev_is_ram(i32 %0) {
ret i32 0
}
int saturate(double f) {
  int i;
  i = (int)f;
  if (i < 0)
    i = 0;
  if (i > 255)
    i = 255;
  return i;
}


x86 assembly (clang, -O0):
<saturate>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1122 <saturate+0x22>
movl   $0x0,-0xc(%rbp)
cmpl   $0xff,-0xc(%rbp)
jle    1136 <saturate+0x36>
movl   $0xff,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<saturate>:
cvttsd2si %xmm0,%eax
xor    %ecx,%ecx
test   %eax,%eax
cmovns %eax,%ecx
cmp    $0xff,%ecx
mov    $0xff,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @saturate(double %0) {
%2 = alloca double
%3 = alloca i32
store double %0, double* %2
%4 = load double, double* %2
%5 = fptosi double %4 to i32
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %3
br label %9
9: ; preds = %8, %1
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 255
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 255, i32* %3
br label %13
13: ; preds = %12, %9
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @saturate(double %0) {
%2 = fptosi double %0 to i32
%3 = icmp sgt i32 %2, 0
%4 = select i1 %3, i32 %2, i32 0
%5 = icmp ult i32 %4, 255
%6 = select i1 %5, i32 %4, i32 255
ret i32 %6
}
int cvmx_wqe_get_qos(struct cvmx_wqe *work) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.cvmx_wqe = type opaque
define i32 @cvmx_wqe_get_qos(%struct.cvmx_wqe* nocapture readnone %0) {
ret i32 0
}
int ishexdigit(char ch) {
  return (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') ||
         (ch >= 'A' && ch <= 'Z');
}


x86 assembly (clang, -O0):
<ishexdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     1129 <ishexdigit+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x39,%ecx
mov    %al,-0x2(%rbp)
jle    116d <ishexdigit+0x6d>
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1148 <ishexdigit+0x48>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x7a,%ecx
mov    %al,-0x2(%rbp)
jle    116d <ishexdigit+0x6d>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x41,%ecx
mov    %al,-0x3(%rbp)
jl     1167 <ishexdigit+0x67>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ishexdigit>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
setb   %al
and    $0xdf,%dil
add    $0xbf,%dil
cmp    $0x1a,%dil
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @ishexdigit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = and i8 %0, -33
%5 = add i8 %4, -65
%6 = icmp ult i8 %5, 26
%7 = or i1 %3, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
struct rcps_request {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct rcps_request *);
void rcps_request_free(struct rcps_request *r) { free(r); }


x86 assembly (clang, -O0):
<rcps_request_free>:
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):
<rcps_request_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.rcps_request = type { i32 }
define void @rcps_request_free(%struct.rcps_request* %0) {
%2 = alloca %struct.rcps_request*
store %struct.rcps_request* %0, %struct.rcps_request** %2
%3 = load %struct.rcps_request*, %struct.rcps_request** %2
%4 = call i32 @free(%struct.rcps_request* %3)
ret void
}

LLVM IR (-O2):
%struct.rcps_request = type { i32 }
define void @rcps_request_free(%struct.rcps_request* nocapture %0) {
%2 = tail call i32 @free(%struct.rcps_request* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int writeData(int, char *);
int writeMsg(int fd, char *head, char *value) {
  char buffer[512];
  memset(buffer, 0, 512);
  sprintf(buffer, "%s %s", head, value);
  return writeData(fd, buffer);
}


x86 assembly (clang, -O0):
<writeMsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x220(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1030 <memset@plt>
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe91(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x220(%rbp),%rsi
call   1050 <writeData@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeMsg>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%r15d
mov    %rsp,%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1030 <memset@plt>
lea    0xea1(%rip),%rsi
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1040 <sprintf@plt>
mov    %r15d,%edi
mov    %rbp,%rsi
call   1050 <writeData@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s %s\00"
define i32 @writeMsg(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [512 x i8]
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%9 = call i32 @memset(i8* %8, i32 0, i32 512)
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%11 = load i8*, i8** %5
%12 = load i8*, i8** %6
%13 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %12)
%14 = load i32, i32* %4
%15 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%16 = call i32 @writeData(i32 %14, i8* %15)
ret i32 %16
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s %s\00"
define i32 @writeMsg(i32 %0, i8* %1, i8* %2) {
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 512)
%7 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
%8 = call i32 @writeData(i32 %0, i8* %5)
ret i32 %8
}
int load_chkpt_file(void) {}


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

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

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

LLVM IR (-O2):
define i32 @load_chkpt_file() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ chewing_utf8_byte2len(char);
int chewing_utf8_strlen(char *str) {
  int length = 0;
  char *strptr = str;
  while (strptr[0] != '\0') {
    strptr += chewing_utf8_byte2len(strptr[0]);
    ++length;
  }
  return length;
}


x86 assembly (clang, -O0):
<chewing_utf8_strlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1165 <chewing_utf8_strlen+0x55>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <chewing_utf8_byte2len@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112b <chewing_utf8_strlen+0x1b>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chewing_utf8_strlen>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     113c <chewing_utf8_strlen+0x2c>
mov    %rdi,%r14
xor    %ebx,%ebx
nop
movsbl %al,%edi
call   1030 <chewing_utf8_byte2len@plt>
movslq %eax,%rcx
movzbl (%r14,%rcx,1),%eax
add    %rcx,%r14
add    $0x1,%ebx
test   %al,%al
jne    1120 <chewing_utf8_strlen+0x10>
jmp    113e <chewing_utf8_strlen+0x2e>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @chewing_utf8_strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %10, %4 ], [ %0, %1 ]
%7 = phi i32 [ %11, %4 ], [ 0, %1 ]
%8 = tail call i32 @chewing_utf8_byte2len(i8 signext %5)
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %6, i64 %9
%11 = add nuw nsw i32 %7, 1
%12 = load i8, i8* %10
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 0, %1 ], [ %11, %4 ]
ret i32 %15
}
/* Variables and functions */
int LOG_DAEMON;
int LOG_INFO;
int SIGHUP;
int /*<<< orphan*/ syslog(int, char *);
void signal_hangup(int signal) {
  if (signal == SIGHUP) {
    syslog(LOG_DAEMON | LOG_INFO, "Received SIGHUP.");
  } else {
    syslog(LOG_DAEMON | LOG_INFO, "Received SIGXFILES.");
  }
  return;
}


x86 assembly (clang, -O0):
<signal_hangup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ecb(%rip),%rcx
cmp    (%rcx),%eax
jne    1150 <signal_hangup+0x40>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
mov    0x2e93(%rip),%rax
or     (%rax),%edi
lea    0xeba(%rip),%rsi
call   1030 <syslog@plt>
jmp    116e <signal_hangup+0x5e>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
mov    0x2e70(%rip),%rax
or     (%rax),%edi
lea    0xea8(%rip),%rsi
call   1030 <syslog@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signal_hangup>:
mov    0x2ed9(%rip),%rcx
mov    0x2ec2(%rip),%rdx
mov    0x2eab(%rip),%rax
mov    (%rax),%eax
or     (%rdx),%eax
cmp    %edi,(%rcx)
lea    0xece(%rip),%rcx
lea    0xed8(%rip),%rsi
cmove  %rcx,%rsi
mov    %eax,%edi
jmp    1030 <syslog@plt>

LLVM IR (-O0):
@SIGHUP = global i32 0
@LOG_DAEMON = global i32 0
@LOG_INFO = global i32 0
@.str = [17 x i8] c"Received SIGHUP.\00"
@.str.1 = [20 x i8] c"Received SIGXFILES.\00"
define void @signal_hangup(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGHUP
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i32, i32* @LOG_DAEMON
%8 = load i32, i32* @LOG_INFO
%9 = or i32 %7, %8
%10 = call i32 @syslog(i32 %9, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %16
11: ; preds = %1
%12 = load i32, i32* @LOG_DAEMON
%13 = load i32, i32* @LOG_INFO
%14 = or i32 %12, %13
%15 = call i32 @syslog(i32 %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %11, %6
ret void
}

LLVM IR (-O2):
@SIGHUP = global i32 0
@LOG_DAEMON = global i32 0
@LOG_INFO = global i32 0
@.str = [17 x i8] c"Received SIGHUP.\00"
@.str.1 = [20 x i8] c"Received SIGXFILES.\00"
define void @signal_hangup(i32 %0) {
%2 = load i32, i32* @SIGHUP
%3 = icmp eq i32 %2, %0
%4 = load i32, i32* @LOG_DAEMON
%5 = load i32, i32* @LOG_INFO
%6 = or i32 %5, %4
%7 = select i1 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0)
%8 = tail call i32 @syslog(i32 %6, i8* %7)
ret void
}
/* Type definitions */
struct timespec {
  int tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ nanosleep(struct timespec *, int /*<<< orphan*/);
void utilSleep(int ms) {
  struct timespec sleepTime;
  sleepTime.tv_sec = 0;
  sleepTime.tv_nsec = ms * 1000000;
  nanosleep(&sleepTime, 0);
}


x86 assembly (clang, -O0):
<utilSleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
imul   $0xf4240,-0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1030 <nanosleep@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utilSleep>:
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
imul   $0xf4240,%edi,%eax
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <nanosleep@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
define void @utilSleep(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timespec
store i32 %0, i32* %2
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
store i64 0, i64* %4
%5 = load i32, i32* %2
%6 = mul nsw i32 %5, 1000000
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
store i32 %6, i32* %7
%8 = call i32 @nanosleep(%struct.timespec* %3, i32 0)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
define void @utilSleep(i32 %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
store i64 0, i64* %4
%5 = mul nsw i32 %0, 1000000
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i32 %5, i32* %6
%7 = call i32 @nanosleep(%struct.timespec* %2, i32 0)
ret void
}
void canon_sNaN(unsigned a[1]) {
  if ((a[0] & 0x7F800000) != 0x7F800000)
    return;
  if (!(a[0] & 0x7FFFFF))
    return;
  a[0] &= 0x7FC00000;
  a[0] |= 0x00000001;
}


x86 assembly (clang, -O0):
<canon_sNaN>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0x7f800000,%eax
cmp    $0x7f800000,%eax
je     1123 <canon_sNaN+0x23>
jmp    1155 <canon_sNaN+0x55>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0x7fffff,%eax
cmp    $0x0,%eax
jne    113c <canon_sNaN+0x3c>
jmp    1155 <canon_sNaN+0x55>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
and    $0x7fc00000,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<canon_sNaN>:
mov    (%rdi),%eax
mov    %eax,%ecx
not    %ecx
test   $0x7f800000,%ecx
jne    1122 <canon_sNaN+0x22>
mov    %eax,%ecx
and    $0x7fffff,%ecx
je     1122 <canon_sNaN+0x22>
and    $0x7fc00000,%eax
or     $0x1,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @canon_sNaN(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 = and i32 %5, 2139095040
%7 = icmp ne i32 %6, 2139095040
br i1 %7, label %8, label %9
8: ; preds = %1
br label %25
9: ; preds = %1
%10 = load i32*, i32** %2
%11 = getelementptr inbounds i32, i32* %10, i64 0
%12 = load i32, i32* %11
%13 = and i32 %12, 8388607
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %9
br label %25
16: ; preds = %9
%17 = load i32*, i32** %2
%18 = getelementptr inbounds i32, i32* %17, i64 0
%19 = load i32, i32* %18
%20 = and i32 %19, 2143289344
store i32 %20, i32* %18
%21 = load i32*, i32** %2
%22 = getelementptr inbounds i32, i32* %21, i64 0
%23 = load i32, i32* %22
%24 = or i32 %23, 1
store i32 %24, i32* %22
br label %25
25: ; preds = %16, %15, %8
ret void
}

LLVM IR (-O2):
define void @canon_sNaN(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 2139095040
%4 = icmp ne i32 %3, 2139095040
%5 = and i32 %2, 8388607
%6 = icmp eq i32 %5, 0
%7 = or i1 %4, %6
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = and i32 %2, 2143289344
%10 = or i32 %9, 1
store i32 %10, i32* %0
br label %11
11: ; preds = %1, %8
ret void
}
int leftIntX(int currentX, int currentDir) {
  if (currentDir == 0)
    return currentX - 1;
  else if (currentDir == 2)
    return currentX + 1;
  else
    return currentX;
}


x86 assembly (clang, -O0):
<leftIntX>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1122 <leftIntX+0x22>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1140 <leftIntX+0x40>
cmpl   $0x2,-0xc(%rbp)
jne    113a <leftIntX+0x3a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1140 <leftIntX+0x40>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<leftIntX>:
mov    %edi,%eax
cmp    $0x2,%esi
je     110f <leftIntX+0xf>
test   %esi,%esi
jne    1112 <leftIntX+0x12>
add    $0xffffffff,%eax
ret
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @leftIntX(i32 %0, i32 %1) {
switch i32 %1, label %7 [
i32 0, label %3
i32 2, label %5
]
3: ; preds = %2
%4 = add nsw i32 %0, -1
br label %7
5: ; preds = %2
%6 = add nsw i32 %0, 1
br label %7
7: ; preds = %2, %5, %3
%8 = phi i32 [ %4, %3 ], [ %6, %5 ], [ %0, %2 ]
ret i32 %8
}
/* Variables and functions */
int EOF;
int _stdout_hook_default(int c) {
  (void)(c);
  return EOF;
}


x86 assembly (clang, -O0):
<_stdout_hook_default>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2eda(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_stdout_hook_default>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @_stdout_hook_default(i32 %0) {
%2 = load i32, i32* @EOF
ret i32 %2
}
int ncgrk(long long a, long long b) { return (a & ~b) ? 23 : 42; }


x86 assembly (clang, -O0):
<ncgrk>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rax
xor    $0xffffffffffffffff,%rax
and    %rax,%rdx
mov    $0x2a,%eax
mov    $0x17,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ncgrk>:
not    %rsi
test   %rdi,%rsi
mov    $0x2a,%ecx
mov    $0x17,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @ncgrk(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = xor i64 %6, -1
%8 = and i64 %5, %7
%9 = icmp ne i64 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 23, i32 42
ret i32 %11
}

LLVM IR (-O2):
define i32 @ncgrk(i64 %0, i64 %1) {
%3 = xor i64 %1, -1
%4 = and i64 %3, %0
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i32 42, i32 23
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ i2cslave_EnableNAK(int);
void i2c1slave_EnableNAK(void) { i2cslave_EnableNAK(1); }


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

x86 assembly (clang, -O2):
<i2c1slave_EnableNAK>:
mov    $0x1,%edi
jmp    1030 <i2cslave_EnableNAK@plt>

LLVM IR (-O0):
define void @i2c1slave_EnableNAK() {
%1 = call i32 @i2cslave_EnableNAK(i32 1)
ret void
}

LLVM IR (-O2):
define void @i2c1slave_EnableNAK() {
%1 = tail call i32 @i2cslave_EnableNAK(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sys_write(char *, int);
int outchar(char c, char *ptr, int off) {
  if (ptr == (char *)-1)
    sys_write(&c, 1);
  else if (ptr > (char *)255)
    ptr[off] = c;
  return off + 1;
}


x86 assembly (clang, -O0):
<outchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    %rax,-0x10(%rbp)
jne    1149 <outchar+0x39>
lea    -0x1(%rbp),%rdi
mov    $0x1,%esi
call   1030 <sys_write@plt>
jmp    116b <outchar+0x5b>
mov    $0xff,%eax
cmp    %rax,-0x10(%rbp)
jbe    1166 <outchar+0x56>
mov    -0x1(%rbp),%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    116b <outchar+0x5b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outchar>:
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ebx
mov    %dil,0xf(%rsp)
cmp    $0xffffffffffffffff,%rsi
je     1134 <outchar+0x24>
cmp    $0x100,%rsi
jb     1143 <outchar+0x33>
movslq %ebx,%rax
mov    %dil,(%rsi,%rax,1)
jmp    1143 <outchar+0x33>
lea    0xf(%rsp),%rdi
mov    $0x1,%esi
call   1030 <sys_write@plt>
add    $0x1,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @outchar(i8 signext %0, i8* %1, i32 %2) {
%4 = alloca i8
%5 = alloca i8*
%6 = alloca i32
store i8 %0, i8* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %5
%8 = icmp eq i8* %7, inttoptr (i64 -1 to i8*)
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 @sys_write(i8* %4, i32 1)
br label %21
11: ; preds = %3
%12 = load i8*, i8** %5
%13 = icmp ugt i8* %12, inttoptr (i64 255 to i8*)
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i8, i8* %4
%16 = load i8*, i8** %5
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
store i8 %15, i8* %19
br label %20
20: ; preds = %14, %11
br label %21
21: ; preds = %20, %9
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
ret i32 %23
}

LLVM IR (-O2):
define i32 @outchar(i8 signext %0, i8* writeonly %1, i32 %2) {
%4 = alloca i8
store i8 %0, i8* %4
%5 = icmp eq i8* %1, inttoptr (i64 -1 to i8*)
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = call i32 @sys_write(i8* %4, i32 1)
br label %13
8: ; preds = %3
%9 = icmp ugt i8* %1, inttoptr (i64 255 to i8*)
br i1 %9, label %10, label %13
10: ; preds = %8
%11 = sext i32 %2 to i64
%12 = getelementptr inbounds i8, i8* %1, i64 %11
store i8 %0, i8* %12
br label %13
13: ; preds = %8, %10, %6
%14 = add nsw i32 %2, 1
ret i32 %14
}