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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *stdout;
int main() {
  FILE *fp;
  fp = fopen("fputs.txt", "w");
  fputs("hello\n", fp);
  fputs("fputs success\n", stdout);
  fclose(fp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec4(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb2(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2e7a(%rip),%rax
mov    (%rax),%rsi
lea    0xea3(%rip),%rdi
call   1040 <fputs@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xecb(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
lea    0xebe(%rip),%rdi
mov    $0x6,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1050 <fwrite@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%rcx
lea    0xea2(%rip),%rdi
mov    $0xe,%esi
mov    $0x1,%edx
call   1050 <fwrite@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"fputs.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [7 x i8] c"hello\0A\00"
@.str.3 = [15 x i8] c"fputs success\0A\00"
@stdout = global i32* null
define i32 @main() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%5 = load i32*, i32** @stdout
%6 = call i32 @fputs(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%7 = load i32*, i32** %1
%8 = call i32 @fclose(i32* %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"fputs.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [7 x i8] c"hello\0A\00"
@.str.3 = [15 x i8] c"fputs success\0A\00"
@stdout = global i32* null
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i64 6, i64 1, i32* %1)
%3 = load i32*, i32** @stdout
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i64 14, i64 1, i32* %3)
%5 = tail call i32 @fclose(i32* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bar(unsigned int);
void foo(void) {
  char buf[1] = {3};
  const char *p = buf;
  const char **q = &p;
  unsigned int ch;
  switch (**q) {
  case 1:
    ch = 5;
    break;
  case 2:
    ch = 4;
    break;
  case 3:
    ch = 3;
    break;
  case 4:
    ch = 2;
    break;
  case 5:
    ch = 1;
    break;
  default:
    ch = 0;
    break;
  }
  bar(ch);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movb   $0x3,-0x1(%rbp)
lea    -0x1(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x4,%eax
ja     1198 <foo+0x88>
mov    -0x28(%rbp),%rax
lea    0xead(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x5,-0x1c(%rbp)
jmp    119f <foo+0x8f>
movl   $0x4,-0x1c(%rbp)
jmp    119f <foo+0x8f>
movl   $0x3,-0x1c(%rbp)
jmp    119f <foo+0x8f>
movl   $0x2,-0x1c(%rbp)
jmp    119f <foo+0x8f>
movl   $0x1,-0x1c(%rbp)
jmp    119f <foo+0x8f>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1030 <bar@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    $0x3,%edi
jmp    1030 <bar@plt>

LLVM IR (-O0):
@__const.foo.buf = [1 x i8] c"\03"
define void @foo() {
%1 = alloca [1 x i8]
%2 = alloca i8*
%3 = alloca i8**
%4 = alloca i32
%5 = bitcast [1 x i8]* %1 to i8*
%6 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 0
store i8* %6, i8** %2
store i8** %2, i8*** %3
%7 = load i8**, i8*** %3
%8 = load i8*, i8** %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
switch i32 %10, label %16 [
i32 1, label %11
i32 2, label %12
i32 3, label %13
i32 4, label %14
i32 5, label %15
]
11: ; preds = %0
store i32 5, i32* %4
br label %17
12: ; preds = %0
store i32 4, i32* %4
br label %17
13: ; preds = %0
store i32 3, i32* %4
br label %17
14: ; preds = %0
store i32 2, i32* %4
br label %17
15: ; preds = %0
store i32 1, i32* %4
br label %17
16: ; preds = %0
store i32 0, i32* %4
br label %17
17: ; preds = %16, %15, %14, %13, %12, %11
%18 = load i32, i32* %4
%19 = call i32 @bar(i32 %18)
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 @bar(i32 3)
ret void
}
vdabgl(button, x, y) int *button;
float *x, *y;
{ vdbufl(); }


x86 assembly (clang, -O0):
<vdabgl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    $0x0,%al
call   1030 <vdbufl@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @vdabgl(i32* nocapture readnone %0, float* nocapture readnone %1, float* nocapture readnone %2) {
%4 = tail call i32 (...) @vdbufl()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void sigalrm(int sig) {
  ({
    fprintf(stderr,
            "%s: "
            "timeout communicating"
            "\n",
            "runcl");
    if (1 <= 1)
      exit(1);
  });
  exit(1);
}


x86 assembly (clang, -O0):
<sigalrm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
lea    0xed9(%rip),%rdx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<sigalrm>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
lea    0xee3(%rip),%rdx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"%s: timeout communicating\0A\00"
@.str.1 = [6 x i8] c"runcl\00"
define void @sigalrm(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
size_t CTREE_MaxSize(void) { return (-1); }


x86 assembly (clang, -O0):
<CTREE_MaxSize>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffffffffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CTREE_MaxSize>:
mov    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
define i64 @CTREE_MaxSize() {
ret i64 -1
}

LLVM IR (-O2):
define i64 @CTREE_MaxSize() {
ret i64 -1
}
/* Variables and functions */
int /*<<< orphan*/ COLS;
int /*<<< orphan*/ addch(char);
int /*<<< orphan*/ getyx(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ stdscr;
void display_pad(void) {
  int y, x;
  getyx(stdscr, y, x);
  while (x++ < COLS)
    addch(' ');
}


x86 assembly (clang, -O0):
<display_pad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1030 <getyx@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
mov    0x2e92(%rip),%rcx
cmp    (%rcx),%eax
jge    1165 <display_pad+0x45>
mov    $0x20,%edi
call   1040 <addch@plt>
jmp    113c <display_pad+0x1c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_pad>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <getyx@plt>

LLVM IR (-O0):
@stdscr = global i32 0
@COLS = global i32 0
define void @display_pad() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @stdscr
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = call i32 @getyx(i32 %3, i32 %4, i32 %5)
br label %7
7: ; preds = %12, %0
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 1
store i32 %9, i32* %2
%10 = load i32, i32* @COLS
%11 = icmp slt i32 %8, %10
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = call i32 @addch(i8 signext 32)
br label %7
14: ; preds = %7
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
@COLS = global i32 0
define void @display_pad() {
%1 = load i32, i32* @stdscr
%2 = tail call i32 @getyx(i32 %1, i32 undef, i32 undef)
ret void
}
/* Variables and functions */
scalar_t__ is_matching(char, char *);
scalar_t__ isalpha(char);
scalar_t__ isdigit(char);
int match_xml_c(char c) {
  return (isalpha(c) || isdigit(c) || is_matching(c, "_-."));
}


x86 assembly (clang, -O0):
<match_xml_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1050 <isalpha@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    118e <match_xml_c+0x5e>
movsbl -0x1(%rbp),%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    118e <match_xml_c+0x5e>
lea    0xe85(%rip),%rsi
movsbl -0x1(%rbp),%edi
call   1040 <is_matching@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_xml_c>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1050 <isalpha@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    116a <match_xml_c+0x3a>
movsbl %bpl,%ebp
mov    %ebp,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    116a <match_xml_c+0x3a>
lea    0xea5(%rip),%rsi
mov    %ebp,%edi
call   1040 <is_matching@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"_-.\00"
define i32 @match_xml_c(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @isalpha(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = call i64 @isdigit(i8 signext %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = call i64 @is_matching(i8 signext %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%13 = icmp ne i64 %12, 0
br label %14
14: ; preds = %10, %6, %1
%15 = phi i1 [ true, %6 ], [ true, %1 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
@.str = [4 x i8] c"_-.\00"
define i32 @match_xml_c(i8 signext %0) {
%2 = tail call i64 @isalpha(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = tail call i64 @isdigit(i8 signext %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = tail call i64 @is_matching(i8 signext %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i64 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %7, %4, %1
%12 = phi i32 [ 1, %4 ], [ 1, %1 ], [ %10, %7 ]
ret i32 %12
}
void ExttUserAuxTable(void) {}


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

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

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

LLVM IR (-O2):
define void @ExttUserAuxTable() {
ret void
}
int search_preferable_fullscreen_mode() { return 0; }


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

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

LLVM IR (-O0):
define i32 @search_preferable_fullscreen_mode() {
ret i32 0
}

LLVM IR (-O2):
define i32 @search_preferable_fullscreen_mode() {
ret i32 0
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int64_t signum_fun_int64_t(int64_t a) { return (a != 0) | (a >> 63); }


x86 assembly (clang, -O0):
<signum_fun_int64_t>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x4(%rbp),%edx
mov    $0x3f,%ecx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @signum_fun_int64_t(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
%6 = load i32, i32* %2
%7 = ashr i32 %6, 63
%8 = or i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @signum_fun_int64_t(i32 %0) {
ret i32 poison
}
z(q) { return atoi(q); }


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

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

LLVM IR (-O0):
define i32 @z(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i32, ...) bitcast (i32 (...)* @atoi to i32 (i32, ...)*)(i32 %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @z(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @atoi to i32 (i32, ...)*)(i32 %0)
ret i32 %2
}
/* Variables and functions */
double sqrt(double);
double norm(const double x[]) {
  return sqrt((double)x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
}


x86 assembly (clang, -O0):
<norm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<norm>:
movsd  (%rdi),%xmm1
movsd  0x8(%rdi),%xmm0
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1141 <norm+0x31>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @norm(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
%5 = load double, double* %4
%6 = load double*, double** %2
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = load double*, double** %2
%10 = getelementptr inbounds double, double* %9, i64 1
%11 = load double, double* %10
%12 = load double*, double** %2
%13 = getelementptr inbounds double, double* %12, i64 1
%14 = load double, double* %13
%15 = fmul double %11, %14
%16 = call double @llvm.fmuladd.f64(double %5, double %8, double %15)
%17 = load double*, double** %2
%18 = getelementptr inbounds double, double* %17, i64 2
%19 = load double, double* %18
%20 = load double*, double** %2
%21 = getelementptr inbounds double, double* %20, i64 2
%22 = load double, double* %21
%23 = call double @llvm.fmuladd.f64(double %19, double %22, double %16)
%24 = call double @sqrt(double %23)
ret double %24
}

LLVM IR (-O2):
define double @norm(double* nocapture %0) {
%2 = load double, double* %0
%3 = getelementptr inbounds double, double* %0, i64 1
%4 = load double, double* %3
%5 = fmul double %4, %4
%6 = tail call double @llvm.fmuladd.f64(double %2, double %2, double %5)
%7 = getelementptr inbounds double, double* %0, i64 2
%8 = load double, double* %7
%9 = tail call double @llvm.fmuladd.f64(double %8, double %8, double %6)
%10 = tail call double @sqrt(double %9)
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ checkLetter(char, int *);
char getchar();
int /*<<< orphan*/ printf(char *, int);
int main() {
  char ch;
  int counter = 0;
  while (ch = getchar()) {
    if (ch != '\n') {
      checkLetter(ch, &counter);
    } else {
      break;
    }
  }
  printf("%d", counter);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
cmp    $0x0,%al
je     1181 <main+0x51>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     1177 <main+0x47>
lea    -0xc(%rbp),%rsi
movsbl -0x5(%rbp),%edi
call   1050 <checkLetter@plt>
jmp    117c <main+0x4c>
jmp    1181 <main+0x51>
jmp    1146 <main+0x16>
mov    -0xc(%rbp),%esi
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
test   %al,%al
je     116c <main+0x3c>
cmp    $0xa,%al
je     116c <main+0x3c>
movsbl %al,%edi
mov    %rbx,%rsi
call   1050 <checkLetter@plt>
jmp    1150 <main+0x20>
mov    0xc(%rsp),%esi
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %15, %0
%5 = call signext i8 (...) @getchar()
store i8 %5, i8* %2
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 10
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i8, i8* %2
%13 = call i32 @checkLetter(i8 signext %12, i32* %3)
br label %15
14: ; preds = %7
br label %16
15: ; preds = %11
br label %4
16: ; preds = %14, %4
%17 = load i32, i32* %3
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %5, %0
%4 = call signext i8 (...) @getchar()
switch i8 %4, label %5 [
i8 10, label %7
i8 0, label %7
]
5: ; preds = %3
%6 = call i32 @checkLetter(i8 signext %4, i32* %1)
br label %3
7: ; preds = %3, %3
%8 = load i32, i32* %1
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}
int c2dec_init(struct c2dec_context_s *ctx) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.c2dec_context_s = type opaque
define i32 @c2dec_init(%struct.c2dec_context_s* nocapture readnone %0) {
ret i32 0
}
void xmodes(mode) int mode;
{
  printf("\t%c%c%c%c%c", (mode & 0x10) ? 'd' : '-', (mode & 02) ? 'h' : '-',
         (mode & 04) ? 's' : '-', (mode & 01) ? '-' : 'w',
         (mode & 0x20) ? 'a' : '-');
}


x86 assembly (clang, -O0):
<xmodes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
and    $0x10,%ecx
mov    $0x2d,%esi
mov    $0x64,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
mov    -0x4(%rbp),%ecx
and    $0x2,%ecx
mov    $0x2d,%edx
mov    $0x68,%eax
cmp    $0x0,%ecx
cmovne %eax,%edx
mov    -0x4(%rbp),%edi
and    $0x4,%edi
mov    $0x2d,%ecx
mov    $0x73,%eax
cmp    $0x0,%edi
cmovne %eax,%ecx
mov    -0x4(%rbp),%edi
and    $0x1,%edi
mov    $0x77,%r8d
mov    $0x2d,%eax
cmp    $0x0,%edi
cmovne %eax,%r8d
mov    -0x4(%rbp),%edi
and    $0x20,%edi
mov    $0x2d,%r9d
mov    $0x61,%eax
cmp    $0x0,%edi
cmovne %eax,%r9d
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmodes>:
test   $0x10,%dil
mov    $0x2d,%eax
mov    $0x64,%esi
cmove  %eax,%esi
test   $0x2,%dil
mov    $0x68,%edx
cmove  %eax,%edx
test   $0x4,%dil
mov    $0x73,%ecx
cmove  %eax,%ecx
test   $0x1,%dil
mov    $0x77,%r8d
cmovne %eax,%r8d
test   $0x20,%dil
mov    $0x61,%r9d
cmove  %eax,%r9d
lea    0xea4(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"\09%c%c%c%c%c\00"
define void @xmodes(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 16
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 100, i32 45
%8 = load i32, i32* %2
%9 = and i32 %8, 2
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i64
%12 = select i1 %10, i32 104, i32 45
%13 = load i32, i32* %2
%14 = and i32 %13, 4
%15 = icmp ne i32 %14, 0
%16 = zext i1 %15 to i64
%17 = select i1 %15, i32 115, i32 45
%18 = load i32, i32* %2
%19 = and i32 %18, 1
%20 = icmp ne i32 %19, 0
%21 = zext i1 %20 to i64
%22 = select i1 %20, i32 45, i32 119
%23 = load i32, i32* %2
%24 = and i32 %23, 32
%25 = icmp ne i32 %24, 0
%26 = zext i1 %25 to i64
%27 = select i1 %25, i32 97, i32 45
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %12, i32 %17, i32 %22, i32 %27)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"\09%c%c%c%c%c\00"
define void @xmodes(i32 %0) {
%2 = and i32 %0, 16
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 45, i32 100
%5 = and i32 %0, 2
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i32 45, i32 104
%8 = and i32 %0, 4
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 45, i32 115
%11 = and i32 %0, 1
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i32 119, i32 45
%14 = and i32 %0, 32
%15 = icmp eq i32 %14, 0
%16 = select i1 %15, i32 45, i32 97
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %7, i32 %10, i32 %13, i32 %16)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sqlite_int64;
typedef int /*<<< orphan*/ sqlite3_file;

/* Variables and functions */
int SQLITE_READONLY;
int memWrite(sqlite3_file *pFile, const void *z, int iAmt, sqlite_int64 iOfst) {
  return SQLITE_READONLY;
}


x86 assembly (clang, -O0):
<memWrite>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    0x2ecf(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
@SQLITE_READONLY = global i32 0
define i32 @memWrite(i32* nocapture readnone %0, i8* nocapture readnone %1, i32 %2, i32 %3) {
%5 = load i32, i32* @SQLITE_READONLY
ret i32 %5
}
int fn1() { return 0; }


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

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

LLVM IR (-O0):
define i32 @fn1() {
ret i32 0
}

LLVM IR (-O2):
define i32 @fn1() {
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint32_t;

/* Variables and functions */
uint32_t ror(uint32_t x, const uint8_t n) { return (x >> n) | (x << (32 - n)); }


x86 assembly (clang, -O0):
<ror>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sub    -0x8(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ror>:
mov    %esi,%ecx
mov    %edi,%eax
sar    %cl,%eax
neg    %cl
shl    %cl,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @ror(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 = ashr i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub nsw i32 32, %9
%11 = shl i32 %8, %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @ror(i32 %0, i32 %1) {
%3 = ashr i32 %0, %1
%4 = sub nsw i32 32, %1
%5 = shl i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
scalar_t__ S_ISDIR(int /*<<< orphan*/);
scalar_t__ stat(char *, struct stat *);
int exist_file(char *path) {
  struct stat st;
  if (stat(path, &st) != 0) {
    return 0;
  }
  mode_t m = st.st_mode;
  if (S_ISDIR(m)) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<exist_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
je     114f <exist_file+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    117a <exist_file+0x5a>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1030 <S_ISDIR@plt>
cmp    $0x0,%rax
je     1173 <exist_file+0x53>
movl   $0x0,-0x4(%rbp)
jmp    117a <exist_file+0x5a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exist_file>:
push   %rax
mov    %rsp,%rsi
call   1040 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1135 <exist_file+0x15>
pop    %rcx
ret
mov    (%rsp),%edi
call   1030 <S_ISDIR@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @exist_file(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i64 @stat(i8* %6, %struct.stat* %4)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %18
10: ; preds = %1
%11 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%12 = load i32, i32* %11
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = call i64 @S_ISDIR(i32 %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %10
store i32 0, i32* %2
br label %18
17: ; preds = %10
store i32 1, i32* %2
br label %18
18: ; preds = %17, %16, %9
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @exist_file(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = call i64 @S_ISDIR(i32 %8)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %1, %6
%13 = phi i32 [ %11, %6 ], [ 0, %1 ]
ret i32 %13
}
int test_imm_CAint64_highword_reg(long long val) {
  return ((val >> 32) & (0xCA << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_CAint64_highword_reg>:
movabs $0xca00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_CAint64_highword_reg(i64 %0) {
%2 = and i64 %0, 867583393792
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int haspercent(char *s) {
  for (; *s; ++s)
    if (*s == '%')
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<haspercent>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1147 <haspercent+0x47>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
jne    1131 <haspercent+0x31>
movl   $0x1,-0x4(%rbp)
jmp    114e <haspercent+0x4e>
jmp    1136 <haspercent+0x36>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1108 <haspercent+0x8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<haspercent>:
movzbl (%rdi),%eax
test   %al,%al
je     1111 <haspercent+0x11>
cmp    $0x25,%al
je     1114 <haspercent+0x14>
add    $0x1,%rdi
jmp    1100 <haspercent>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @haspercent(i8* nocapture %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %8
i8 37, label %7
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
br label %8
8: ; preds = %2, %7
%9 = phi i32 [ 1, %7 ], [ 0, %2 ]
ret i32 %9
}
/* Variables and functions */
int unmarshal_opaque(unsigned char *data, unsigned char **in, size_t *size) {
  if (*size < 1)
    return -1;
  *data = *(*in);
  (*size) -= 1;
  (*in) += 1;
  return 0;
}


x86 assembly (clang, -O0):
<unmarshal_opaque>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpq   $0x1,(%rax)
jae    112a <unmarshal_opaque+0x2a>
movl   $0xffffffff,-0x4(%rbp)
jmp    115c <unmarshal_opaque+0x5c>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rcx
sub    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<unmarshal_opaque>:
cmpq   $0x0,(%rdx)
je     1118 <unmarshal_opaque+0x18>
mov    (%rsi),%rax
mov    (%rax),%al
mov    %al,(%rdi)
addq   $0xffffffffffffffff,(%rdx)
addq   $0x1,(%rsi)
xor    %eax,%eax
ret
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @unmarshal_opaque(i8* nocapture writeonly %0, i8** nocapture %1, i64* nocapture %2) {
%4 = load i64, i64* %2
%5 = icmp eq i64 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = load i8*, i8** %1
%8 = load i8, i8* %7
store i8 %8, i8* %0
%9 = load i64, i64* %2
%10 = add i64 %9, -1
store i64 %10, i64* %2
%11 = load i8*, i8** %1
%12 = getelementptr inbounds i8, i8* %11, i64 1
store i8* %12, i8** %1
br label %13
13: ; preds = %3, %6
%14 = phi i32 [ 0, %6 ], [ -1, %3 ]
ret i32 %14
}
void isr_bus_fault(void) {
  while (1) {
    asm("nop");
  }
}


x86 assembly (clang, -O0):
<isr_bus_fault>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <isr_bus_fault+0x9>
nop
jmp    1109 <isr_bus_fault+0x9>

x86 assembly (clang, -O2):
<isr_bus_fault>:
nop
jmp    1100 <isr_bus_fault>

LLVM IR (-O0):
define void @isr_bus_fault() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @isr_bus_fault() {
br label %1
1: ; preds = %0, %1
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
br label %1
}
void find_interface_ids(char *interface_name, int *vendor, int *device,
                        int *sub_vend, int *sub_dev) {
  *vendor = 0;
  *device = 0;
  *sub_vend = 0;
  *sub_dev = 0;
  return;
}


x86 assembly (clang, -O0):
<find_interface_ids>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_interface_ids>:
movl   $0x0,(%rsi)
movl   $0x0,(%rdx)
movl   $0x0,(%rcx)
movl   $0x0,(%r8)
ret

LLVM IR (-O0):
define void @find_interface_ids(i8* %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
store i8* %0, i8** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
%11 = load i32*, i32** %7
store i32 0, i32* %11
%12 = load i32*, i32** %8
store i32 0, i32* %12
%13 = load i32*, i32** %9
store i32 0, i32* %13
%14 = load i32*, i32** %10
store i32 0, i32* %14
ret void
}

LLVM IR (-O2):
define void @find_interface_ids(i8* nocapture readnone %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4) {
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
ret void
}
/* Type definitions */
struct Value {
  int dummy;
};
struct ParseState {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sync();
void UnistdSync(struct ParseState *Parser, struct Value *ReturnValue,
                struct Value **Param, int NumArgs) {
  sync();
}


x86 assembly (clang, -O0):
<UnistdSync>:
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    $0x0,%al
call   1030 <sync@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.ParseState = type { i32 }
%struct.Value = type { i32 }
define void @UnistdSync(%struct.ParseState* %0, %struct.Value* %1, %struct.Value** %2, i32 %3) {
%5 = alloca %struct.ParseState*
%6 = alloca %struct.Value*
%7 = alloca %struct.Value**
%8 = alloca i32
store %struct.ParseState* %0, %struct.ParseState** %5
store %struct.Value* %1, %struct.Value** %6
store %struct.Value** %2, %struct.Value*** %7
store i32 %3, i32* %8
%9 = call i32 (...) @sync()
ret void
}

LLVM IR (-O2):
%struct.ParseState = type { i32 }
%struct.Value = type { i32 }
define void @UnistdSync(%struct.ParseState* nocapture readnone %0, %struct.Value* nocapture readnone %1, %struct.Value** nocapture readnone %2, i32 %3) {
%5 = tail call i32 (...) @sync()
ret void
}
long int getRelativeSecondsOfDayofweek(int ia, int ib) {
  if (ia > ib)
    return (((long int)(7 - (ib - ia))) * (((60L) * 60L) * 24L));
  return (((long int)((ib - ia))) * (((60L) * 60L) * 24L));
}


x86 assembly (clang, -O0):
<getRelativeSecondsOfDayofweek>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1135 <getRelativeSecondsOfDayofweek+0x35>
mov    -0x10(%rbp),%ecx
sub    -0xc(%rbp),%ecx
mov    $0x7,%eax
sub    %ecx,%eax
cltq
imul   $0x15180,%rax,%rax
mov    %rax,-0x8(%rbp)
jmp    1148 <getRelativeSecondsOfDayofweek+0x48>
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
cltq
imul   $0x15180,%rax,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRelativeSecondsOfDayofweek>:
mov    %esi,%eax
sub    %edi,%eax
mov    $0x7,%ecx
sub    %eax,%ecx
sub    %edi,%esi
cmovl  %ecx,%esi
movslq %esi,%rax
imul   $0x15180,%rax,%rax
ret

LLVM IR (-O0):
define i64 @getRelativeSecondsOfDayofweek(i32 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %16
9: ; preds = %2
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = sub nsw i32 %10, %11
%13 = sub nsw i32 7, %12
%14 = sext i32 %13 to i64
%15 = mul nsw i64 %14, 86400
store i64 %15, i64* %3
br label %22
16: ; preds = %2
%17 = load i32, i32* %5
%18 = load i32, i32* %4
%19 = sub nsw i32 %17, %18
%20 = sext i32 %19 to i64
%21 = mul nsw i64 %20, 86400
store i64 %21, i64* %3
br label %22
22: ; preds = %16, %9
%23 = load i64, i64* %3
ret i64 %23
}

LLVM IR (-O2):
define i64 @getRelativeSecondsOfDayofweek(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, %0
%4 = add i32 %0, 7
%5 = sub i32 %4, %1
%6 = sub nsw i32 %1, %0
%7 = select i1 %3, i32 %5, i32 %6
%8 = sext i32 %7 to i64
%9 = mul nsw i64 %8, 86400
ret i64 %9
}
void defaultR(double *src) {
  src[0] = .3;
  src[1] = -.5;
  src[2] = -.1;
}


x86 assembly (clang, -O0):
<defaultR>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xefc(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0xee4(%rip),%xmm0
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0xecb(%rip),%xmm0
movsd  %xmm0,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<defaultR>:
movaps 0xef9(%rip),%xmm0
movups %xmm0,(%rdi)
movabs $0xbfb999999999999a,%rax
99 b9 bf
mov    %rax,0x10(%rdi)
ret

LLVM IR (-O0):
define void @defaultR(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
store double 3.000000e-01, double* %4
%5 = load double*, double** %2
%6 = getelementptr inbounds double, double* %5, i64 1
store double -5.000000e-01, double* %6
%7 = load double*, double** %2
%8 = getelementptr inbounds double, double* %7, i64 2
store double -1.000000e-01, double* %8
ret void
}

LLVM IR (-O2):
define void @defaultR(double* nocapture writeonly %0) {
%2 = bitcast double* %0 to <2 x double>*
store <2 x double> <double 3.000000e-01, double -5.000000e-01>, <2 x double>* %2
%3 = getelementptr inbounds double, double* %0, i64 2
store double -1.000000e-01, double* %3
ret void
}
int test02(int a, int b) { return (a > b) ? 0x7FFFFFFF : 0x80000000; }


x86 assembly (clang, -O0):
<test02>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%esi
mov    $0x80000000,%eax
mov    $0x7fffffff,%ecx
cmp    %esi,%edx
cmovg  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test02>:
xor    %ecx,%ecx
cmp    %esi,%edi
setg   %cl
mov    $0x80000000,%eax
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test02(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 = icmp sgt i32 %5, %6
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 2147483647, i32 -2147483648
ret i32 %9
}

LLVM IR (-O2):
define i32 @test02(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 2147483647, i32 -2147483648
ret i32 %4
}
long foo(int x, int y) { return (long)x * 6L; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movslq -0x4(%rbp),%rax
imul   $0x6,%rax,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movslq %edi,%rax
add    %rax,%rax
lea    (%rax,%rax,2),%rax
ret

LLVM IR (-O0):
define i64 @foo(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 = sext i32 %5 to i64
%7 = mul nsw i64 %6, 6
ret i64 %7
}

LLVM IR (-O2):
define i64 @foo(i32 %0, i32 %1) {
%3 = sext i32 %0 to i64
%4 = mul nsw i64 %3, 6
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ printf(char *, unsigned int);
unsigned int strlen(char *);
void prepAttackString(char *s, void *ptr) {
  unsigned len = strlen(s);
  printf("Attack string at 0x%08x:", (unsigned int)s);
  memcpy(&(s[len - 4]), (char *)(&ptr), 4);
  return;
}


x86 assembly (clang, -O0):
<prepAttackString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%esi
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%eax
sub    $0x4,%eax
mov    %eax,%eax
add    %rax,%rdi
lea    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1050 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prepAttackString>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %rsi,(%rsp)
call   1030 <strlen@plt>
mov    %eax,%ebx
lea    0xeb7(%rip),%rdi
mov    %r14d,%esi
call   1040 <printf@plt>
add    $0xfffffffc,%ebx
add    %r14,%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1050 <memcpy@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Attack string at 0x%08x:\00"
define void @prepAttackString(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %5
%8 = load i8*, i8** %3
%9 = ptrtoint i8* %8 to i32
%10 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i8*, i8** %3
%12 = load i32, i32* %5
%13 = sub i32 %12, 4
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %11, i64 %14
%16 = bitcast i8** %4 to i8*
%17 = call i32 @memcpy(i8* %15, i8* %16, i32 4)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Attack string at 0x%08x:\00"
define void @prepAttackString(i8* %0, i8* %1) {
%3 = alloca i8*
store i8* %1, i8** %3
%4 = tail call i32 @strlen(i8* %0)
%5 = ptrtoint i8* %0 to i64
%6 = trunc i64 %5 to i32
%7 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = add i32 %4, -4
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = bitcast i8** %3 to i8*
%12 = call i32 @memcpy(i8* %10, i8* %11, i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void clear(void) { printf("\e[H\e[2J"); }


x86 assembly (clang, -O0):
<clear>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear>:
lea    0xee9(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"\1B[H\1B[2J\00"
define void @clear() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"\1B[H\1B[2J\00"
define void @clear() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
void foo49() {}


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

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

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

LLVM IR (-O2):
define void @foo49() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ link_error1();
void test5(int x, int y) {
  if ((x >= y) || (x < y)) {
  } else
    link_error1();
}


x86 assembly (clang, -O0):
<test5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1136 <test5+0x26>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    113b <test5+0x2b>
jmp    1142 <test5+0x32>
mov    $0x0,%al
call   1030 <link_error1@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test5(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 = icmp sge i32 %5, %6
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %8, %2
br label %15
13: ; preds = %8
%14 = call i32 (...) @link_error1()
br label %15
15: ; preds = %13, %12
ret void
}

LLVM IR (-O2):
define void @test5(i32 %0, i32 %1) {
ret void
}
long getrval2(tcp)
struct tcb *tcp;
{
  long val = -1;
  return val;
}


x86 assembly (clang, -O0):
<getrval2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0xffffffffffffffff,-0x10(%rbp)
ff
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getrval2>:
mov    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
%struct.tcb = type opaque
define i64 @getrval2(%struct.tcb* %0) {
%2 = alloca %struct.tcb*
%3 = alloca i64
store %struct.tcb* %0, %struct.tcb** %2
store i64 -1, i64* %3
%4 = load i64, i64* %3
ret i64 %4
}

LLVM IR (-O2):
%struct.tcb = type opaque
define i64 @getrval2(%struct.tcb* nocapture readnone %0) {
ret i64 -1
}
/* Variables and functions */
int /*<<< orphan*/ binrpc_write_int(unsigned char *, unsigned char *, int,
                                    int *);
int binrpc_hdr_change_len(unsigned char *hdr, int hdr_len, int new_len) {
  int len_len;
  binrpc_write_int(&hdr[2], hdr + hdr_len, new_len, &len_len);
  return 0;
}


x86 assembly (clang, -O0):
<binrpc_hdr_change_len>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x2,%rdi
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
mov    -0x10(%rbp),%edx
lea    -0x14(%rbp),%rcx
call   1030 <binrpc_write_int@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<binrpc_hdr_change_len>:
push   %rax
lea    0x2(%rdi),%rax
movslq %esi,%rsi
add    %rdi,%rsi
lea    0x4(%rsp),%rcx
mov    %rax,%rdi
call   1030 <binrpc_write_int@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @binrpc_hdr_change_len(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 2
%10 = load i8*, i8** %4
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = load i32, i32* %6
%15 = call i32 @binrpc_write_int(i8* %9, i8* %13, i32 %14, i32* %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @binrpc_hdr_change_len(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = getelementptr inbounds i8, i8* %0, i64 2
%7 = sext i32 %1 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = call i32 @binrpc_write_int(i8* %6, i8* %8, i32 %2, i32* %4)
ret i32 0
}