xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_visual_attribs_short_header(void) {
  printf("    visual  x   bf lv rg d st  colorbuffer  sr ax dp st accumbuffer  "
         "ms  cav\n");
  printf("  id dep cl sp  sz l  ci b ro  r  g  b  a F gb bf th cl  r  g  b  a "
         "ns b eat\n");
  printf("---------------------------------------------------------------------"
         "-------\n");
}


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

x86 assembly (clang, -O2):
<print_visual_attribs_short_header>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf29(%rip),%rdi
call   1030 <puts@plt>
lea    0xf6a(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [78 x i8] c" visual x bf lv rg d st colorbuffer sr ax dp st accumbuffer ms cav\0A\00"
@.str.1 = [78 x i8] c" id dep cl sp sz l ci b ro r g b a F gb bf th cl r g b a ns b eat\0A\00"
@.str.2 = [78 x i8] c"----------------------------------------------------------------------------\0A\00"
define void @print_visual_attribs_short_header() {
%1 = call i32 @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [77 x i8] c" visual x bf lv rg d st colorbuffer sr ax dp st accumbuffer ms cav\00"
@str.3 = [77 x i8] c" id dep cl sp sz l ci b ro r g b a F gb bf th cl r g b a ns b eat\00"
@str.4 = [77 x i8] c"----------------------------------------------------------------------------\00"
define void @print_visual_attribs_short_header() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.4, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ lseek(int, long, int /*<<< orphan*/);
off_t tell(int fd) { return lseek(fd, 0L, 0); }


x86 assembly (clang, -O0):
<tell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1030 <lseek@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tell>:
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <lseek@plt>

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

LLVM IR (-O2):
define i32 @tell(i32 %0) {
%2 = tail call i32 @lseek(i32 %0, i64 0, i32 0)
ret i32 %2
}
int numCompare(const void *a, const void *b) {
  return (*((unsigned *)a) - *((unsigned *)b));
}


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

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

LLVM IR (-O0):
define i32 @numCompare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @numCompare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub i32 %4, %6
ret i32 %7
}
int is_oneof(char c, char *chars) {
  while (*chars) {
    if (c == *chars)
      return 1;
    chars++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_oneof>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114b <is_oneof+0x4b>
movsbl -0x5(%rbp),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    113a <is_oneof+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    1152 <is_oneof+0x52>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110e <is_oneof+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_oneof>:
mov    (%rsi),%cl
xor    %eax,%eax
test   %cl,%cl
je     1120 <is_oneof+0x20>
add    $0x1,%rsi
nopl   0x0(%rax)
cmp    %dil,%cl
je     1121 <is_oneof+0x21>
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <is_oneof+0x10>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @is_oneof(i8 signext %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %8
5: ; preds = %8
%6 = load i8, i8* %12
%7 = icmp eq i8 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %2, %5
%9 = phi i8 [ %6, %5 ], [ %3, %2 ]
%10 = phi i8* [ %12, %5 ], [ %1, %2 ]
%11 = icmp eq i8 %9, %0
%12 = getelementptr inbounds i8, i8* %10, i64 1
br i1 %11, label %13, label %5
13: ; preds = %8, %5, %2
%14 = phi i32 [ 0, %2 ], [ 0, %5 ], [ 1, %8 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void print_sep(void) {
  puts("-------------------------------------------------------------------"
       "------------");
}


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

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

LLVM IR (-O0):
@.str = [80 x i8] c"-------------------------------------------------------------------------------\00"
define void @print_sep() {
%1 = call i32 @puts(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [80 x i8] c"-------------------------------------------------------------------------------\00"
define void @print_sep() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0))
ret void
}
int _cargo_nargs_is_valid(int nargs) {
  return (nargs >= 0) || (nargs == -2) || (nargs == -1) || (nargs == -3);
}


x86 assembly (clang, -O0):
<_cargo_nargs_is_valid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jge    113e <_cargo_nargs_is_valid+0x3e>
mov    $0x1,%al
cmpl   $0xfffffffe,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     113e <_cargo_nargs_is_valid+0x3e>
mov    $0x1,%al
cmpl   $0xffffffff,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     113e <_cargo_nargs_is_valid+0x3e>
cmpl   $0xfffffffd,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cargo_nargs_is_valid>:
xor    %eax,%eax
cmp    $0xfffffffd,%edi
setge  %al
ret

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

LLVM IR (-O2):
define i32 @_cargo_nargs_is_valid(i32 %0) {
%2 = icmp sgt i32 %0, -4
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int _stricmp(char const *, char const *);
int jet_strcasecmp(const char *s1, const char *s2) { return _stricmp(s1, s2); }


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

x86 assembly (clang, -O2):
<jet_strcasecmp>:
jmp    1030 <_stricmp@plt>

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

LLVM IR (-O2):
define i32 @jet_strcasecmp(i8* %0, i8* %1) {
%3 = tail call i32 @_stricmp(i8* %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ HalCC2430RadioP__InterruptRFErr__fired();
void HplCC2430InterruptsC__InterruptRFErr__fired(void) {
  HalCC2430RadioP__InterruptRFErr__fired();
}


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

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

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

LLVM IR (-O2):
define void @HplCC2430InterruptsC__InterruptRFErr__fired() {
%1 = tail call i32 (...) @HalCC2430RadioP__InterruptRFErr__fired()
ret void
}
long long int llabs(j)
long long int j;
{ return (0); }


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

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

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

LLVM IR (-O2):
define i64 @llabs(i64 %0) {
ret i64 0
}
int main(argc, argv)
int argc;
char *argv[];
{
  set_signals();
  getargs(argc, argv);
  open_files();
  reader();
  lr0();
  lalr();
  make_parser();
  verbose();
  output();
  done(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   10c0 <set_signals@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   10b0 <getargs@plt>
mov    $0x0,%al
call   1070 <open_files@plt>
mov    $0x0,%al
call   1060 <reader@plt>
mov    $0x0,%al
call   1030 <lr0@plt>
mov    $0x0,%al
call   1090 <lalr@plt>
mov    $0x0,%al
call   1080 <make_parser@plt>
mov    $0x0,%al
call   10a0 <verbose@plt>
mov    $0x0,%al
call   1040 <output@plt>
xor    %edi,%edi
mov    $0x0,%al
call   1050 <done@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   10c0 <set_signals@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   10b0 <getargs@plt>
xor    %eax,%eax
call   1070 <open_files@plt>
xor    %eax,%eax
call   1060 <reader@plt>
xor    %eax,%eax
call   1030 <lr0@plt>
xor    %eax,%eax
call   1090 <lalr@plt>
xor    %eax,%eax
call   1080 <make_parser@plt>
xor    %eax,%eax
call   10a0 <verbose@plt>
xor    %eax,%eax
call   1040 <output@plt>
xor    %edi,%edi
xor    %eax,%eax
call   1050 <done@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @set_signals()
%6 = load i32, i32* %3
%7 = load i8**, i8*** %4
%8 = call i32 (i32, i8**, ...) bitcast (i32 (...)* @getargs to i32 (i32, i8**, ...)*)(i32 %6, i8** %7)
%9 = call i32 (...) @open_files()
%10 = call i32 (...) @reader()
%11 = call i32 (...) @lr0()
%12 = call i32 (...) @lalr()
%13 = call i32 (...) @make_parser()
%14 = call i32 (...) @verbose()
%15 = call i32 (...) @output()
%16 = call i32 (i32, ...) bitcast (i32 (...)* @done to i32 (i32, ...)*)(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (...) @set_signals()
%4 = tail call i32 (i32, i8**, ...) bitcast (i32 (...)* @getargs to i32 (i32, i8**, ...)*)(i32 %0, i8** %1)
%5 = tail call i32 (...) @open_files()
%6 = tail call i32 (...) @reader()
%7 = tail call i32 (...) @lr0()
%8 = tail call i32 (...) @lalr()
%9 = tail call i32 (...) @make_parser()
%10 = tail call i32 (...) @verbose()
%11 = tail call i32 (...) @output()
%12 = tail call i32 (i32, ...) bitcast (i32 (...)* @done to i32 (i32, ...)*)(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ U_WMRNOTIMPLEMENTED_swap(char *, int);
void U_WMR80_swap(char *record, int torev) {
  U_WMRNOTIMPLEMENTED_swap(record, torev);
}


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

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

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

LLVM IR (-O2):
define void @U_WMR80_swap(i8* %0, i32 %1) {
%3 = tail call i32 @U_WMRNOTIMPLEMENTED_swap(i8* %0, i32 %1)
ret void
}
ISR(ANALOG_COMP_vect) {
  DEBUG("ISR "
        "ANALOG_COMP"
        " occured");
}


x86 assembly (clang, -O0):
<ISR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <DEBUG@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ISR>:
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <DEBUG@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"ISR ANALOG_COMP occured\00"
define i32 @ISR(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @DEBUG to i32 (i8*, ...)*)(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
ret i32 %5
}

LLVM IR (-O2):
@.str = [24 x i8] c"ISR ANALOG_COMP occured\00"
define i32 @ISR(i32 %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @DEBUG to i32 (i8*, ...)*)(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int solve_by_standard_Laurent_homotopy_continuation(int number_of_tasks) {
  int *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(774, &number_of_tasks, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<solve_by_standard_Laurent_homotopy_continuation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x306,%edi
lea    -0x4(%rbp),%rsi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve_by_standard_Laurent_homotopy_continuation>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x306,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @solve_by_standard_Laurent_homotopy_continuation(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca double*
store i32 %0, i32* %2
%6 = load i32*, i32** %3
%7 = load double*, double** %5
%8 = call i32 @_ada_use_c2phc4c(i32 774, i32* %2, i32* %6, double* %7, i32 0)
store i32 %8, i32* %4
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
define i32 @solve_by_standard_Laurent_homotopy_continuation(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @_ada_use_c2phc4c(i32 774, i32* %2, i32* undef, double* undef, i32 0)
ret i32 %3
}
void mdp4_dsi_cmd_del_timer(void) {}


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

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

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

LLVM IR (-O2):
define void @mdp4_dsi_cmd_del_timer() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char *userName = "Mark";
  printf("Your name is: %s", userName);
  getchar();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedd(%rip),%rdi
lea    0xed1(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"Mark\00"
@.str.1 = [17 x i8] c"Your name is: %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"Mark\00"
@.str.1 = [17 x i8] c"Your name is: %s\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
ret i32 0
}
/* Variables and functions */
int fib_bu(int);
int fib_td(int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  printf("Fibonacci de 10: ");
  int resultado = fib_bu(10);
  printf("%d\n", resultado);
  resultado = fib_td(10);
  printf("%d\n", resultado);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1050 <fib_bu@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <fib_td@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1050 <fib_bu@plt>
lea    0xec2(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <fib_td@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Fibonacci de 10: \00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @fib_bu(i32 10)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = call i32 @fib_td(i32 10)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Fibonacci de 10: \00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @fib_bu(i32 10)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%4 = tail call i32 @fib_td(i32 10)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}
int myfun(void) {}


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

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

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

LLVM IR (-O2):
define i32 @myfun() {
ret i32 undef
}
long set_background(string)
char *string[];
{
  char color;
  short nchar;
  nchar = sscanf(*string, "%1s", &color);
  switch (nchar) {
  case 1:
    break;
  default:
    color = ' ';
    break;
  }
  if (!char_setback(&color))
    return (0);
  return (1);
}


x86 assembly (clang, -O0):
<set_background>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xec6(%rip),%rsi
xor    %eax,%eax
lea    -0x11(%rbp),%rdx
call   1040 <sscanf@plt>
mov    %ax,-0x14(%rbp)
mov    -0x14(%rbp),%ax
sub    $0x1,%ax
jne    1161 <set_background+0x41>
jmp    115c <set_background+0x3c>
jmp    1165 <set_background+0x45>
movb   $0x20,-0x11(%rbp)
lea    -0x11(%rbp),%rdi
mov    $0x0,%al
call   1030 <char_setback@plt>
cmp    $0x0,%eax
jne    1186 <set_background+0x66>
movq   $0x0,-0x8(%rbp)
jmp    118e <set_background+0x6e>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_background>:
push   %rax
mov    (%rdi),%rdi
lea    0xed5(%rip),%rsi
lea    0x7(%rsp),%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
cmp    $0x1,%ax
je     1142 <set_background+0x22>
movb   $0x20,0x7(%rsp)
lea    0x7(%rsp),%rdi
xor    %eax,%eax
call   1030 <char_setback@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
mov    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%1s\00"
define i64 @set_background(i8** %0) {
%2 = alloca i64
%3 = alloca i8**
%4 = alloca i8
%5 = alloca i16
store i8** %0, i8*** %3
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
%8 = call i32 (i8*, i8*, ...) @sscanf(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%9 = trunc i32 %8 to i16
store i16 %9, i16* %5
%10 = load i16, i16* %5
%11 = sext i16 %10 to i32
switch i32 %11, label %13 [
i32 1, label %12
]
12: ; preds = %1
br label %14
13: ; preds = %1
store i8 32, i8* %4
br label %14
14: ; preds = %13, %12
%15 = call i32 (i8*, ...) bitcast (i32 (...)* @char_setback to i32 (i8*, ...)*)(i8* %4)
%16 = icmp ne i32 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %14
store i64 0, i64* %2
br label %19
18: ; preds = %14
store i64 1, i64* %2
br label %19
19: ; preds = %18, %17
%20 = load i64, i64* %2
ret i64 %20
}

LLVM IR (-O2):
@.str = [4 x i8] c"%1s\00"
define i64 @set_background(i8** nocapture %0) {
%2 = alloca i8
%3 = load i8*, i8** %0
%4 = call i32 (i8*, i8*, ...) @sscanf(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = and i32 %4, 65535
%6 = icmp eq i32 %5, 1
br i1 %6, label %8, label %7
7: ; preds = %1
store i8 32, i8* %2
br label %8
8: ; preds = %1, %7
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @char_setback to i32 (i8*, ...)*)(i8* %2)
%10 = icmp ne i32 %9, 0
%11 = zext i1 %10 to i64
ret i64 %11
}
int test_imm_93uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x93 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_93uint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 147
%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_93uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 147
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int strcmp(char *, char *);
int lex_order(char *s1, char *s2) { return strcmp(s1, s2); }


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

x86 assembly (clang, -O2):
<lex_order>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @lex_order(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Type definitions */
struct hci_xfer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ kfree(struct hci_xfer *);
void hci_free_xfer(struct hci_xfer *xfer, unsigned int n) { kfree(xfer); }


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

x86 assembly (clang, -O2):
<hci_free_xfer>:
jmp    1030 <kfree@plt>

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

LLVM IR (-O2):
%struct.hci_xfer = type { i32 }
define void @hci_free_xfer(%struct.hci_xfer* %0, i32 %1) {
%3 = tail call i32 @kfree(%struct.hci_xfer* %0)
ret void
}
/* Variables and functions */
unsigned long crc32(char const *);
unsigned long o2cb_crc32(const char *s) { return crc32(s); }


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

x86 assembly (clang, -O2):
<o2cb_crc32>:
jmp    1030 <crc32@plt>

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

LLVM IR (-O2):
define i64 @o2cb_crc32(i8* %0) {
%2 = tail call i64 @crc32(i8* %0)
ret i64 %2
}
/* Variables and functions */
long strtol(char const *, int /*<<< orphan*/, int);
long atol(const char *str) { return strtol(str, 0, 10); }


x86 assembly (clang, -O0):
<atol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtol@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atol>:
xor    %esi,%esi
mov    $0xa,%edx
jmp    1030 <strtol@plt>

LLVM IR (-O0):
define i64 @atol(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strtol(i8* %3, i32 0, i32 10)
ret i64 %4
}

LLVM IR (-O2):
define i64 @atol(i8* %0) {
%2 = tail call i64 @strtol(i8* %0, i32 0, i32 10)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ foo();
int main(void) {
  foo();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <foo@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <foo@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @foo()
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 @exit(i32 0)
unreachable
}
int test_imm_BBint16_reg(short val) {
  return ((val) & (0xBB << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_BBint16_reg(i16 signext %0) {
%2 = and i16 %0, 187
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Reverse(char *);
int /*<<< orphan*/ itos(int, char *);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  int n = -2663;
  char s[128];
  itos(n, s);
  printf("%s\n", s);
  Reverse(s);
  printf("%s\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xfffff599,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x90(%rbp),%rsi
call   1050 <itos@plt>
lea    -0x90(%rbp),%rsi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    -0x90(%rbp),%rdi
call   1040 <Reverse@plt>
lea    -0x90(%rbp),%rsi
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rsp,%rbx
mov    $0xfffff599,%edi
mov    %rbx,%rsi
call   1050 <itos@plt>
lea    0xeaf(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <Reverse@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [128 x i8]
store i32 0, i32* %1
store i32 -2663, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%6 = call i32 @itos(i32 %4, i8* %5)
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%10 = call i32 @Reverse(i8* %9)
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%3 = call i32 @itos(i32 -2663, i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = call i32 @Reverse(i8* %2)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Type definitions */
struct DSHashMap {
  int dummy;
};

/* Variables and functions */
void *ds_hashmap_get_str(struct DSHashMap *, char *);
void *ds_gets(struct DSHashMap *hash, char *key) {
  return ds_hashmap_get_str(hash, key);
}


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

x86 assembly (clang, -O2):
<ds_gets>:
jmp    1030 <ds_hashmap_get_str@plt>

LLVM IR (-O0):
%struct.DSHashMap = type { i32 }
define i8* @ds_gets(%struct.DSHashMap* %0, i8* %1) {
%3 = alloca %struct.DSHashMap*
%4 = alloca i8*
store %struct.DSHashMap* %0, %struct.DSHashMap** %3
store i8* %1, i8** %4
%5 = load %struct.DSHashMap*, %struct.DSHashMap** %3
%6 = load i8*, i8** %4
%7 = call i8* @ds_hashmap_get_str(%struct.DSHashMap* %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
%struct.DSHashMap = type { i32 }
define i8* @ds_gets(%struct.DSHashMap* %0, i8* %1) {
%3 = tail call i8* @ds_hashmap_get_str(%struct.DSHashMap* %0, i8* %1)
ret i8* %3
}
int addThree(int x) { return x + 3; }


x86 assembly (clang, -O0):
<addThree>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x3,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<addThree>:
lea    0x3(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @addThree(i32 %0) {
%2 = add nsw i32 %0, 3
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(int argc, char **argv) {
  char buffer[1000] = "";
  strcpy(buffer, argv[1]);
  printf("Copied a %u-byte-long buffer\n", strlen(buffer));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x400(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1060 <memset@plt>
lea    -0x400(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x400(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%esi
lea    0xe6b(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3e8,%rsp
mov    %rsi,%rbx
mov    %rsp,%r14
mov    $0x3e8,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
mov    0x8(%rbx),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
lea    0xe86(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Copied a %u-byte-long buffer\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1000 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [1000 x i8]* %6 to i8*
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @strcpy(i8* %8, i8* %11)
%13 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"Copied a %u-byte-long buffer\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1000 x i8]
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = call i32 @strcpy(i8* %4, i8* %6)
%8 = call i32 @strlen(i8* %4)
%9 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int getc(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int Triplet(FILE *fp) {
  int i0;
  int i1;
  int i2;
  i0 = getc(stdin);
  i1 = getc(stdin);
  i2 = getc(stdin);
  return i0 | i1 << 8 | i2 << 16;
}


x86 assembly (clang, -O0):
<Triplet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <getc@plt>
mov    %eax,-0xc(%rbp)
mov    0x2eb4(%rip),%rax
mov    (%rax),%edi
call   1030 <getc@plt>
mov    %eax,-0x10(%rbp)
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
call   1030 <getc@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x14(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Triplet>:
push   %rbp
push   %r14
push   %rbx
mov    0x2ecd(%rip),%rbx
mov    (%rbx),%edi
call   1030 <getc@plt>
mov    %eax,%r14d
mov    (%rbx),%edi
call   1030 <getc@plt>
mov    %eax,%ebp
mov    (%rbx),%edi
call   1030 <getc@plt>
shl    $0x8,%ebp
or     %r14d,%ebp
shl    $0x10,%eax
or     %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
define i32 @Triplet(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %2
%6 = load i32, i32* @stdin
%7 = call i32 @getc(i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* @stdin
%9 = call i32 @getc(i32 %8)
store i32 %9, i32* %4
%10 = load i32, i32* @stdin
%11 = call i32 @getc(i32 %10)
store i32 %11, i32* %5
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = shl i32 %13, 8
%15 = or i32 %12, %14
%16 = load i32, i32* %5
%17 = shl i32 %16, 16
%18 = or i32 %15, %17
ret i32 %18
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @Triplet(i32* nocapture readnone %0) {
%2 = load i32, i32* @stdin
%3 = tail call i32 @getc(i32 %2)
%4 = load i32, i32* @stdin
%5 = tail call i32 @getc(i32 %4)
%6 = load i32, i32* @stdin
%7 = tail call i32 @getc(i32 %6)
%8 = shl i32 %5, 8
%9 = or i32 %8, %3
%10 = shl i32 %7, 16
%11 = or i32 %9, %10
ret i32 %11
}
int calc_offset(int total, int part, int nthreads___0) {
  { return (part * (total / nthreads___0)); }
}


x86 assembly (clang, -O0):
<calc_offset>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
imul   %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_offset>:
mov    %edx,%ecx
mov    %edi,%eax
cltd
idiv   %ecx
imul   %esi,%eax
ret

LLVM IR (-O0):
define i32 @calc_offset(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = load i32, i32* %6
%10 = sdiv i32 %8, %9
%11 = mul nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @calc_offset(i32 %0, i32 %1, i32 %2) {
%4 = sdiv i32 %0, %2
%5 = mul nsw i32 %4, %1
ret i32 %5
}
/* Variables and functions */
int _is_digit(char const);
unsigned int _atoi(const char **str) {
  unsigned int i = 0U;
  while (_is_digit(**str) == 1) {
    i = i * 10U + (unsigned int)(*((*str)++) - '0');
  }
  return i;
}


x86 assembly (clang, -O0):
<_atoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <_is_digit@plt>
cmp    $0x1,%eax
jne    1160 <_atoi+0x50>
imul   $0xa,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
movsbl (%rcx),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <_atoi+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_atoi>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rax
movsbl (%rax),%edi
call   1030 <_is_digit@plt>
xor    %ebx,%ebx
cmp    $0x1,%eax
jne    1154 <_atoi+0x44>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%rbx,4),%eax
mov    (%r14),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,(%r14)
movsbl (%rcx),%edx
lea    (%rdx,%rax,2),%ebx
add    $0xffffffd0,%ebx
movsbl 0x1(%rcx),%edi
call   1030 <_is_digit@plt>
cmp    $0x1,%eax
je     1130 <_atoi+0x20>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @_atoi(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = tail call i32 @_is_digit(i8 signext %3)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %18
6: ; preds = %1, %6
%7 = phi i32 [ %14, %6 ], [ 0, %1 ]
%8 = mul i32 %7, 10
%9 = load i8*, i8** %0
%10 = getelementptr inbounds i8, i8* %9, i64 1
store i8* %10, i8** %0
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = add i32 %8, -48
%14 = add i32 %13, %12
%15 = load i8, i8* %10
%16 = tail call i32 @_is_digit(i8 signext %15)
%17 = icmp eq i32 %16, 1
br i1 %17, label %6, label %18
18: ; preds = %6, %1
%19 = phi i32 [ 0, %1 ], [ %14, %6 ]
ret i32 %19
}
/* Variables and functions */
int /*<<< orphan*/ ass_tk(int);
int /*<<< orphan*/ pr_token(int);
int /*<<< orphan*/ sendtype(int);
void pr_tocs() {
  ass_tk(19);
  sendtype(7);
  pr_token(19);
}


x86 assembly (clang, -O0):
<pr_tocs>:
push   %rbp
mov    %rsp,%rbp
mov    $0x13,%edi
call   1030 <ass_tk@plt>
mov    $0x7,%edi
call   1050 <sendtype@plt>
mov    $0x13,%edi
call   1040 <pr_token@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_tocs>:
push   %rax
mov    $0x13,%edi
call   1030 <ass_tk@plt>
mov    $0x7,%edi
call   1050 <sendtype@plt>
mov    $0x13,%edi
pop    %rax
jmp    1040 <pr_token@plt>

LLVM IR (-O0):
define void @pr_tocs() {
%1 = call i32 @ass_tk(i32 19)
%2 = call i32 @sendtype(i32 7)
%3 = call i32 @pr_token(i32 19)
ret void
}

LLVM IR (-O2):
define void @pr_tocs() {
%1 = tail call i32 @ass_tk(i32 19)
%2 = tail call i32 @sendtype(i32 7)
%3 = tail call i32 @pr_token(i32 19)
ret void
}
int bar(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @bar() {
ret i32 1
}

LLVM IR (-O2):
define i32 @bar() {
ret i32 1
}
double SIGN(double a, double b) {
  return b >= 0 ? (a >= 0 ? a : -a) : (a >= 0 ? -a : a);
}


x86 assembly (clang, -O0):
<SIGN>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1171 <SIGN+0x71>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1141 <SIGN+0x41>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1162 <SIGN+0x62>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11bd <SIGN+0xbd>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11a9 <SIGN+0xa9>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    11b3 <SIGN+0xb3>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<SIGN>:
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
movapd 0xeec(%rip),%xmm3
xorpd  %xmm2,%xmm3
movapd %xmm2,%xmm4
jae    1122 <SIGN+0x22>
movapd %xmm3,%xmm4
xorpd  %xmm5,%xmm5
cmplesd %xmm2,%xmm5
andpd  %xmm5,%xmm3
andnpd %xmm2,%xmm5
orpd   %xmm3,%xmm5
cmpnlesd %xmm1,%xmm0
movapd %xmm0,%xmm1
andnpd %xmm4,%xmm1
andpd  %xmm5,%xmm0
orpd   %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @SIGN(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fcmp oge double %5, 0.000000e+00
br i1 %6, label %7, label %17
7: ; preds = %2
%8 = load double, double* %3
%9 = fcmp oge double %8, 0.000000e+00
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = load double, double* %3
br label %15
12: ; preds = %7
%13 = load double, double* %3
%14 = fneg double %13
br label %15
15: ; preds = %12, %10
%16 = phi double [ %11, %10 ], [ %14, %12 ]
br label %27
17: ; preds = %2
%18 = load double, double* %3
%19 = fcmp oge double %18, 0.000000e+00
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load double, double* %3
%22 = fneg double %21
br label %25
23: ; preds = %17
%24 = load double, double* %3
br label %25
25: ; preds = %23, %20
%26 = phi double [ %22, %20 ], [ %24, %23 ]
br label %27
27: ; preds = %25, %15
%28 = phi double [ %16, %15 ], [ %26, %25 ]
ret double %28
}

LLVM IR (-O2):
define double @SIGN(double %0, double %1) {
%3 = fcmp ult double %1, 0.000000e+00
%4 = fcmp oge double %0, 0.000000e+00
%5 = fneg double %0
%6 = select i1 %4, double %0, double %5
%7 = select i1 %4, double %5, double %0
%8 = select i1 %3, double %7, double %6
ret double %8
}
/* Variables and functions */
float fmaf(float, float, float);
float fms32(float x, float y, float z) { return fmaf(-x, y, z); }


x86 assembly (clang, -O0):
<fms32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
call   1030 <fmaf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fms32>:
xorps  0xee9(%rip),%xmm0
jmp    1030 <fmaf@plt>

LLVM IR (-O0):
define float @fms32(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = fneg float %7
%9 = load float, float* %5
%10 = load float, float* %6
%11 = call float @llvm.fma.f32(float %8, float %9, float %10)
ret float %11
}

LLVM IR (-O2):
define float @fms32(float %0, float %1, float %2) {
%4 = fneg float %0
%5 = tail call float @llvm.fma.f32(float %4, float %1, float %2)
ret float %5
}
void displayYUV_displayPicture(unsigned char *pictureBufferY,
                               unsigned char *pictureBufferU,
                               unsigned char *pictureBufferV,
                               unsigned int pictureWidth,
                               unsigned int pictureHeight) {}


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

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

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

LLVM IR (-O2):
define void @displayYUV_displayPicture(i8* nocapture %0, i8* nocapture %1, i8* nocapture %2, i32 %3, i32 %4) {
ret void
}