xunge/DecIR huggingface dataset:
char *xstrdup(string)
char *string;
{ return strcpy(xmalloc(strlen(string) + 1), string); }


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
mov    $0x0,%al
call   1050 <xmalloc@plt>
movslq %eax,%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
xor    %eax,%eax
call   1050 <xmalloc@plt>
movslq %eax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strlen(i8* %3)
%5 = add i64 %4, 1
%6 = call i32 (i64, ...) bitcast (i32 (...)* @xmalloc to i32 (i64, ...)*)(i64 %5)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i8*
%9 = load i8*, i8** %2
%10 = call i8* @strcpy(i8* %8, i8* %9)
ret i8* %10
}

LLVM IR (-O2):
define i8* @xstrdup(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i32 (i64, ...) bitcast (i32 (...)* @xmalloc to i32 (i64, ...)*)(i64 %3)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
%7 = tail call i8* @strcpy(i8* dereferenceable(1) %6, i8* dereferenceable(1) %0)
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double, double, double, double);
void main() {
  double x = 3.14;
  double y = 1e-3;
  double z = 1e-13;
  double q = 4.0f / 3.0f;
  printf("%f %f %f %f\n", x, y, z * 1e15, q);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  0xf00(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xeeb(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xed6(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xec1(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xea2(%rip),%xmm2
mulsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
lea    0xf09(%rip),%rdi
movsd  0xee1(%rip),%xmm0
movsd  0xee1(%rip),%xmm1
movsd  0xee1(%rip),%xmm2
movsd  0xee1(%rip),%xmm3
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"%f %f %f %f\0A\00"
define void @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double 3.140000e+00, double* %1
store double 1.000000e-03, double* %2
store double 1.000000e-13, double* %3
store double 0x3FF5555560000000, double* %4
%5 = load double, double* %1
%6 = load double, double* %2
%7 = load double, double* %3
%8 = fmul double %7, 1.000000e+15
%9 = load double, double* %4
%10 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double %5, double %6, double %8, double %9)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"%f %f %f %f\0A\00"
define void @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), double 3.140000e+00, double 1.000000e-03, double 1.000000e+02, double 0x3FF5555560000000)
ret void
}
int float_le_xxxx(int a, int b) {
  if (a < 0) {
    a = 0x80000000u - a;
  }
  if (b < 0) {
    b = 0x80000000u - b;
  }
  return a <= b;
}


x86 assembly (clang, -O0):
<float_le_xxxx>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111f <float_le_xxxx+0x1f>
mov    $0x80000000,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1134 <float_le_xxxx+0x34>
mov    $0x80000000,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<float_le_xxxx>:
mov    $0x80000000,%ecx
mov    $0x80000000,%edx
sub    %edi,%edx
test   %edi,%edi
cmovns %edi,%edx
sub    %esi,%ecx
test   %esi,%esi
cmovns %esi,%ecx
xor    %eax,%eax
cmp    %ecx,%edx
setle  %al
ret

LLVM IR (-O0):
define i32 @float_le_xxxx(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 = icmp slt i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %3
%9 = sub i32 -2147483648, %8
store i32 %9, i32* %3
br label %10
10: ; preds = %7, %2
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32, i32* %4
%15 = sub i32 -2147483648, %14
store i32 %15, i32* %4
br label %16
16: ; preds = %13, %10
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = icmp sle i32 %17, %18
%20 = zext i1 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @float_le_xxxx(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 0
%4 = sub i32 -2147483648, %0
%5 = select i1 %3, i32 %4, i32 %0
%6 = icmp slt i32 %1, 0
%7 = sub i32 -2147483648, %1
%8 = select i1 %6, i32 %7, i32 %1
%9 = icmp sle i32 %5, %8
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ wattrset(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ wprintw(int /*<<< orphan*/ *, char *, char *);
void printkeyhelp(char *keytext, char *desc, WINDOW *win, int highattr,
                  int textattr) {
  wattrset(win, highattr);
  wprintw(win, "%s", keytext);
  wattrset(win, textattr);
  wprintw(win, "%s", desc);
}


x86 assembly (clang, -O0):
<printkeyhelp>:
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    %r8d,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <wattrset@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xeaa(%rip),%rsi
call   1040 <wprintw@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1030 <wattrset@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe8a(%rip),%rsi
call   1040 <wprintw@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printkeyhelp>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r15d
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%rbp
mov    %rdx,%rdi
mov    %ecx,%esi
call   1030 <wattrset@plt>
lea    0xebb(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
call   1040 <wprintw@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
call   1030 <wattrset@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <wprintw@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @printkeyhelp(i8* %0, i8* %1, i32* %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32* %2, i32** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32*, i32** %8
%12 = load i32, i32* %9
%13 = call i32 @wattrset(i32* %11, i32 %12)
%14 = load i32*, i32** %8
%15 = load i8*, i8** %6
%16 = call i32 @wprintw(i32* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i32*, i32** %8
%18 = load i32, i32* %10
%19 = call i32 @wattrset(i32* %17, i32 %18)
%20 = load i32*, i32** %8
%21 = load i8*, i8** %7
%22 = call i32 @wprintw(i32* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %21)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @printkeyhelp(i8* %0, i8* %1, i32* %2, i32 %3, i32 %4) {
%6 = tail call i32 @wattrset(i32* %2, i32 %3)
%7 = tail call i32 @wprintw(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = tail call i32 @wattrset(i32* %2, i32 %4)
%9 = tail call i32 @wprintw(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
/* Variables and functions */
int strcasecmp(char const *, char const *);
int gl_display_matches_sort_proc(const void *a, const void *b) {
  return (strcasecmp(*((const char **)a), *((const char **)b)));
}


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

x86 assembly (clang, -O2):
<gl_display_matches_sort_proc>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcasecmp@plt>

LLVM IR (-O0):
define i32 @gl_display_matches_sort_proc(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 i8**
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i8**
%10 = load i8*, i8** %9
%11 = call i32 @strcasecmp(i8* %7, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @gl_display_matches_sort_proc(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcasecmp(i8* %4, i8* %6)
ret i32 %7
}
unsigned short unsignedshort_ignoring_signedlonglong(unsigned short x,
                                                     signed long long y) {
  return x;
}


x86 assembly (clang, -O0):
<unsignedshort_ignoring_signedlonglong>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define zeroext i16 @unsignedshort_ignoring_signedlonglong(i16 returned zeroext %0, i64 %1) {
ret i16 %0
}
/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *);
void sja1105_lib_get_build_date(char *buf) {
  snprintf(buf, 256,
           "Mar 18 2022"
           " "
           "19:24:15");
}


x86 assembly (clang, -O0):
<sja1105_lib_get_build_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x100,%esi
lea    0xed4(%rip),%rdx
call   1030 <snprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sja1105_lib_get_build_date>:
lea    0xee9(%rip),%rdx
mov    $0x100,%esi
jmp    1030 <snprintf@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Mar 18 2022 19:24:15\00"
define void @sja1105_lib_get_build_date(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @snprintf(i8* %3, i32 256, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Mar 18 2022 19:24:15\00"
define void @sja1105_lib_get_build_date(i8* %0) {
%2 = tail call i32 @snprintf(i8* %0, i32 256, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *getenv(char *);
char *getctlenv(char *name, char **p) {
  extern char *getctl();
  char *result = getenv(name);
  return result ? result : getctl(name, p);
}


x86 assembly (clang, -O0):
<getctlenv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1155 <getctlenv+0x35>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1168 <getctlenv+0x48>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <getctl@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getctlenv>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <getenv@plt>
test   %rax,%rax
je     113c <getctlenv+0x1c>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <getctl@plt>

LLVM IR (-O0):
define i8* @getctlenv(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i8*
store i8* %0, i8** %3
store i8** %1, i8*** %4
%6 = load i8*, i8** %3
%7 = call i8* @getenv(i8* %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i8*, i8** %5
br label %16
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = load i8**, i8*** %4
%15 = call i8* (i8*, i8**, ...) bitcast (i8* (...)* @getctl to i8* (i8*, i8**, ...)*)(i8* %13, i8** %14)
br label %16
16: ; preds = %12, %10
%17 = phi i8* [ %11, %10 ], [ %15, %12 ]
ret i8* %17
}

LLVM IR (-O2):
define i8* @getctlenv(i8* %0, i8** %1) {
%3 = tail call i8* @getenv(i8* %0)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i8* (i8*, i8**, ...) bitcast (i8* (...)* @getctl to i8* (i8*, i8**, ...)*)(i8* %0, i8** %1)
br label %7
7: ; preds = %2, %5
%8 = phi i8* [ %6, %5 ], [ %3, %2 ]
ret i8* %8
}
unsigned long long ROL64(unsigned long long word, int i) {
  asm("rolq %%cl,%0" : "=r"(word) : "0"(word), "c"(i));
  return word;
}


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

x86 assembly (clang, -O2):
<ROL64>:
mov    %esi,%ecx
mov    %rdi,%rax
rol    %cl,%rax
ret

LLVM IR (-O0):
define i64 @ROL64(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i32, i32* %4
%7 = call i64 asm "rolq %cl,$0", "=r,0,{cx},~{dirflag},~{fpsr},~{flags}"(i64 %5, i32 %6)
store i64 %7, i64* %3
%8 = load i64, i64* %3
ret i64 %8
}

LLVM IR (-O2):
define i64 @ROL64(i64 %0, i32 %1) {
%3 = tail call i64 asm "rolq %cl,$0", "=r,0,{cx},~{dirflag},~{fpsr},~{flags}"(i64 %0, i32 %1)
ret i64 %3
}
int abxx(void) { return 7; }


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

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

LLVM IR (-O0):
define i32 @abxx() {
ret i32 7
}

LLVM IR (-O2):
define i32 @abxx() {
ret i32 7
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char const *);
void __usage(const char *cmd) {
  printf("\nUse: %s <some_string>\n\n", cmd);
  exit(-1);
}


x86 assembly (clang, -O0):
<__usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<__usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"\0AUse: %s <some_string>\0A\0A\00"
define void @__usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [25 x i8] c"\0AUse: %s <some_string>\0A\0A\00"
define void @__usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
long DBbenchmark(char *, char *);
long InsertOneRecordWithoutProtection() {
  char *query = "INSERT INTO benchmark.user ("
                "name, "
                "email, "
                "password"
                ") VALUES ("
                "\'Lucas Pandolfo Perin\', "
                "\'lucasperin@inf.ufsc.br\', "
                "\'naoVouTeDizer\' "
                ");";
  return DBbenchmark("InsertOneRecordWithoutProtection", query);
}


x86 assembly (clang, -O0):
<InsertOneRecordWithoutProtection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xf52(%rip),%rdi
call   1030 <DBbenchmark@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<InsertOneRecordWithoutProtection>:
lea    0xf69(%rip),%rdi
lea    0xee2(%rip),%rsi
jmp    1030 <DBbenchmark@plt>

LLVM IR (-O0):
@.str = [128 x i8] c"INSERT INTO benchmark.user (name, email, password) VALUES ('Lucas Pandolfo Perin', 'lucasperin@inf.ufsc.br', 'naoVouTeDizer' );\00"
@.str.1 = [33 x i8] c"InsertOneRecordWithoutProtection\00"
define i64 @InsertOneRecordWithoutProtection() {
%1 = alloca i8*
store i8* getelementptr inbounds ([128 x i8], [128 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = call i64 @DBbenchmark(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i64 %3
}

LLVM IR (-O2):
@.str = [128 x i8] c"INSERT INTO benchmark.user (name, email, password) VALUES ('Lucas Pandolfo Perin', 'lucasperin@inf.ufsc.br', 'naoVouTeDizer' );\00"
@.str.1 = [33 x i8] c"InsertOneRecordWithoutProtection\00"
define i64 @InsertOneRecordWithoutProtection() {
%1 = tail call i64 @DBbenchmark(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([128 x i8], [128 x i8]* @.str, i64 0, i64 0))
ret i64 %1
}
void gtk_set_locale() {}


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

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

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

LLVM IR (-O2):
define void @gtk_set_locale() {
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
void main() {
  int32_t a;
  a = 1 % 2;
}


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

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

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

LLVM IR (-O2):
define void @main() {
ret void
}
int test_imm_EAuint8_mem(unsigned char *val) {
  return ((*val) & (0xEA << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_EAuint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -22
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int strcmp(char *, char *);
int tn_compare(void *d, void *o) {
  if (!d || !o) {
    return 0;
  }
  return strcmp((char *)d, (char *)o);
}


x86 assembly (clang, -O0):
<tn_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1136 <tn_compare+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1142 <tn_compare+0x32>
movl   $0x0,-0x4(%rbp)
jmp    1152 <tn_compare+0x42>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tn_compare>:
test   %rdi,%rdi
je     111f <tn_compare+0xf>
test   %rsi,%rsi
je     111f <tn_compare+0xf>
jmp    1030 <strcmp@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @tn_compare(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @strcmp(i8* %0, i8* %1)
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ %7, %6 ], [ 0, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ getpid();
int kill(int /*<<< orphan*/, int);
int l_raise(int signo) { return kill(getpid(), signo); }


x86 assembly (clang, -O0):
<l_raise>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    -0x4(%rbp),%esi
call   1040 <kill@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<l_raise>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <kill@plt>

LLVM IR (-O0):
define i32 @l_raise(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @getpid()
%4 = load i32, i32* %2
%5 = call i32 @kill(i32 %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @l_raise(i32 %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 @kill(i32 %2, i32 %0)
ret i32 %3
}
int gravechar(ap, iop)
struct ioarg *ap;
struct io *iop;
{
  register int c;
  if ((c = qgravechar(ap, iop) & ~0200) == '\n')
    c = ' ';
  return (c);
}


x86 assembly (clang, -O0):
<gravechar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <qgravechar@plt>
and    $0xffffff7f,%eax
mov    %eax,-0x14(%rbp)
cmp    $0xa,%eax
jne    1147 <gravechar+0x37>
movl   $0x20,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gravechar>:
push   %rax
xor    %eax,%eax
call   1030 <qgravechar@plt>
and    $0xffffff7f,%eax
cmp    $0xa,%eax
mov    $0x20,%ecx
cmove  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.ioarg = type opaque
%struct.io = type opaque
define i32 @gravechar(%struct.ioarg* %0, %struct.io* %1) {
%3 = alloca %struct.ioarg*
%4 = alloca %struct.io*
%5 = alloca i32
store %struct.ioarg* %0, %struct.ioarg** %3
store %struct.io* %1, %struct.io** %4
%6 = load %struct.ioarg*, %struct.ioarg** %3
%7 = load %struct.io*, %struct.io** %4
%8 = call i32 (%struct.ioarg*, %struct.io*, ...) bitcast (i32 (...)* @qgravechar to i32 (%struct.ioarg*, %struct.io*, ...)*)(%struct.ioarg* %6, %struct.io* %7)
%9 = and i32 %8, -129
store i32 %9, i32* %5
%10 = icmp eq i32 %9, 10
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 32, i32* %5
br label %12
12: ; preds = %11, %2
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
%struct.ioarg = type opaque
%struct.io = type opaque
define i32 @gravechar(%struct.ioarg* %0, %struct.io* %1) {
%3 = tail call i32 (%struct.ioarg*, %struct.io*, ...) bitcast (i32 (...)* @qgravechar to i32 (%struct.ioarg*, %struct.io*, ...)*)(%struct.ioarg* %0, %struct.io* %1)
%4 = and i32 %3, -129
%5 = icmp eq i32 %4, 10
%6 = select i1 %5, i32 32, i32 %4
ret i32 %6
}
void eliminarordenadorepetidos() {}


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

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

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

LLVM IR (-O2):
define void @eliminarordenadorepetidos() {
ret void
}
__attribute__((no)) int fff() {
  int ans;
  asm("fff_label: .globl fff_label");
  ans = ggg() + 1;
  asm("fff_label2: .globl fff_label2");
  return ans;
}


x86 assembly (clang, -O0):
<fff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp

x86 assembly (clang, -O2):
<fff>:
push   %rax

LLVM IR (-O0):
define i32 @fff() {
%1 = alloca i32
%2 = call i32 (...) @ggg()
%3 = add nsw i32 %2, 1
store i32 %3, i32* %1
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
define i32 @fff() {
tail call void asm sideeffect "fff_label: .globl fff_label", "~{dirflag},~{fpsr},~{flags}"()
%1 = tail call i32 (...) @ggg()
%2 = add nsw i32 %1, 1
tail call void asm sideeffect "fff_label2: .globl fff_label2", "~{dirflag},~{fpsr},~{flags}"()
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ bar();
void foo() {
  bar();
  bar();
  bar();
}


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

x86 assembly (clang, -O2):
<foo>:
push   %rax
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <bar@plt>

LLVM IR (-O0):
define void @foo() {
%1 = call i32 (...) @bar()
%2 = call i32 (...) @bar()
%3 = call i32 (...) @bar()
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 (...) @bar()
%2 = tail call i32 (...) @bar()
%3 = tail call i32 (...) @bar()
ret void
}
/* Variables and functions */
double sqrt(double);
double computeTriangleArea(double a, double b, double c) {
  double semiPerimeter = (a + b + c) / 2;
  return sqrt(semiPerimeter * (semiPerimeter - a) * (semiPerimeter - b) *
              (semiPerimeter - c));
}


x86 assembly (clang, -O0):
<computeTriangleArea>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  0xec2(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<computeTriangleArea>:
movapd %xmm0,%xmm3
addsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
mulsd  0xedc(%rip),%xmm0
movapd %xmm0,%xmm4
subsd  %xmm3,%xmm4
mulsd  %xmm0,%xmm4
movapd %xmm0,%xmm3
subsd  %xmm1,%xmm3
mulsd  %xmm4,%xmm3
subsd  %xmm2,%xmm0
mulsd  %xmm3,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1153 <computeTriangleArea+0x43>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @computeTriangleArea(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %4
%9 = load double, double* %5
%10 = fadd double %8, %9
%11 = load double, double* %6
%12 = fadd double %10, %11
%13 = fdiv double %12, 2.000000e+00
store double %13, double* %7
%14 = load double, double* %7
%15 = load double, double* %7
%16 = load double, double* %4
%17 = fsub double %15, %16
%18 = fmul double %14, %17
%19 = load double, double* %7
%20 = load double, double* %5
%21 = fsub double %19, %20
%22 = fmul double %18, %21
%23 = load double, double* %7
%24 = load double, double* %6
%25 = fsub double %23, %24
%26 = fmul double %22, %25
%27 = call double @sqrt(double %26)
ret double %27
}

LLVM IR (-O2):
define double @computeTriangleArea(double %0, double %1, double %2) {
%4 = fadd double %0, %1
%5 = fadd double %4, %2
%6 = fmul double %5, 5.000000e-01
%7 = fsub double %6, %0
%8 = fmul double %6, %7
%9 = fsub double %6, %1
%10 = fmul double %9, %8
%11 = fsub double %6, %2
%12 = fmul double %11, %10
%13 = tail call double @sqrt(double %12)
ret double %13
}
/* Variables and functions */
int /*<<< orphan*/ test_parser_sourcefile(char *, char *);
int /*<<< orphan*/ test_parser_verify_parse(int /*<<< orphan*/, char *, char *,
                                            char *, int /*<<< orphan*/);
void test_dart_block_comment() {
  test_parser_verify_parse(test_parser_sourcefile("dart", "/*comment*/"),
                           "dart", "", "/*comment*/", 0);
}


x86 assembly (clang, -O0):
<test_dart_block_comment>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xed3(%rip),%rsi
call   1030 <test_parser_sourcefile@plt>
mov    %eax,%edi
lea    0xec0(%rip),%rsi
lea    0xec9(%rip),%rdx
lea    0xeb7(%rip),%rcx
xor    %r8d,%r8d
call   1040 <test_parser_verify_parse@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_dart_block_comment>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rbx
lea    0xed3(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <test_parser_sourcefile@plt>
lea    0xecc(%rip),%rdx
mov    %eax,%edi
mov    %rbx,%rsi
mov    %r14,%rcx
xor    %r8d,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <test_parser_verify_parse@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"dart\00"
@.str.1 = [12 x i8] c"/*comment*/\00"
@.str.2 = [1 x i8] zeroinitializer
define void @test_dart_block_comment() {
%1 = call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @test_parser_verify_parse(i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"dart\00"
@.str.1 = [12 x i8] c"/*comment*/\00"
@.str.2 = [1 x i8] zeroinitializer
define void @test_dart_block_comment() {
%1 = tail call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @test_parser_verify_parse(i32 %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strrev(char *);
int main() {
  char str[100];
  scanf("%s", str);
  strrev(str);
  printf("%s", str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x70(%rbp),%rdi
call   1050 <strrev@plt>
lea    -0x70(%rbp),%rsi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
lea    0xec2(%rip),%r14
mov    %rsp,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1050 <strrev@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @strrev(i8* %5)
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @strrev(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sayhello(char *);
int main(int argc, char **argv) {
  if (argc > 1)
    sayhello(argv[1]);
  else
    sayhello(NULL);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1142 <main+0x32>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <sayhello@plt>
jmp    114b <main+0x3b>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <sayhello@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jl     111c <main+0xc>
mov    0x8(%rsi),%rdi
jmp    111e <main+0xe>
xor    %edi,%edi
call   1030 <sayhello@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @sayhello(i8* %11)
br label %15
13: ; preds = %2
%14 = call i32 @sayhello(i8* null)
br label %15
15: ; preds = %13, %8
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
br label %7
7: ; preds = %2, %4
%8 = phi i8* [ %6, %4 ], [ null, %2 ]
%9 = tail call i32 @sayhello(i8* %8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ test_add_sub_cmp();
int /*<<< orphan*/ test_cpu_behavior();
int /*<<< orphan*/ test_mul_inv();
int /*<<< orphan*/ test_shifts();
int /*<<< orphan*/ test_valid_point();
int main(int argc, char *argv[]) {
  test_cpu_behavior();
  test_shifts();
  test_add_sub_cmp();
  test_mul_inv();
  test_valid_point();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1070 <test_cpu_behavior@plt>
xor    %eax,%eax
call   1050 <test_shifts@plt>
xor    %eax,%eax
call   1060 <test_add_sub_cmp@plt>
xor    %eax,%eax
call   1040 <test_mul_inv@plt>
xor    %eax,%eax
call   1030 <test_valid_point@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @test_cpu_behavior()
%7 = call i32 (...) @test_shifts()
%8 = call i32 (...) @test_add_sub_cmp()
%9 = call i32 (...) @test_mul_inv()
%10 = call i32 (...) @test_valid_point()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test_cpu_behavior()
%4 = tail call i32 (...) @test_shifts()
%5 = tail call i32 (...) @test_add_sub_cmp()
%6 = tail call i32 (...) @test_mul_inv()
%7 = tail call i32 (...) @test_valid_point()
ret i32 0
}
char *strcat(char *dst, const char *src) {
__ESBMC_HIDE:
  return dst;
}


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

x86 assembly (clang, -O2):
<strcat>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i8* @strcat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %2
%6 = load i8*, i8** %3
ret i8* %6
}

LLVM IR (-O2):
define i8* @strcat(i8* readnone returned %0, i8* nocapture readnone %1) {
ret i8* %0
}
int if_lead_year(int year) {
  if (year % 4 == 0) {
    if (year % 100 == 0) {
      if (year % 400 == 0) {
        return 1;
      } else
        return 0;
    } else
      return 1;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<if_lead_year>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1167 <if_lead_year+0x67>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    115b <if_lead_year+0x5b>
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    114f <if_lead_year+0x4f>
movl   $0x1,-0x4(%rbp)
jmp    116e <if_lead_year+0x6e>
movl   $0x0,-0x4(%rbp)
jmp    116e <if_lead_year+0x6e>
movl   $0x1,-0x4(%rbp)
jmp    116e <if_lead_year+0x6e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<if_lead_year>:
xor    %eax,%eax
test   $0x3,%dil
je     1109 <if_lead_year+0x9>
ret
imul   $0xc28f5c29,%edi,%ecx
add    $0x51eb850,%ecx
mov    %ecx,%edx
ror    $0x2,%edx
mov    $0x1,%eax
cmp    $0x28f5c28,%edx
ja     1108 <if_lead_year+0x8>
ror    $0x4,%ecx
xor    %eax,%eax
cmp    $0xa3d70b,%ecx
setb   %al
ret

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

LLVM IR (-O2):
define i32 @if_lead_year(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = srem i32 %0, 100
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = srem i32 %0, 400
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %1, %4, %7
%12 = phi i32 [ %10, %7 ], [ 1, %4 ], [ 0, %1 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int hello() {
  printf("gcc -share -o libhello.so hello.c!\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<hello>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"gcc -share -o libhello.so hello.c!\0A\00"
define i32 @hello() {
%1 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [35 x i8] c"gcc -share -o libhello.so hello.c!\00"
define i32 @hello() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int test_imm_CFuint8_reg(unsigned char val) {
  return ((val) & (0xCF << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_CFuint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 207
%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_CFuint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -49
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ HplMsp430GeneralIOP__30__IO__makeOutput();
void Msp430GpioC__4__HplGeneralIO__makeOutput(void) {
  HplMsp430GeneralIOP__30__IO__makeOutput();
}


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

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

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

LLVM IR (-O2):
define void @Msp430GpioC__4__HplGeneralIO__makeOutput() {
%1 = tail call i32 (...) @HplMsp430GeneralIOP__30__IO__makeOutput()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar(char const **);
void foo(const char *s, ...) { bar(&s); }


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

x86 assembly (clang, -O2):
<foo>:
push   %rax
mov    %rdi,(%rsp)
mov    %rsp,%rdi
call   1030 <bar@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @foo(i8* %0, ...) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @bar(i8** %2)
ret void
}

LLVM IR (-O2):
define void @foo(i8* %0, ...) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @bar(i8** %2)
ret void
}
/* Variables and functions */
int __ptsname_r(int, char *, int);
int errno;
char *ptsname(int fd) {
  static char buf[9 + sizeof(int) * 3 + 1];
  int err = __ptsname_r(fd, buf, sizeof buf);
  if (err) {
    errno = err;
    return 0;
  }
  return buf;
}


x86 assembly (clang, -O0):
<ptsname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    0x2f1b(%rip),%rsi
mov    $0x16,%edx
call   1030 <__ptsname_r@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1155 <ptsname+0x45>
mov    -0x10(%rbp),%ecx
mov    0x2e9a(%rip),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1160 <ptsname+0x50>
lea    0x2ee4(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptsname>:
push   %rbx
lea    0x2f28(%rip),%rbx
mov    %rbx,%rsi
mov    $0x16,%edx
call   1030 <__ptsname_r@plt>
test   %eax,%eax
je     1134 <ptsname+0x24>
mov    0x2eb0(%rip),%rcx
mov    %eax,(%rcx)
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@ptsname.buf = internal global [22 x i8] zeroinitializer
@errno = global i32 0
define i8* @ptsname(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @__ptsname_r(i32 %5, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @ptsname.buf, i64 0, i64 0), i32 22)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* %4
store i32 %10, i32* @errno
store i8* null, i8** %2
br label %12
11: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @ptsname.buf, i64 0, i64 0), i8** %2
br label %12
12: ; preds = %11, %9
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
@ptsname.buf = internal global [22 x i8] zeroinitializer
@errno = global i32 0
define i8* @ptsname(i32 %0) {
%2 = tail call i32 @__ptsname_r(i32 %0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @ptsname.buf, i64 0, i64 0), i32 22)
%3 = icmp eq i32 %2, 0
br i1 %3, label %5, label %4
4: ; preds = %1
store i32 %2, i32* @errno
br label %5
5: ; preds = %1, %4
%6 = phi i8* [ null, %4 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @ptsname.buf, i64 0, i64 0), %1 ]
ret i8* %6
}
void TOSH_MAKE_PW1_OUTPUT() { ; }


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

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

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

LLVM IR (-O2):
define void @TOSH_MAKE_PW1_OUTPUT() {
ret void
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ scanf(char *, char *);
char *input() {
  char *str = malloc(256);
  scanf("%s", str);
  return str;
}


x86 assembly (clang, -O0):
<input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x100,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xebf(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input>:
push   %rbx
mov    $0x100,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
lea    0xecb(%rip),%rdi
mov    %rax,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i8* @input() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 256)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i8*, i8** %1
ret i8* %5
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i8* @input() {
%1 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%2 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i8* %1
}
double mult2_2(double a, double b) { return a * b; }


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

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

LLVM IR (-O0):
define double @mult2_2(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fmul double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @mult2_2(double %0, double %1) {
%3 = fmul double %0, %1
ret double %3
}
int ndigits(int i) {
  int n = i < 0 ? 2 : 1;
  while (i > 9) {
    n++;
    i /= 10;
  }
  return n;
}


x86 assembly (clang, -O0):
<ndigits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x1,%eax
mov    $0x2,%ecx
cmp    $0x0,%edx
cmovl  %ecx,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x9,-0x4(%rbp)
jle    1143 <ndigits+0x43>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    111d <ndigits+0x1d>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ndigits>:
mov    %edi,%eax
shr    $0x1f,%eax
add    $0x1,%eax
cmp    $0xa,%edi
jl     1134 <ndigits+0x34>
mov    $0xcccccccd,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%eax
mov    %edi,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
cmp    $0x63,%edi
mov    %edx,%edi
ja     1120 <ndigits+0x20>
ret

LLVM IR (-O0):
define i32 @ndigits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 2, i32 1
store i32 %7, i32* %3
br label %8
8: ; preds = %11, %1
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 9
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
%14 = load i32, i32* %2
%15 = sdiv i32 %14, 10
store i32 %15, i32* %2
br label %8
16: ; preds = %8
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @ndigits(i32 %0) {
%2 = icmp slt i32 %0, 0
%3 = select i1 %2, i32 2, i32 1
%4 = icmp sgt i32 %0, 9
br i1 %4, label %5, label %11
5: ; preds = %1, %5
%6 = phi i32 [ %8, %5 ], [ %3, %1 ]
%7 = phi i32 [ %9, %5 ], [ %0, %1 ]
%8 = add nuw nsw i32 %6, 1
%9 = udiv i32 %7, 10
%10 = icmp ugt i32 %7, 99
br i1 %10, label %5, label %11
11: ; preds = %5, %1
%12 = phi i32 [ %3, %1 ], [ %8, %5 ]
ret i32 %12
}