xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_eval(int);
scalar_t__ strcasecmp(char *, char *);
void strcasecmp_constant0() {
  clang_analyzer_eval(strcasecmp("abc", "Abc") == 0);
}


x86 assembly (clang, -O0):
<strcasecmp_constant0>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xed2(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcasecmp_constant0>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed5(%rip),%rsi
call   1030 <strcasecmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
pop    %rax
jmp    1040 <clang_analyzer_eval@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
@.str.1 = [4 x i8] c"Abc\00"
define void @strcasecmp_constant0() {
%1 = call i64 @strcasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @clang_analyzer_eval(i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
@.str.1 = [4 x i8] c"Abc\00"
define void @strcasecmp_constant0() {
%1 = tail call i64 @strcasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @clang_analyzer_eval(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ time_usleep(int);
void thread_a(void *arg) {
  printf("starting thread A\n");
  while (1) {
    printf("A, sleep...");
    time_usleep(30000);
    printf("wakeup !\n");
  }
}


x86 assembly (clang, -O0):
<thread_a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
mov    $0x7530,%edi
call   1040 <time_usleep@plt>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
jmp    1138 <thread_a+0x18>

x86 assembly (clang, -O2):
<thread_a>:
push   %r14
push   %rbx
push   %rax
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%r14
lea    0xed0(%rip),%rbx
xchg   %ax,%ax
mov    %r14,%rdi
call   1040 <printf@plt>
mov    $0x7530,%edi
call   1050 <time_usleep@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
jmp    1150 <thread_a+0x20>

LLVM IR (-O0):
@.str = [19 x i8] c"starting thread A\0A\00"
@.str.1 = [12 x i8] c"A, sleep...\00"
@.str.2 = [10 x i8] c"wakeup !\0A\00"
define void @thread_a(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %1, %4
%5 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @time_usleep(i32 30000)
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %4
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"A, sleep...\00"
@str = [18 x i8] c"starting thread A\00"
@str.3 = [9 x i8] c"wakeup !\00"
define void @thread_a(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %3
3: ; preds = %1, %3
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @time_usleep(i32 30000)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.3, i64 0, i64 0))
br label %3
}
int fun1339() { return 1339; }


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

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

LLVM IR (-O0):
define i32 @fun1339() {
ret i32 1339
}

LLVM IR (-O2):
define i32 @fun1339() {
ret i32 1339
}
/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ errno;
int _kill(int pid, int sig) {
  (void)(pid);
  (void)(sig);
  errno = EINVAL;
  return -1;
}


x86 assembly (clang, -O0):
<_kill>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ec7(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec6(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_kill>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
@errno = global i32 0
define i32 @_kill(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = load i32, i32* @EINVAL
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@EINVAL = global i32 0
@errno = global i32 0
define i32 @_kill(i32 %0, i32 %1) {
%3 = load i32, i32* @EINVAL
store i32 %3, i32* @errno
ret i32 -1
}
void SHA384_Final(void) {}


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

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

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

LLVM IR (-O2):
define void @SHA384_Final() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mtspr(int, unsigned int);
void cpu_perf_conf_events(unsigned int eventMask) {
  mtspr(((7 << (11)) + 32), eventMask);
}


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

x86 assembly (clang, -O2):
<cpu_perf_conf_events>:
mov    %edi,%esi
mov    $0x3820,%edi
jmp    1030 <mtspr@plt>

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

LLVM IR (-O2):
define void @cpu_perf_conf_events(i32 %0) {
%2 = tail call i32 @mtspr(i32 14368, i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ *wcsncpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, size_t);
wchar_t *Loopr_wcsncpy(wchar_t *dest, wchar_t *src, size_t n) {
  return wcsncpy(dest, src, n);
}


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

x86 assembly (clang, -O2):
<Loopr_wcsncpy>:
jmp    1030 <wcsncpy@plt>

LLVM IR (-O0):
define i32* @Loopr_wcsncpy(i32* %0, i32* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64
store i32* %0, i32** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
%7 = load i32*, i32** %4
%8 = load i32*, i32** %5
%9 = load i64, i64* %6
%10 = call i32* @wcsncpy(i32* %7, i32* %8, i64 %9)
ret i32* %10
}

LLVM IR (-O2):
define i32* @Loopr_wcsncpy(i32* %0, i32* %1, i64 %2) {
%4 = tail call i32* @wcsncpy(i32* %0, i32* %1, i64 %2)
ret i32* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void print_zero(char *str, int n) {
  char *tmp;
  tmp = str;
  while (n--) {
    printf("%c", *tmp);
    tmp++;
  }
}


x86 assembly (clang, -O0):
<print_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     115f <print_zero+0x4f>
mov    -0x18(%rbp),%rax
lea    0xeba(%rip),%rdi
movsbl (%rax),%esi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1127 <print_zero+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_zero>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
je     1146 <print_zero+0x36>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %ebx,%r12d
jne    1130 <print_zero+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @print_zero(i8* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2, %4
%5 = phi i8* [ %10, %4 ], [ %0, %2 ]
%6 = phi i32 [ %7, %4 ], [ %1, %2 ]
%7 = add nsw i32 %6, -1
%8 = load i8, i8* %5
%9 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %8)
%10 = getelementptr inbounds i8, i8* %5, i64 1
%11 = icmp eq i32 %7, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %2
ret void
}
int b64url_validc(char c) {
  if (!((c >= '0') && (c <= '9')) && !((c >= 'A') && (c <= 'Z')) &&
      !((c >= 'a') && (c <= 'z')) && !(c == '_') && !(c == '-')) {
    return (0);
  }
  return (1);
}


x86 assembly (clang, -O0):
<b64url_validc>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1124 <b64url_validc+0x24>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jle    117e <b64url_validc+0x7e>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     113e <b64url_validc+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jle    117e <b64url_validc+0x7e>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1158 <b64url_validc+0x58>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jle    117e <b64url_validc+0x7e>
movsbl -0x5(%rbp),%eax
cmp    $0x5f,%eax
je     117e <b64url_validc+0x7e>
movsbl -0x5(%rbp),%eax
cmp    $0x2d,%eax
je     117e <b64url_validc+0x7e>
movl   $0x0,-0x4(%rbp)
jmp    1185 <b64url_validc+0x85>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<b64url_validc>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
setb   %al
mov    %edi,%ecx
and    $0xdf,%cl
add    $0xbf,%cl
cmp    $0x1a,%cl
setb   %cl
or     %al,%cl
cmp    $0x5f,%dil
sete   %al
cmp    $0x2d,%dil
sete   %dl
or     %al,%dl
or     %cl,%dl
movzbl %dl,%eax
ret

LLVM IR (-O0):
define i32 @b64url_validc(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %36, label %11
11: ; preds = %7, %1
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp sge i32 %13, 65
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp sle i32 %17, 90
br i1 %18, label %36, label %19
19: ; preds = %15, %11
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = icmp sge i32 %21, 97
br i1 %22, label %23, label %27
23: ; preds = %19
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = icmp sle i32 %25, 122
br i1 %26, label %36, label %27
27: ; preds = %23, %19
%28 = load i8, i8* %3
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 95
br i1 %30, label %36, label %31
31: ; preds = %27
%32 = load i8, i8* %3
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 45
br i1 %34, label %36, label %35
35: ; preds = %31
store i32 0, i32* %2
br label %37
36: ; preds = %31, %27, %23, %15, %7
store i32 1, i32* %2
br label %37
37: ; preds = %36, %35
%38 = load i32, i32* %2
ret i32 %38
}

LLVM IR (-O2):
define i32 @b64url_validc(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = and i8 %0, -33
%5 = add i8 %4, -65
%6 = icmp ult i8 %5, 26
%7 = or i1 %3, %6
%8 = icmp eq i8 %0, 95
%9 = icmp eq i8 %0, 45
%10 = or i1 %8, %9
%11 = or i1 %10, %7
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isgraph(int);
void t_isgraph_0x37() {
  Assert_real((isgraph(55)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isgraph.c",
              280, ("isgraph should be 1 for 7"));
}


x86 assembly (clang, -O0):
<t_isgraph_0x37>:
push   %rbp
mov    %rsp,%rbp
mov    $0x37,%edi
call   1040 <isgraph@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x118,%edx
lea    0xf65(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isgraph_0x37>:
push   %rax
mov    $0x37,%edi
call   1040 <isgraph@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x118,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for 7\00"
define void @t_isgraph_0x37() {
%1 = call i32 @isgraph(i32 55)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 280, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [26 x i8] c"isgraph should be 1 for 7\00"
define void @t_isgraph_0x37() {
%1 = tail call i32 @isgraph(i32 55)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 280, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct notifier_block {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wdt977_stop();
int wdt977_notify_sys(struct notifier_block *this, unsigned long code,
                      void *unused) {
  {
    if (code == 1UL) {
      wdt977_stop();
    } else if (code == 2UL) {
      wdt977_stop();
    }
    return (0);
  }
}


x86 assembly (clang, -O0):
<wdt977_notify_sys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x1,-0x10(%rbp)
jne    113b <wdt977_notify_sys+0x2b>
mov    $0x0,%al
call   1030 <wdt977_stop@plt>
jmp    1152 <wdt977_notify_sys+0x42>
cmpq   $0x2,-0x10(%rbp)
jne    114d <wdt977_notify_sys+0x3d>
mov    $0x0,%al
call   1030 <wdt977_stop@plt>
jmp    1152 <wdt977_notify_sys+0x42>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wdt977_notify_sys>:
add    $0xffffffffffffffff,%rsi
cmp    $0x1,%rsi
ja     1126 <wdt977_notify_sys+0x16>
push   %rax
xor    %eax,%eax
call   1030 <wdt977_stop@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

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

LLVM IR (-O2):
%struct.notifier_block = type { i32 }
define i32 @wdt977_notify_sys(%struct.notifier_block* nocapture readnone %0, i64 %1, i8* nocapture readnone %2) {
%4 = add i64 %1, -1
%5 = icmp ult i64 %4, 2
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (...) @wdt977_stop()
br label %8
8: ; preds = %3, %6
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int x = 1, y = 0;
_L:
  if (x && ++y > 1) {
    printf("Error %d\n", (int)1);
    exit(1);
  } else
  lbl:;
  {
    printf("Success\n");
    exit(0);
  };
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1176 <main+0x56>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmp    $0x1,%eax
jle    1176 <main+0x56>
lea    0xea0(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
jmp    117b <main+0x5b>
jmp    1180 <main+0x60>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@str = [8 x i8] c"Success\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
int strlen(char *);
void my_strncat(char *dest, char *src, int dest_len) {
  int len;
  len = strlen(dest);
  dest_len -= len + 1;
  if (dest_len > 0)
    memcpy(dest + len, src, dest_len * sizeof *src);
}


x86 assembly (clang, -O0):
<my_strncat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1175 <my_strncat+0x55>
mov    -0x8(%rbp),%rdi
movslq -0x18(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edx
call   1040 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strncat>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%edx
not    %edx
add    %ebp,%edx
test   %edx,%edx
jle    114f <my_strncat+0x2f>
cltq
add    %rax,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <memcpy@plt>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @my_strncat(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %7
%10 = load i32, i32* %7
%11 = add nsw i32 %10, 1
%12 = load i32, i32* %6
%13 = sub nsw i32 %12, %11
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %27
16: ; preds = %3
%17 = load i8*, i8** %4
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8*, i8** %5
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = mul i64 %23, 1
%25 = trunc i64 %24 to i32
%26 = call i32 @memcpy(i8* %20, i8* %21, i32 %25)
br label %27
27: ; preds = %16, %3
ret void
}

LLVM IR (-O2):
define void @my_strncat(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = xor i32 %4, -1
%6 = add i32 %5, %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = sext i32 %4 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = tail call i32 @memcpy(i8* %10, i8* %1, i32 %6)
br label %12
12: ; preds = %8, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/
__softboundmpx_propagate_metadata_shadow_stack_from(int, int /*<<< orphan*/);
char *mkdtemp(char *);
__attribute__((__weak__, __always___)) char *
softboundmpx_mkdtemp(char *template) {
  char *ret_ptr = mkdtemp(template);
  __softboundmpx_propagate_metadata_shadow_stack_from(1, 0);
  return ret_ptr;
}


x86 assembly (clang, -O0):
<softboundmpx_mkdtemp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <mkdtemp@plt>
mov    %rax,-0x10(%rbp)
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <__softboundmpx_propagate_metadata_shadow_stack_from@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<softboundmpx_mkdtemp>:
push   %rbx
call   1040 <mkdtemp@plt>
mov    %rax,%rbx
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <__softboundmpx_propagate_metadata_shadow_stack_from@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define weak i8* @softboundmpx_mkdtemp(i8* %0) {
%2 = tail call i8* @mkdtemp(i8* %0)
%3 = tail call i32 @__softboundmpx_propagate_metadata_shadow_stack_from(i32 1, i32 0)
ret i8* %2
}
/* Type definitions */
struct ether_header {
  int /*<<< orphan*/ ether_type;
};

/* Variables and functions */
int htons(int /*<<< orphan*/);
int inet_is_ipv6(void *data) {
  struct ether_header *hd;
  hd = data;
  if (htons(hd->ether_type) == 0x86DD) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<inet_is_ipv6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1030 <htons@plt>
cmp    $0x86dd,%eax
jne    1146 <inet_is_ipv6+0x36>
movl   $0x1,-0x4(%rbp)
jmp    114d <inet_is_ipv6+0x3d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inet_is_ipv6>:
push   %rax
mov    (%rdi),%edi
call   1030 <htons@plt>
xor    %ecx,%ecx
cmp    $0x86dd,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.ether_header = type { i32 }
define i32 @inet_is_ipv6(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.ether_header*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to %struct.ether_header*
store %struct.ether_header* %6, %struct.ether_header** %4
%7 = load %struct.ether_header*, %struct.ether_header** %4
%8 = getelementptr inbounds %struct.ether_header, %struct.ether_header* %7, i32 0, i32 0
%9 = load i32, i32* %8
%10 = call i32 @htons(i32 %9)
%11 = icmp eq i32 %10, 34525
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 1, i32* %2
br label %14
13: ; preds = %1
store i32 0, i32* %2
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @inet_is_ipv6(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @htons(i32 %3)
%5 = icmp eq i32 %4, 34525
%6 = zext i1 %5 to i32
ret i32 %6
}
int apccmp(p1, p2) void *p1, *p2;
{ return (strcmp(*(char **)p1, *(char **)p2)); }


x86 assembly (clang, -O0):
<apccmp>:
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 <strcmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @apccmp(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 @strcmp(i8* %7, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @apccmp(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 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
/* Variables and functions */
scalar_t__ erfc(double);
int /*<<< orphan*/ link_failure_erfc();
void test_erfc(double d) {
  if (erfc(d) != erfc(d))
    link_failure_erfc();
}


x86 assembly (clang, -O0):
<test_erfc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <erfc@plt>
mov    %rax,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <erfc@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     115c <test_erfc+0x3c>
mov    $0x0,%al
call   1030 <link_failure_erfc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_erfc>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
call   1040 <erfc@plt>
mov    %rax,%rbx
movsd  0x8(%rsp),%xmm0
call   1040 <erfc@plt>
cmp    %rax,%rbx
jne    1149 <test_erfc+0x29>
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1030 <link_failure_erfc@plt>

LLVM IR (-O0):
define void @test_erfc(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @erfc(double %3)
%5 = load double, double* %2
%6 = call i64 @erfc(double %5)
%7 = icmp ne i64 %4, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @link_failure_erfc()
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
define void @test_erfc(double %0) {
%2 = tail call i64 @erfc(double %0)
%3 = tail call i64 @erfc(double %0)
%4 = icmp eq i64 %2, %3
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @link_failure_erfc()
br label %7
7: ; preds = %5, %1
ret void
}
/* Variables and functions */
char *l_saveTopologies(char *, int /*<<< orphan*/);
char *macsaveTopologies(char *arg) { return l_saveTopologies(arg, 0); }


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

x86 assembly (clang, -O2):
<macsaveTopologies>:
xor    %esi,%esi
jmp    1030 <l_saveTopologies@plt>

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

LLVM IR (-O2):
define i8* @macsaveTopologies(i8* %0) {
%2 = tail call i8* @l_saveTopologies(i8* %0, i32 0)
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void mumble_cryptsetup_callback(uint32_t key_size, uint8_t *key,
                                uint32_t client_nonce_size,
                                uint8_t *client_nonce,
                                uint32_t server_nonce_size,
                                uint8_t *server_nonce, void *user_data) {
  printf("cryptsetup_callback\n");
}


x86 assembly (clang, -O0):
<mumble_cryptsetup_callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@str = [20 x i8] c"cryptsetup_callback\00"
define void @mumble_cryptsetup_callback(i32 %0, i32* nocapture readnone %1, i32 %2, i32* nocapture readnone %3, i32 %4, i32* nocapture readnone %5, i8* nocapture readnone %6) {
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void winchange(int sig) { printf("windows changed \n"); }


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

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

LLVM IR (-O0):
@.str = [18 x i8] c"windows changed \0A\00"
define void @winchange(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [17 x i8] c"windows changed \00"
define void @winchange(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ EVP_CIPHER;

/* Variables and functions */
const EVP_CIPHER *EVP_chacha20_poly1305(void) { return NULL; }


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

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

LLVM IR (-O0):
define i32* @EVP_chacha20_poly1305() {
ret i32* null
}

LLVM IR (-O2):
define noalias i32* @EVP_chacha20_poly1305() {
ret i32* null
}
/* Type definitions */
struct rcps_alternative {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct rcps_alternative *);
void rcps_alternative_free(struct rcps_alternative *a) { free(a); }


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

x86 assembly (clang, -O2):
<rcps_alternative_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.rcps_alternative = type { i32 }
define void @rcps_alternative_free(%struct.rcps_alternative* nocapture %0) {
%2 = tail call i32 @free(%struct.rcps_alternative* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ error(char *, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int read(int, char *, int);
int server_read(int fd, char *buffer, int bufferSize) {
  int n;
  memset(buffer, 0, bufferSize);
  n = read(fd, buffer, bufferSize - 1);
  if (n < 0) {
    error("ERROR: reading from socket", true);
  }
  return n;
}


x86 assembly (clang, -O0):
<server_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <read@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1180 <server_read+0x50>
lea    0xe8a(%rip),%rdi
mov    $0x1,%esi
call   1050 <error@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<server_read>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %rsi,%r14
mov    %edi,%ebp
mov    %rsi,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
add    $0xffffffff,%ebx
mov    %ebp,%edi
mov    %r14,%rsi
mov    %ebx,%edx
call   1040 <read@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    116b <server_read+0x3b>
lea    0xe9f(%rip),%rdi
mov    $0x1,%esi
call   1050 <error@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"ERROR: reading from socket\00"
define i32 @server_read(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @memset(i8* %8, i32 0, i32 %9)
%11 = load i32, i32* %4
%12 = load i8*, i8** %5
%13 = load i32, i32* %6
%14 = sub nsw i32 %13, 1
%15 = call i32 @read(i32 %11, i8* %12, i32 %14)
store i32 %15, i32* %7
%16 = load i32, i32* %7
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %3
%19 = call i32 @error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 1)
br label %20
20: ; preds = %18, %3
%21 = load i32, i32* %7
ret i32 %21
}

LLVM IR (-O2):
@.str = [27 x i8] c"ERROR: reading from socket\00"
define i32 @server_read(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @memset(i8* %1, i32 0, i32 %2)
%5 = add nsw i32 %2, -1
%6 = tail call i32 @read(i32 %0, i8* %1, i32 %5)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = tail call i32 @error(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 1)
br label %10
10: ; preds = %8, %3
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ WriteInstruction(char *);
void CR_Kill(void) {
  WriteInstruction("ld hl,deadf");
  WriteInstruction("ld (hl),h");
}


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"ld hl,deadf\00"
@.str.1 = [10 x i8] c"ld (hl),h\00"
define void @CR_Kill() {
%1 = call i32 @WriteInstruction(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @WriteInstruction(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"ld hl,deadf\00"
@.str.1 = [10 x i8] c"ld (hl),h\00"
define void @CR_Kill() {
%1 = tail call i32 @WriteInstruction(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @WriteInstruction(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef long off_t;

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
long lseek(int, long, int /*<<< orphan*/);
off_t fsize(int fd) {
  off_t prev, sz;
  prev = lseek(fd, 0L, SEEK_CUR);
  sz = lseek(fd, 0L, SEEK_END);
  lseek(fd, prev, SEEK_SET);
  return sz;
}


x86 assembly (clang, -O0):
<fsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1030 <lseek@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eaa(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1030 <lseek@plt>
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    0x2e75(%rip),%rax
mov    (%rax),%edx
call   1030 <lseek@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsize>:
push   %r15
push   %r14
push   %rbx
mov    %edi,%ebx
mov    0x2ec2(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %rax,%r14
mov    0x2eb7(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %rax,%r15
mov    0x2e8a(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14,%rsi
call   1030 <lseek@plt>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@SEEK_CUR = global i32 0
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i64 @fsize(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* @SEEK_CUR
%7 = call i64 @lseek(i32 %5, i64 0, i32 %6)
store i64 %7, i64* %3
%8 = load i32, i32* %2
%9 = load i32, i32* @SEEK_END
%10 = call i64 @lseek(i32 %8, i64 0, i32 %9)
store i64 %10, i64* %4
%11 = load i32, i32* %2
%12 = load i64, i64* %3
%13 = load i32, i32* @SEEK_SET
%14 = call i64 @lseek(i32 %11, i64 %12, i32 %13)
%15 = load i64, i64* %4
ret i64 %15
}

LLVM IR (-O2):
@SEEK_CUR = global i32 0
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i64 @fsize(i32 %0) {
%2 = load i32, i32* @SEEK_CUR
%3 = tail call i64 @lseek(i32 %0, i64 0, i32 %2)
%4 = load i32, i32* @SEEK_END
%5 = tail call i64 @lseek(i32 %0, i64 0, i32 %4)
%6 = load i32, i32* @SEEK_SET
%7 = tail call i64 @lseek(i32 %0, i64 %3, i32 %6)
ret i64 %5
}
/* Variables and functions */
int return_int();
int use_return_int() { return return_int(); }


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

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

LLVM IR (-O0):
define i32 @use_return_int() {
%1 = call i32 (...) @return_int()
ret i32 %1
}

LLVM IR (-O2):
define i32 @use_return_int() {
%1 = tail call i32 (...) @return_int()
ret i32 %1
}
void add3d(double *v1, double *v2, double *v3) {
  v3[0] = v1[0] + v2[0];
  v3[1] = v1[1] + v2[1];
  v3[2] = v1[2] + v2[2];
}


x86 assembly (clang, -O0):
<add3d>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
addsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
addsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<add3d>:
movsd  (%rdi),%xmm0
addsd  (%rsi),%xmm0
movsd  %xmm0,(%rdx)
movsd  0x8(%rdi),%xmm0
addsd  0x8(%rsi),%xmm0
movsd  %xmm0,0x8(%rdx)
movsd  0x10(%rdi),%xmm0
addsd  0x10(%rsi),%xmm0
movsd  %xmm0,0x10(%rdx)
ret

LLVM IR (-O0):
define void @add3d(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%7 = load double*, double** %4
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = load double*, double** %5
%11 = getelementptr inbounds double, double* %10, i64 0
%12 = load double, double* %11
%13 = fadd double %9, %12
%14 = load double*, double** %6
%15 = getelementptr inbounds double, double* %14, i64 0
store double %13, double* %15
%16 = load double*, double** %4
%17 = getelementptr inbounds double, double* %16, i64 1
%18 = load double, double* %17
%19 = load double*, double** %5
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = fadd double %18, %21
%23 = load double*, double** %6
%24 = getelementptr inbounds double, double* %23, i64 1
store double %22, double* %24
%25 = load double*, double** %4
%26 = getelementptr inbounds double, double* %25, i64 2
%27 = load double, double* %26
%28 = load double*, double** %5
%29 = getelementptr inbounds double, double* %28, i64 2
%30 = load double, double* %29
%31 = fadd double %27, %30
%32 = load double*, double** %6
%33 = getelementptr inbounds double, double* %32, i64 2
store double %31, double* %33
ret void
}

LLVM IR (-O2):
define void @add3d(double* nocapture %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = load double, double* %0
%5 = load double, double* %1
%6 = fadd double %4, %5
store double %6, double* %2
%7 = getelementptr inbounds double, double* %0, i64 1
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %1, i64 1
%10 = load double, double* %9
%11 = fadd double %8, %10
%12 = getelementptr inbounds double, double* %2, i64 1
store double %11, double* %12
%13 = getelementptr inbounds double, double* %0, i64 2
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %1, i64 2
%16 = load double, double* %15
%17 = fadd double %14, %16
%18 = getelementptr inbounds double, double* %2, i64 2
store double %17, double* %18
ret void
}
/* Variables and functions */
int bar(int);
int bam(int a) { return a - bar(a); }


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

x86 assembly (clang, -O2):
<bam>:
push   %rbx
mov    %edi,%ebx
call   1030 <bar@plt>
sub    %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @bam(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @bar(i32 %4)
%6 = sub nsw i32 %3, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @bam(i32 %0) {
%2 = tail call i32 @bar(i32 %0)
%3 = sub nsw i32 %0, %2
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ getstr(char **, size_t *, int /*<<< orphan*/ *, int,
                          int /*<<< orphan*/, int /*<<< orphan*/);
ssize_t getdelim(char **lineptr, size_t *n, int delimiter, FILE *stream) {
  return getstr(lineptr, n, stream, delimiter, 0, 0);
}


x86 assembly (clang, -O0):
<getdelim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x14(%rbp),%ecx
xor    %r9d,%r9d
mov    %r9d,%r8d
call   1030 <getstr@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getdelim>:
mov    %edx,%eax
mov    %rcx,%rdx
mov    %eax,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
jmp    1030 <getstr@plt>

LLVM IR (-O0):
define i32 @getdelim(i8** %0, i64* %1, i32 %2, i32* %3) {
%5 = alloca i8**
%6 = alloca i64*
%7 = alloca i32
%8 = alloca i32*
store i8** %0, i8*** %5
store i64* %1, i64** %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%9 = load i8**, i8*** %5
%10 = load i64*, i64** %6
%11 = load i32*, i32** %8
%12 = load i32, i32* %7
%13 = call i32 @getstr(i8** %9, i64* %10, i32* %11, i32 %12, i32 0, i32 0)
ret i32 %13
}

LLVM IR (-O2):
define i32 @getdelim(i8** %0, i64* %1, i32 %2, i32* %3) {
%5 = tail call i32 @getstr(i8** %0, i64* %1, i32* %3, i32 %2, i32 0, i32 0)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ kprintf(char *, int);
void isrHandle33() { kprintf("ISR %d.\n", 33); }


x86 assembly (clang, -O0):
<isrHandle33>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x21,%esi
call   1030 <kprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<isrHandle33>:
lea    0xee9(%rip),%rdi
mov    $0x21,%esi
jmp    1030 <kprintf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"ISR %d.\0A\00"
define void @isrHandle33() {
%1 = call i32 @kprintf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 33)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"ISR %d.\0A\00"
define void @isrHandle33() {
%1 = tail call i32 @kprintf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 33)
ret void
}
/* Variables and functions */
int PAPI_thread_init(unsigned long (*)());
void papif_thread_init_(unsigned long int (*handle)(void), int *check) {
  *check = PAPI_thread_init(handle);
}


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

x86 assembly (clang, -O2):
<papif_thread_init_>:
push   %rbx
mov    %rsi,%rbx
call   1030 <PAPI_thread_init@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @papif_thread_init_(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 = bitcast i64 ()* %5 to i64 (...)*
%7 = call i32 @PAPI_thread_init(i64 (...)* %6)
%8 = load i32*, i32** %4
store i32 %7, i32* %8
ret void
}

LLVM IR (-O2):
define void @papif_thread_init_(i64 ()* %0, i32* nocapture writeonly %1) {
%3 = bitcast i64 ()* %0 to i64 (...)*
%4 = tail call i32 @PAPI_thread_init(i64 (...)* %3)
store i32 %4, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printDasheschar(unsigned n) {
  for (unsigned i = 0; i < n; ++i) {
    printf("-");
  }
}


x86 assembly (clang, -O0):
<printDasheschar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    1148 <printDasheschar+0x38>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <printDasheschar+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printDasheschar>:
push   %rbx
test   %edi,%edi
je     112f <printDasheschar+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x2d,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <printDasheschar+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
define void @printDasheschar(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %10, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp ult i32 %5, %6
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8
%11 = load i32, i32* %3
%12 = add i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @printDasheschar(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %4
3: ; preds = %4, %1
ret void
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = tail call i32 @putchar(i32 45)
%7 = add nuw i32 %5, 1
%8 = icmp eq i32 %7, %0
br i1 %8, label %3, label %4
}