xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ *strchr(char const *, char);
char *nclocate(char *p, const char *charlist) {
  for (; *p; p++) {
    if (strchr(charlist, *p) != NULL)
      return p;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<nclocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     116a <nclocate+0x5a>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     1154 <nclocate+0x44>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1172 <nclocate+0x62>
jmp    1159 <nclocate+0x49>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <nclocate+0x10>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nclocate>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     113c <nclocate+0x2c>
mov    %rsi,%r14
mov    %rdi,%rbx
movsbl %al,%esi
mov    %r14,%rdi
call   1030 <strchr@plt>
test   %rax,%rax
jne    113e <nclocate+0x2e>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <nclocate+0x10>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @nclocate(i8* %0, i8* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %10
%6 = phi i8 [ %12, %10 ], [ %3, %2 ]
%7 = phi i8* [ %11, %10 ], [ %0, %2 ]
%8 = tail call i32* @strchr(i8* %1, i8 signext %6)
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %10, %2
%15 = phi i8* [ null, %2 ], [ null, %10 ], [ %7, %5 ]
ret i8* %15
}
/* Variables and functions */
int /*<<< orphan*/ STDOUT_FILENO;
int isatty(int /*<<< orphan*/);
const char *terminal_color(const char *color) {
  static int is_tty = -1;
  if (is_tty == -1)
    is_tty = isatty(STDOUT_FILENO);
  if (!is_tty)
    return "";
  return color;
}


x86 assembly (clang, -O0):
<terminal_color>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpl   $0xffffffff,0x2f05(%rip)
jne    113d <terminal_color+0x2d>
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
call   1030 <isatty@plt>
mov    %eax,0x2eeb(%rip)
cmpl   $0x0,0x2ee4(%rip)
jne    115a <terminal_color+0x4a>
lea    0xeaf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1162 <terminal_color+0x52>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<terminal_color>:
push   %rbx
mov    %rdi,%rbx
mov    0x2f0e(%rip),%eax
cmp    $0xffffffff,%eax
jne    1133 <terminal_color+0x23>
mov    0x2eca(%rip),%rax
mov    (%rax),%edi
call   1030 <isatty@plt>
mov    %eax,0x2ef5(%rip)
test   %eax,%eax
lea    0xec4(%rip),%rax
cmove  %rax,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@terminal_color.is_tty = internal global i32 -1
@STDOUT_FILENO = global i32 0
@.str = [1 x i8] zeroinitializer
define i8* @terminal_color(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i32, i32* @terminal_color.is_tty
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* @STDOUT_FILENO
%8 = call i32 @isatty(i32 %7)
store i32 %8, i32* @terminal_color.is_tty
br label %9
9: ; preds = %6, %1
%10 = load i32, i32* @terminal_color.is_tty
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %9
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %2
br label %15
13: ; preds = %9
%14 = load i8*, i8** %3
store i8* %14, i8** %2
br label %15
15: ; preds = %13, %12
%16 = load i8*, i8** %2
ret i8* %16
}

LLVM IR (-O2):
@terminal_color.is_tty = internal unnamed_addr global i32 -1
@STDOUT_FILENO = global i32 0
@.str = [1 x i8] zeroinitializer
define i8* @terminal_color(i8* readnone %0) {
%2 = load i32, i32* @terminal_color.is_tty
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @STDOUT_FILENO
%6 = tail call i32 @isatty(i32 %5)
store i32 %6, i32* @terminal_color.is_tty
br label %7
7: ; preds = %4, %1
%8 = phi i32 [ %6, %4 ], [ %2, %1 ]
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %0
ret i8* %10
}
long int date_diff(int n1, int n2) {
  if (n1 > n2)
    return n1 - n2;
  else
    return n2 - n1;
}


x86 assembly (clang, -O0):
<date_diff>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1127 <date_diff+0x27>
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
cltq
mov    %rax,-0x8(%rbp)
jmp    1133 <date_diff+0x33>
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_diff>:
mov    %edi,%eax
sub    %esi,%eax
neg    %eax
sub    %esi,%edi
cmovle %eax,%edi
movslq %edi,%rax
ret

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

LLVM IR (-O2):
define i64 @date_diff(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = sub nsw i32 %0, %1
%5 = sub nsw i32 %1, %0
%6 = select i1 %3, i32 %4, i32 %5
%7 = sext i32 %6 to i64
ret i64 %7
}
int do_157() { return 157; }


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

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

LLVM IR (-O0):
define i32 @do_157() {
ret i32 157
}

LLVM IR (-O2):
define i32 @do_157() {
ret i32 157
}
long __syscall1(long num, long arg1) {
  unsigned long result;
  asm volatile("syscall"
               : "=a"(result)
               : "a"(num), "D"(arg1)
               : "memory", "rcx", "r11");
  return result;
}


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

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

LLVM IR (-O0):
define i64 @__syscall1(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i64 asm sideeffect "syscall", "={ax},{ax},{di},~{memory},~{rcx},~{r11},~{dirflag},~{fpsr},~{flags}"(i64 %6, i64 %7)
store i64 %8, i64* %5
%9 = load i64, i64* %5
ret i64 %9
}

LLVM IR (-O2):
define i64 @__syscall1(i64 %0, i64 %1) {
%3 = tail call i64 asm sideeffect "syscall", "={ax},{ax},{di},~{memory},~{rcx},~{r11},~{dirflag},~{fpsr},~{flags}"(i64 %0, i64 %1)
ret i64 %3
}
/* Variables and functions */
int eu2ro(double *, double *, int);
int om2eu(double *, double *, int);
int om2ro(double *om, double *ro, int p) {
  double eu[3];
  int trash;
  trash = om2eu(om, eu, p);
  trash = eu2ro(eu, ro, p);
  return 1;
}


x86 assembly (clang, -O0):
<om2ro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <om2eu@plt>
mov    %eax,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <eu2ro@plt>
mov    %eax,-0x34(%rbp)
mov    $0x1,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<om2ro>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rsp,%r15
mov    %r15,%rsi
call   1040 <om2eu@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1030 <eu2ro@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @om2ro(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca [3 x double]
%8 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
%9 = load double*, double** %4
%10 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%11 = load i32, i32* %6
%12 = call i32 @om2eu(double* %9, double* %10, i32 %11)
store i32 %12, i32* %8
%13 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%14 = load double*, double** %5
%15 = load i32, i32* %6
%16 = call i32 @eu2ro(double* %13, double* %14, i32 %15)
store i32 %16, i32* %8
ret i32 1
}

LLVM IR (-O2):
define i32 @om2ro(double* %0, double* %1, i32 %2) {
%4 = alloca [3 x double]
%5 = bitcast [3 x double]* %4 to i8*
%6 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%7 = call i32 @om2eu(double* %0, double* %6, i32 %2)
%8 = call i32 @eu2ro(double* %6, double* %1, i32 %2)
ret i32 1
}
/* Variables and functions */
int EPOLLOUT;
int _write_event() { return EPOLLOUT; }


x86 assembly (clang, -O0):
<_write_event>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@EPOLLOUT = global i32 0
define i32 @_write_event() {
%1 = load i32, i32* @EPOLLOUT
ret i32 %1
}

LLVM IR (-O2):
@EPOLLOUT = global i32 0
define i32 @_write_event() {
%1 = load i32, i32* @EPOLLOUT
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
void LogVfprintf(FILE *prFP, char *pcFmt, va_list rVArgList) {
  vfprintf(prFP, pcFmt, rVArgList);
  fprintf(prFP, "\n");
  fflush(prFP);
}


x86 assembly (clang, -O0):
<LogVfprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <vfprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LogVfprintf>:
push   %rbx
mov    %rdi,%rbx
call   1050 <vfprintf@plt>
mov    $0xa,%edi
mov    %rbx,%rsi
call   1030 <fputc@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @LogVfprintf(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @vfprintf(i32* %7, i8* %8, i32 %9)
%11 = load i32*, i32** %4
%12 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = load i32*, i32** %4
%14 = call i32 @fflush(i32* %13)
ret void
}

LLVM IR (-O2):
define void @LogVfprintf(i32* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32 @vfprintf(i32* %0, i8* %1, i32 %2)
%5 = tail call i32 @fputc(i32 10, i32* %0)
%6 = tail call i32 @fflush(i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int);
int removeNumber(char *);
int /*<<< orphan*/ scanf(char *, char *);
int main(int argc, const char *argv[]) {
  char str[100];
  scanf("%s", str);
  int r = removeNumber(str);
  printf("%s <=== result: r=%d\n", str, r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rsi
lea    0xeac(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x80(%rbp),%rdi
call   1040 <removeNumber@plt>
mov    %eax,-0x84(%rbp)
lea    -0x80(%rbp),%rsi
mov    -0x84(%rbp),%edx
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [22 x i8] c"%s <=== result: r=%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%11 = call i32 @removeNumber(i8* %10)
store i32 %11, i32* %7
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%13 = load i32, i32* %7
%14 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %12, i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [22 x i8] c"%s <=== result: r=%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @removeNumber(i8* %4)
%7 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 %6)
ret i32 0
}
float AND(float a, float b) {
  if (a < b) {
    return a;
  } else {
    return b;
  }
}


x86 assembly (clang, -O0):
<AND>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1130 <AND+0x30>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    113a <AND+0x3a>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<AND>:
minss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @AND(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %4
store float %1, float* %5
%6 = load float, float* %4
%7 = load float, float* %5
%8 = fcmp olt float %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load float, float* %4
store float %10, float* %3
br label %13
11: ; preds = %2
%12 = load float, float* %5
store float %12, float* %3
br label %13
13: ; preds = %11, %9
%14 = load float, float* %3
ret float %14
}

LLVM IR (-O2):
define float @AND(float %0, float %1) {
%3 = fcmp olt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
int grid_xpub_events(__attribute__((unused)) struct grid_sockbase *self) {
  return 2;
}


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

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

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

LLVM IR (-O2):
%struct.grid_sockbase = type opaque
define i32 @grid_xpub_events(%struct.grid_sockbase* nocapture readnone %0) {
ret i32 2
}
/* Variables and functions */
int exp(double);
double activationFunc(double x) { return 1. / (1. + exp(x)); }


x86 assembly (clang, -O0):
<activationFunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
cvtsi2sd %eax,%xmm0
movsd  0xecd(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xec1(%rip),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<activationFunc>:
push   %rax
call   1030 <exp@plt>
cvtsi2sd %eax,%xmm1
movsd  0xede(%rip),%xmm0
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @activationFunc(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @exp(double %3)
%5 = sitofp i32 %4 to double
%6 = fadd double 1.000000e+00, %5
%7 = fdiv double 1.000000e+00, %6
ret double %7
}

LLVM IR (-O2):
define double @activationFunc(double %0) {
%2 = tail call i32 @exp(double %0)
%3 = sitofp i32 %2 to double
%4 = fadd double %3, 1.000000e+00
%5 = fdiv double 1.000000e+00, %4
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ server_run();
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  fprintf(stderr, "hallo\n");
  server_run();
  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    0x2ea3(%rip),%rax
mov    (%rax),%edi
lea    0xeba(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <server_run@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <server_run@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [7 x i8] c"hallo\0A\00"
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* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @server_run()
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [7 x i8] c"hallo\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (...) @server_run()
ret i32 0
}
int *fn5(int a) { return a; }


x86 assembly (clang, -O0):
<fn5>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn5>:
movslq %edi,%rax
ret

LLVM IR (-O0):
define i32* @fn5(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
ret i32* %5
}

LLVM IR (-O2):
define i32* @fn5(i32 %0) {
%2 = sext i32 %0 to i64
%3 = inttoptr i64 %2 to i32*
ret i32* %3
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, int,
                           char const *, char *);
char *plfit_strerror(int);
int /*<<< orphan*/ stderr;
void plfit_error_handler_abort(const char *reason, const char *file, int line,
                               int plfit_errno) {
  fprintf(stderr, "Error at %s:%i : %s, %s\n", file, line, reason,
          plfit_strerror(plfit_errno));
  abort();
}


x86 assembly (clang, -O0):
<plfit_error_handler_abort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    0x2e93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <plfit_strerror@plt>
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    %rax,%r9
lea    0xe78(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<plfit_error_handler_abort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%r15
mov    0x2e99(%rip),%rax
mov    (%rax),%ebp
mov    %ecx,%edi
call   1040 <plfit_strerror@plt>
lea    0xea9(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %r14d,%ecx
mov    %r15,%r8
mov    %rax,%r9
call   1050 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"Error at %s:%i : %s, %s\0A\00"
define void @plfit_error_handler_abort(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = load i8*, i8** %5
%13 = load i32, i32* %8
%14 = call i8* @plfit_strerror(i32 %13)
%15 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %11, i8* %12, i8* %14)
%16 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"Error at %s:%i : %s, %s\0A\00"
define void @plfit_error_handler_abort(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = load i32, i32* @stderr
%6 = tail call i8* @plfit_strerror(i32 %3)
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %2, i8* %0, i8* %6)
%8 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int f1();
int f2();
int f3(char *);
int f4(char *);
int main() {
  char a[30];
  if (f1() != 17 || f2() != 17 || f3(a) != 17 || f4(a) != 17)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <f1@plt>
cmp    $0x11,%eax
jne    11a3 <main+0x53>
mov    $0x0,%al
call   1030 <f2@plt>
cmp    $0x11,%eax
jne    11a3 <main+0x53>
lea    -0x30(%rbp),%rdi
call   1050 <f3@plt>
cmp    $0x11,%eax
jne    11a3 <main+0x53>
lea    -0x30(%rbp),%rdi
call   1070 <f4@plt>
cmp    $0x11,%eax
je     11aa <main+0x5a>
mov    $0x0,%al
call   1040 <abort@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
xor    %eax,%eax
call   1060 <f1@plt>
cmp    $0x11,%eax
jne    118d <main+0x3d>
xor    %eax,%eax
call   1030 <f2@plt>
cmp    $0x11,%eax
jne    118d <main+0x3d>
mov    %rsp,%rdi
call   1050 <f3@plt>
cmp    $0x11,%eax
jne    118d <main+0x3d>
mov    %rsp,%rdi
call   1070 <f4@plt>
cmp    $0x11,%eax
jne    118d <main+0x3d>
xor    %eax,%eax
add    $0x28,%rsp
ret
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x i8]
store i32 0, i32* %1
%3 = call i32 (...) @f1()
%4 = icmp ne i32 %3, 17
br i1 %4, label %16, label %5
5: ; preds = %0
%6 = call i32 (...) @f2()
%7 = icmp ne i32 %6, 17
br i1 %7, label %16, label %8
8: ; preds = %5
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%10 = call i32 @f3(i8* %9)
%11 = icmp ne i32 %10, 17
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%14 = call i32 @f4(i8* %13)
%15 = icmp ne i32 %14, 17
br i1 %15, label %16, label %18
16: ; preds = %12, %8, %5, %0
%17 = call i32 (...) @abort()
unreachable
18: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [30 x i8]
%2 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @f1()
%4 = icmp eq i32 %3, 17
br i1 %4, label %5, label %14
5: ; preds = %0
%6 = tail call i32 (...) @f2()
%7 = icmp eq i32 %6, 17
br i1 %7, label %8, label %14
8: ; preds = %5
%9 = call i32 @f3(i8* %2)
%10 = icmp eq i32 %9, 17
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = call i32 @f4(i8* %2)
%13 = icmp eq i32 %12, 17
br i1 %13, label %16, label %14
14: ; preds = %11, %8, %5, %0
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %11
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ chdir(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fork();
int /*<<< orphan*/ setsid();
int /*<<< orphan*/ umask(int /*<<< orphan*/);
void daemon_init(void) {
  if (fork() > 0) {
    exit(0);
  }
  setsid();
  chdir("/");
  umask(0);
  close(0);
  close(1);
  close(2);
}


x86 assembly (clang, -O0):
<daemon_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1080 <fork@plt>
cmp    $0x0,%rax
jle    117c <daemon_init+0x1c>
xor    %edi,%edi
call   1070 <exit@plt>
mov    $0x0,%al
call   1050 <setsid@plt>
lea    0xe76(%rip),%rdi
call   1030 <chdir@plt>
xor    %edi,%edi
call   1060 <umask@plt>
xor    %edi,%edi
call   1040 <close@plt>
mov    $0x1,%edi
call   1040 <close@plt>
mov    $0x2,%edi
call   1040 <close@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<daemon_init>:
push   %rax
xor    %eax,%eax
call   1080 <fork@plt>
test   %rax,%rax
jg     11a3 <daemon_init+0x43>
xor    %eax,%eax
call   1050 <setsid@plt>
lea    0xe85(%rip),%rdi
call   1030 <chdir@plt>
xor    %edi,%edi
call   1060 <umask@plt>
xor    %edi,%edi
call   1040 <close@plt>
mov    $0x1,%edi
call   1040 <close@plt>
mov    $0x2,%edi
pop    %rax
jmp    1040 <close@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
define void @daemon_init() {
%1 = call i64 (...) @fork()
%2 = icmp sgt i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @exit(i32 0)
unreachable
5: ; preds = %0
%6 = call i32 (...) @setsid()
%7 = call i32 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @umask(i32 0)
%9 = call i32 @close(i32 0)
%10 = call i32 @close(i32 1)
%11 = call i32 @close(i32 2)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"/\00"
define void @daemon_init() {
%1 = tail call i64 (...) @fork()
%2 = icmp sgt i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @exit(i32 0)
unreachable
5: ; preds = %0
%6 = tail call i32 (...) @setsid()
%7 = tail call i32 @chdir(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @umask(i32 0)
%9 = tail call i32 @close(i32 0)
%10 = tail call i32 @close(i32 1)
%11 = tail call i32 @close(i32 2)
ret void
}
/* Variables and functions */
scalar_t__ isalnum(int);
bool is_alnum(int a) { return isalnum(a) || a == '_' || a == '$'; }


x86 assembly (clang, -O0):
<is_alnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isalnum@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    114e <is_alnum+0x3e>
mov    $0x1,%al
cmpl   $0x5f,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     114e <is_alnum+0x3e>
cmpl   $0x24,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_alnum>:
push   %rbx
mov    %edi,%ebx
call   1030 <isalnum@plt>
test   %rax,%rax
setne  %al
cmp    $0x5f,%ebx
sete   %cl
cmp    $0x24,%ebx
sete   %dl
or     %cl,%dl
or     %al,%dl
movzbl %dl,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @is_alnum(i32 %0) {
%2 = tail call i64 @isalnum(i32 %0)
%3 = icmp ne i64 %2, 0
%4 = icmp eq i32 %0, 95
%5 = or i1 %4, %3
%6 = icmp eq i32 %0, 36
%7 = or i1 %6, %5
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ foo(int /*<<< orphan*/);
void bar(void) { foo(0); }


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

x86 assembly (clang, -O2):
<bar>:
xor    %edi,%edi
jmp    1030 <foo@plt>

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

LLVM IR (-O2):
define void @bar() {
%1 = tail call i32 @foo(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void exit_wrapper() { exit(1); }


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

x86 assembly (clang, -O2):
<exit_wrapper>:
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @exit_wrapper() {
%1 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @exit_wrapper() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char *prgname) {
  printf("usage: %s [OPTION] FILE > IMAGE\n"
         "\n"
         "options:\n"
         "  -a <address> memory address for the loaded image in SRAM\n",
         prgname);
}


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

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

LLVM IR (-O0):
@.str = [102 x i8] c"usage: %s [OPTION] FILE > IMAGE\0A\0Aoptions:\0A -a <address> memory address for the loaded image in SRAM\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 ([102 x i8], [102 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [102 x i8] c"usage: %s [OPTION] FILE > IMAGE\0A\0Aoptions:\0A -a <address> memory address for the loaded image in SRAM\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([102 x i8], [102 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Fatal_OutOfMemory();
scalar_t__ malloc(int);
void NegateReal(long p_real, long *r_real) {
  double *t_value;
  t_value = (double *)malloc(sizeof(double));
  if (t_value == NULL)
    Fatal_OutOfMemory();
  *t_value = -*(double *)p_real;
  *r_real = (long)t_value;
}


x86 assembly (clang, -O0):
<NegateReal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1150 <NegateReal+0x30>
mov    $0x0,%al
call   1030 <Fatal_OutOfMemory@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NegateReal>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1144 <NegateReal+0x24>
xor    %eax,%eax
call   1030 <Fatal_OutOfMemory@plt>
movsd  (%r15),%xmm0
xorps  0xeb0(%rip),%xmm0
movlps %xmm0,(%rbx)
mov    %rbx,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @NegateReal(i64 %0, i64* %1) {
%3 = alloca i64
%4 = alloca i64*
%5 = alloca double*
store i64 %0, i64* %3
store i64* %1, i64** %4
%6 = call i64 @malloc(i32 8)
%7 = inttoptr i64 %6 to double*
store double* %7, double** %5
%8 = load double*, double** %5
%9 = icmp eq double* %8, null
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @Fatal_OutOfMemory()
br label %12
12: ; preds = %10, %2
%13 = load i64, i64* %3
%14 = inttoptr i64 %13 to double*
%15 = load double, double* %14
%16 = fneg double %15
%17 = load double*, double** %5
store double %16, double* %17
%18 = load double*, double** %5
%19 = ptrtoint double* %18 to i64
%20 = load i64*, i64** %4
store i64 %19, i64* %20
ret void
}

LLVM IR (-O2):
define void @NegateReal(i64 %0, i64* nocapture writeonly %1) {
%3 = tail call i64 @malloc(i32 8)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @Fatal_OutOfMemory()
br label %7
7: ; preds = %5, %2
%8 = inttoptr i64 %3 to double*
%9 = inttoptr i64 %0 to double*
%10 = load double, double* %9
%11 = fneg double %10
store double %11, double* %8
store i64 %3, i64* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void home_task_error(char *msg) { fprintf(stderr, "%s\n", msg); }


x86 assembly (clang, -O0):
<home_task_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<home_task_error>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @home_task_error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_warning(void) {
  printf("NOTE:  Mixed use of MSR and kernel interfaces "
         "to manage\n       CAT or CMT & MBM may lead to "
         "unexpected behavior.\n");
}


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

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

LLVM IR (-O0):
@.str = [114 x i8] c"NOTE: Mixed use of MSR and kernel interfaces to manage\0A CAT or CMT & MBM may lead to unexpected behavior.\0A\00"
define void @print_warning() {
%1 = call i32 @printf(i8* getelementptr inbounds ([114 x i8], [114 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [113 x i8] c"NOTE: Mixed use of MSR and kernel interfaces to manage\0A CAT or CMT & MBM may lead to unexpected behavior.\00"
define void @print_warning() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([113 x i8], [113 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
long floor(double);
double sqrt(long);
long lsqrt(long n) {
  double dn;
  dn = sqrt(n);
  return floor(dn);
}


x86 assembly (clang, -O0):
<lsqrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <sqrt@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <floor@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lsqrt>:
push   %rax
call   1030 <sqrt@plt>
pop    %rax
jmp    1040 <floor@plt>

LLVM IR (-O0):
define i64 @lsqrt(i64 %0) {
%2 = alloca i64
%3 = alloca double
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call double @sqrt(i64 %4)
store double %5, double* %3
%6 = load double, double* %3
%7 = call i64 @floor(double %6)
ret i64 %7
}

LLVM IR (-O2):
define i64 @lsqrt(i64 %0) {
%2 = tail call double @sqrt(i64 %0)
%3 = tail call i64 @floor(double %2)
ret i64 %3
}
int fnFibonacci(int iN) {
  if (iN == 0 || iN == 1)
    return iN;
  else
    return fnFibonacci(iN - 1) + fnFibonacci(iN - 2);
}


x86 assembly (clang, -O0):
<fnFibonacci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112f <fnFibonacci+0x1f>
cmpl   $0x1,-0x8(%rbp)
jne    113a <fnFibonacci+0x2a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115d <fnFibonacci+0x4d>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fnFibonacci@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fnFibonacci@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnFibonacci>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
cmp    $0x2,%edi
jb     1132 <fnFibonacci+0x22>
xor    %ebp,%ebp
xchg   %ax,%ax
lea    -0x1(%rbx),%edi
call   1030 <fnFibonacci@plt>
add    $0xfffffffe,%ebx
add    %eax,%ebp
cmp    $0x1,%ebx
ja     1120 <fnFibonacci+0x10>
add    %ebx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fnFibonacci(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -1
%7 = tail call i32 @fnFibonacci(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %8, 2
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %9, %3 ]
%13 = phi i32 [ %0, %1 ], [ %8, %3 ]
%14 = add nsw i32 %13, %12
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ _SC_NPROCESSORS_ONLN;
long sysconf(int /*<<< orphan*/);
long get_cpu_cores(void) { return sysconf(_SC_NPROCESSORS_ONLN); }


x86 assembly (clang, -O0):
<get_cpu_cores>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <sysconf@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@_SC_NPROCESSORS_ONLN = global i32 0
define i64 @get_cpu_cores() {
%1 = load i32, i32* @_SC_NPROCESSORS_ONLN
%2 = call i64 @sysconf(i32 %1)
ret i64 %2
}

LLVM IR (-O2):
@_SC_NPROCESSORS_ONLN = global i32 0
define i64 @get_cpu_cores() {
%1 = load i32, i32* @_SC_NPROCESSORS_ONLN
%2 = tail call i64 @sysconf(i32 %1)
ret i64 %2
}
/* Type definitions */
struct t_relay_client {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ relay_dogechat_unhook_signals(struct t_relay_client *);
void relay_dogechat_close_connection(struct t_relay_client *client) {
  relay_dogechat_unhook_signals(client);
}


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

x86 assembly (clang, -O2):
<relay_dogechat_close_connection>:
jmp    1030 <relay_dogechat_unhook_signals@plt>

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

LLVM IR (-O2):
%struct.t_relay_client = type { i32 }
define void @relay_dogechat_close_connection(%struct.t_relay_client* %0) {
%2 = tail call i32 @relay_dogechat_unhook_signals(%struct.t_relay_client* %0)
ret void
}
int threefourths(int x) {
  int xl2 = x & 0x3;
  int xl1 = (x & 1) << 1;
  int x_mask = x >> ((sizeof(int) << 3) - 1);
  int bias = x_mask & 3;
  int incr = (xl2 + xl1 + bias) >> 2;
  int s2 = x >> 2;
  int s1 = x >> 1;
  return s1 + s2 + incr;
}


x86 assembly (clang, -O0):
<threefourths>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x3,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0x3,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
add    -0x1c(%rbp),%eax
add    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<threefourths>:
mov    %edi,%eax
and    $0x3,%eax
mov    %edi,%ecx
and    $0x1,%ecx
mov    %edi,%edx
sar    $0x1f,%edx
and    $0x3,%edx
lea    (%rax,%rcx,2),%ecx
add    %edx,%ecx
shr    $0x2,%ecx
mov    %edi,%eax
sar    $0x2,%eax
sar    %edi
add    %edi,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @threefourths(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %2
%10 = load i32, i32* %2
%11 = and i32 %10, 3
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = and i32 %12, 1
%14 = shl i32 %13, 1
store i32 %14, i32* %4
%15 = load i32, i32* %2
%16 = ashr i32 %15, 31
store i32 %16, i32* %5
%17 = load i32, i32* %5
%18 = and i32 %17, 3
store i32 %18, i32* %6
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = add nsw i32 %19, %20
%22 = load i32, i32* %6
%23 = add nsw i32 %21, %22
%24 = ashr i32 %23, 2
store i32 %24, i32* %7
%25 = load i32, i32* %2
%26 = ashr i32 %25, 2
store i32 %26, i32* %8
%27 = load i32, i32* %2
%28 = ashr i32 %27, 1
store i32 %28, i32* %9
%29 = load i32, i32* %9
%30 = load i32, i32* %8
%31 = add nsw i32 %29, %30
%32 = load i32, i32* %7
%33 = add nsw i32 %31, %32
ret i32 %33
}

LLVM IR (-O2):
define i32 @threefourths(i32 %0) {
%2 = and i32 %0, 3
%3 = shl i32 %0, 1
%4 = and i32 %3, 2
%5 = icmp slt i32 %0, 0
%6 = select i1 %5, i32 3, i32 0
%7 = add nuw nsw i32 %4, %2
%8 = add nuw nsw i32 %7, %6
%9 = lshr i32 %8, 2
%10 = ashr i32 %0, 2
%11 = ashr i32 %0, 1
%12 = add nsw i32 %11, %10
%13 = add nsw i32 %12, %9
ret i32 %13
}
int pathcon_nm3_f0(const double **arg, double **res, int *iw, double *w,
                   int mem) {
  return 0;
}


x86 assembly (clang, -O0):
<pathcon_nm3_f0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @pathcon_nm3_f0(double** nocapture readnone %0, double** nocapture readnone %1, i32* nocapture readnone %2, double* nocapture readnone %3, i32 %4) {
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t HibernateRTCSSMatchGet(uint32_t ui32Match) {
  ;
  return ((*((volatile uint32_t *)(0x400FC028))) >> 16);
}


x86 assembly (clang, -O0):
<HibernateRTCSSMatchGet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x400fc028,%eax
mov    (%rax),%eax
sar    $0x10,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<HibernateRTCSSMatchGet>:
mov    0x400fc028,%eax
sar    $0x10,%eax
ret

LLVM IR (-O0):
define i32 @HibernateRTCSSMatchGet(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load volatile i32, i32* inttoptr (i64 1074774056 to i32*)
%4 = ashr i32 %3, 16
ret i32 %4
}

LLVM IR (-O2):
define i32 @HibernateRTCSSMatchGet(i32 %0) {
%2 = load volatile i32, i32* inttoptr (i64 1074774056 to i32*)
%3 = ashr i32 %2, 16
ret i32 %3
}
/* Variables and functions */
int rand();
int overNineThousand(void) { return (rand() % 1000) + 9001; }


x86 assembly (clang, -O0):
<overNineThousand>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x2329,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<overNineThousand>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x2329,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @overNineThousand() {
%1 = call i32 (...) @rand()
%2 = srem i32 %1, 1000
%3 = add nsw i32 %2, 9001
ret i32 %3
}

LLVM IR (-O2):
define i32 @overNineThousand() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 1000
%3 = add nsw i32 %2, 9001
ret i32 %3
}
int put_out(c)
int c;
{ return putchar(c); }


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

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

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

LLVM IR (-O2):
define i32 @put_out(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %0)
ret i32 %2
}
void ia_ndelete(void *v) { return; }


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

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

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

LLVM IR (-O2):
define void @ia_ndelete(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ exit(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int openFile(char *file) {
  int r = open(file, O_RDONLY);
  if (r <= 0) {
    perror(file);
    exit(1);
  }
  return r;
}


x86 assembly (clang, -O0):
<openFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     116e <openFile+0x3e>
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openFile>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
test   %eax,%eax
jle    1148 <openFile+0x18>
pop    %rbx
ret
mov    %rbx,%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@O_RDONLY = global i32 0
define i32 @openFile(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i32, i32* @O_RDONLY
%6 = call i32 @open(i8* %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i32 @perror(i8* %10)
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %1
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
define i32 @openFile(i8* nocapture %0) {
%2 = load i32, i32* @O_RDONLY
%3 = tail call i32 @open(i8* %0, i32 %2)
%4 = icmp slt i32 %3, 1
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = tail call i32 @perror(i8* %0)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i32 %3
}