xunge/DecIR huggingface dataset:
int key_cmp(const void *x1, const void *x2) {
  int key1 = *(const int *)x1;
  int key2 = *(const int *)x2;
  if (key1 < key2) {
    return -1;
  } else if (key1 > key2) {
    return +1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<key_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1136 <key_cmp+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    1155 <key_cmp+0x55>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    114e <key_cmp+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    1155 <key_cmp+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<key_cmp>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @key_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp slt i32 %4, %6
%8 = icmp sgt i32 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "Usage: peep [-lpw] tty\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Usage: peep [-lpw] tty\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Usage: peep [-lpw] tty\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
char *malloc(size_t);
char *strcpy(char *, char const *);
int strlen(char const *);
char *strdup(const char *string) {
  int length;
  char *new_string;
  length = strlen(string);
  new_string = malloc((size_t)length + 1);
  if (new_string == NULL) {
    return NULL;
  }
  return strcpy(new_string, string);
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1171 <strdup+0x41>
movq   $0x0,-0x8(%rbp)
jmp    1182 <strdup+0x52>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
movslq %eax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     115b <strdup+0x2b>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = sext i32 %2 to i64
%4 = add nsw i64 %3, 1
%5 = tail call i8* @malloc(i64 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i8* @strcpy(i8* %5, i8* dereferenceable(1) %0)
br label %9
9: ; preds = %1, %7
ret i8* %5
}
__attribute__((no)) int f2(char *p) {
  int result = 0;
  result += __builtin_memcmp(p, "a", 3);
  return result;
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed2(%rip),%rsi
mov    $0x3,%edx
call   1030 <memcmp@plt>
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
movzwl (%rdi),%eax
rol    $0x8,%ax
movzwl %ax,%eax
cmp    $0x6100,%eax
jne    1116 <f2+0x16>
movzbl 0x2(%rdi),%eax
ret
setae  %al
movzbl %al,%eax
add    %eax,%eax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
define i32 @f2(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = call i32 @memcmp(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64 3)
%6 = load i32, i32* %3
%7 = add nsw i32 %6, %5
store i32 %7, i32* %3
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
define i32 @f2(i8* nocapture %0) {
%2 = tail call i32 @memcmp(i8* dereferenceable(3) %0, i8* dereferenceable(3) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i64 3)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char *, char *);
void strcmp_null_1() {
  char *x = "123";
  char *y = 0;
  strcmp(x, y);
}


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

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

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

LLVM IR (-O2):
define void @strcmp_null_1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int printInfo(const char *exePath) {
  printf(
      "Inserire almeno un comando, nel formato:	       \n%s [-P <port>] "
      "mydb://<address>/<identifier>/<command>/<arg>{<optarg>} ...\n",
      exePath);
  return 502;
}


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

x86 assembly (clang, -O2):
<printInfo>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1f6,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [125 x i8] c"Inserire almeno un comando, nel formato:\09 \0A%s [-P <port>] mydb://<address>/<identifier>/<command>/<arg>{<optarg>} ...\0A\00"
define i32 @printInfo(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([125 x i8], [125 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 502
}

LLVM IR (-O2):
@.str = [125 x i8] c"Inserire almeno un comando, nel formato:\09 \0A%s [-P <port>] mydb://<address>/<identifier>/<command>/<arg>{<optarg>} ...\0A\00"
define i32 @printInfo(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([125 x i8], [125 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 502
}
/* Variables and functions */
scalar_t__ isalpha(char const);
int is_purely_alphabetic(const char *pattern) {
  size_t i;
  for (i = 0; isalpha(pattern[i]); ++i)
    continue;
  return (pattern[i] == '\0');
}


x86 assembly (clang, -O0):
<is_purely_alphabetic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
je     1155 <is_purely_alphabetic+0x45>
jmp    1144 <is_purely_alphabetic+0x34>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <is_purely_alphabetic+0x14>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_purely_alphabetic>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%rbx),%edi
call   1030 <isalpha@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1120 <is_purely_alphabetic+0x10>
xor    %eax,%eax
cmpb   $0x0,-0x1(%rbx)
sete   %al
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @is_purely_alphabetic(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %8, %2 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = tail call i64 @isalpha(i8 signext %5)
%7 = icmp eq i64 %6, 0
%8 = add i64 %3, 1
br i1 %7, label %9, label %2
9: ; preds = %2
%10 = getelementptr inbounds i8, i8* %0, i64 %3
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
scalar_t__ avail_empty();
int /*<<< orphan*/ busy_wait();
void poll_avail(void) {
  while (avail_empty())
    busy_wait();
}


x86 assembly (clang, -O0):
<poll_avail>:
push   %rbp
mov    %rsp,%rbp
jmp    1129 <poll_avail+0x9>
mov    $0x0,%al
call   1040 <avail_empty@plt>
cmp    $0x0,%rax
je     1146 <poll_avail+0x26>
mov    $0x0,%al
call   1030 <busy_wait@plt>
jmp    1129 <poll_avail+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<poll_avail>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <avail_empty@plt>
test   %rax,%rax
je     1145 <poll_avail+0x25>
xor    %eax,%eax
call   1030 <busy_wait@plt>
jmp    1130 <poll_avail+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @poll_avail() {
br label %1
1: ; preds = %4, %0
%2 = call i64 (...) @avail_empty()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = call i32 (...) @busy_wait()
br label %1
6: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @poll_avail() {
%1 = tail call i64 (...) @avail_empty()
%2 = icmp eq i64 %1, 0
br i1 %2, label %7, label %3
3: ; preds = %0, %3
%4 = tail call i32 (...) @busy_wait()
%5 = tail call i64 (...) @avail_empty()
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %3
7: ; preds = %3, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gpio_free(int);
void smart_gpio_free(int gpio_num) {
  if (gpio_num == -1) {
    return;
  }
  gpio_free(gpio_num);
}


x86 assembly (clang, -O0):
<smart_gpio_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    112a <smart_gpio_free+0x1a>
jmp    1132 <smart_gpio_free+0x22>
mov    -0x4(%rbp),%edi
call   1030 <gpio_free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smart_gpio_free>:
cmp    $0xffffffff,%edi
je     111a <smart_gpio_free+0xa>
jmp    1030 <gpio_free@plt>
ret

LLVM IR (-O0):
define void @smart_gpio_free(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %6
5: ; preds = %1
br label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @gpio_free(i32 %7)
br label %9
9: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
define void @smart_gpio_free(i32 %0) {
%2 = icmp eq i32 %0, -1
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @gpio_free(i32 %0)
br label %5
5: ; preds = %1, %3
ret void
}
/* Variables and functions */
int strlen(char *);
bool input_sanitized(int argc, char **argv) {
  if (argc != 2) {
    return false;
  }
  if (argv[1] == NULL) {
    return false;
  }
  if (strlen(argv[1]) != 4) {
    return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<input_sanitized>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1135 <input_sanitized+0x25>
movl   $0x0,-0x4(%rbp)
jmp    1179 <input_sanitized+0x69>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jne    1150 <input_sanitized+0x40>
movl   $0x0,-0x4(%rbp)
jmp    1179 <input_sanitized+0x69>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <strlen@plt>
cmp    $0x4,%eax
je     1172 <input_sanitized+0x62>
movl   $0x0,-0x4(%rbp)
jmp    1179 <input_sanitized+0x69>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_sanitized>:
push   %rax
xor    %eax,%eax
cmp    $0x2,%edi
jne    1130 <input_sanitized+0x20>
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     1130 <input_sanitized+0x20>
call   1030 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x4,%ecx
sete   %al
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @input_sanitized(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
br i1 %7, label %12, label %8
8: ; preds = %4
%9 = tail call i32 @strlen(i8* %6)
%10 = icmp eq i32 %9, 4
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %8, %4, %2
%13 = phi i32 [ 0, %2 ], [ 0, %4 ], [ %11, %8 ]
ret i32 %13
}
/* Type definitions */
struct pkt {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct pkt *);
void pkt_free(struct pkt *p) { free(p); }


x86 assembly (clang, -O0):
<pkt_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):
<pkt_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.pkt = type { i32 }
define void @pkt_free(%struct.pkt* nocapture %0) {
%2 = tail call i32 @free(%struct.pkt* %0)
ret void
}
int m68k_cannot_store_register(int regno) { return (regno >= 29); }


x86 assembly (clang, -O0):
<m68k_cannot_store_register>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x1d,-0x4(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @m68k_cannot_store_register(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 29
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @m68k_cannot_store_register(i32 %0) {
%2 = icmp sgt i32 %0, 28
%3 = zext i1 %2 to i32
ret i32 %3
}
const char *machine_format_cpu_pct(struct sysinfo *info) {
  (void)info;
  return "todo: linux cpu pct";
}


x86 assembly (clang, -O0):
<machine_format_cpu_pct>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    0xef1(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<machine_format_cpu_pct>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
%struct.sysinfo = type opaque
@.str = [20 x i8] c"todo: linux cpu pct\00"
define i8* @machine_format_cpu_pct(%struct.sysinfo* %0) {
%2 = alloca %struct.sysinfo*
store %struct.sysinfo* %0, %struct.sysinfo** %2
%3 = load %struct.sysinfo*, %struct.sysinfo** %2
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.sysinfo = type opaque
@.str = [20 x i8] c"todo: linux cpu pct\00"
define i8* @machine_format_cpu_pct(%struct.sysinfo* nocapture readnone %0) {
ret i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0)
}
void nseel_asm_uminus(void) {
  __asm__("movl (%eax), %ecx\n"
          "xorl $0x80000000, %ecx\n"
          "movl %esi, %eax\n"
          "movl %ecx, (%esi)\n"
          "addl $4, %esi\n");
}


x86 assembly (clang, -O0):
<nseel_asm_uminus>:
push   %rbp
mov    %rsp,%rbp
mov    (%eax),%ecx
xor    $0x80000000,%ecx
mov    %esi,%eax
mov    %ecx,(%esi)
add    $0x4,%esi
pop    %rbp
ret

x86 assembly (clang, -O2):
<nseel_asm_uminus>:
mov    (%eax),%ecx
xor    $0x80000000,%ecx
mov    %esi,%eax
mov    %ecx,(%esi)
add    $0x4,%esi
ret

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

LLVM IR (-O2):
define void @nseel_asm_uminus() {
tail call void asm sideeffect "movl (%eax), %ecx\0Axorl $$0x80000000, %ecx\0Amovl %esi, %eax\0Amovl %ecx, (%esi)\0Aaddl $$4, %esi\0A", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
int test_02(const char *a) { return __builtin_strlen(a); }


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

x86 assembly (clang, -O2):
<test_02>:
jmp    1030 <strlen@plt>

LLVM IR (-O0):
define i32 @test_02(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strlen(i8* %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @test_02(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
void *clrmem8(void *s) { return __builtin_memset(s + 4000, 0, 700); }


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

x86 assembly (clang, -O2):
<clrmem8>:
add    $0xfa0,%rdi
mov    $0x2bc,%edx
xor    %esi,%esi
jmp    1030 <memset@plt>

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

LLVM IR (-O2):
define i8* @clrmem8(i8* writeonly %0) {
%2 = getelementptr i8, i8* %0, i64 4000
tail call void @llvm.memset.p0i8.i64(i8* align 1 dereferenceable(700) %2, i8 0, i64 700, i1 false)
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int EINVAL;
int pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr) {
  (void)attr;
  (void)stackaddr;
  return EINVAL;
}


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

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

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

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @pthread_attr_getstackaddr(i32* nocapture readnone %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @EINVAL
ret i32 %3
}
/* Variables and functions */
scalar_t__ isupper(int);
int tolower(int c) { return isupper(c) ? c ^ 0x20 : c; }


x86 assembly (clang, -O0):
<tolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isupper@plt>
cmp    $0x0,%rax
je     113b <tolower+0x2b>
mov    -0x4(%rbp),%eax
xor    $0x20,%eax
mov    %eax,-0x8(%rbp)
jmp    1141 <tolower+0x31>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tolower>:
push   %rbx
mov    %edi,%ebx
call   1030 <isupper@plt>
mov    %ebx,%ecx
xor    $0x20,%ecx
test   %rax,%rax
cmove  %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @tolower(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @isupper(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = xor i32 %7, 32
br label %11
9: ; preds = %1
%10 = load i32, i32* %2
br label %11
11: ; preds = %9, %6
%12 = phi i32 [ %8, %6 ], [ %10, %9 ]
ret i32 %12
}

LLVM IR (-O2):
define i32 @tolower(i32 %0) {
%2 = tail call i64 @isupper(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = xor i32 %0, 32
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ kotlinclib_print_char(char);
void kotlinclib_println() { kotlinclib_print_char('\n'); }


x86 assembly (clang, -O0):
<kotlinclib_println>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
call   1030 <kotlinclib_print_char@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kotlinclib_println>:
mov    $0xa,%edi
jmp    1030 <kotlinclib_print_char@plt>

LLVM IR (-O0):
define void @kotlinclib_println() {
%1 = call i32 @kotlinclib_print_char(i8 signext 10)
ret void
}

LLVM IR (-O2):
define void @kotlinclib_println() {
%1 = tail call i32 @kotlinclib_print_char(i8 signext 10)
ret void
}
/* Variables and functions */
char FOLD_FN_CHAR(char);
void fnfold(char *filename) {
  while (*filename) {
    *filename = FOLD_FN_CHAR(*filename);
    filename++;
  }
}


x86 assembly (clang, -O0):
<fnfold>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114e <fnfold+0x3e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <FOLD_FN_CHAR@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <fnfold+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnfold>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1136 <fnfold+0x26>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <FOLD_FN_CHAR@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <fnfold+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @fnfold(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = call signext i8 @FOLD_FN_CHAR(i8 signext %9)
%11 = load i8*, i8** %2
store i8 %10, i8* %11
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %2
br label %3
14: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @fnfold(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call signext i8 @FOLD_FN_CHAR(i8 signext %5)
store i8 %7, i8* %6
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
int AcceptTCPConnection(int);
int /*<<< orphan*/ HandleTCPClient(int);
scalar_t__ getpid();
int /*<<< orphan*/ printf(char *, unsigned int);
void ProcessMain(int servSock) {
  int clntSock;
  for (;;) {
    clntSock = AcceptTCPConnection(servSock);
    printf("with child process: %d\n", (unsigned int)getpid());
    HandleTCPClient(clntSock);
  }
}


x86 assembly (clang, -O0):
<ProcessMain>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <AcceptTCPConnection@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
call   1060 <HandleTCPClient@plt>
jmp    114b <ProcessMain+0xb>

x86 assembly (clang, -O2):
<ProcessMain>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
lea    0xeb3(%rip),%r14
nopl   (%rax)
mov    %ebx,%edi
call   1050 <AcceptTCPConnection@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebp,%edi
call   1060 <HandleTCPClient@plt>
jmp    1150 <ProcessMain+0x10>

LLVM IR (-O0):
@.str = [24 x i8] c"with child process: %d\0A\00"
define void @ProcessMain(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %4, %1
%5 = load i32, i32* %2
%6 = call i32 @AcceptTCPConnection(i32 %5)
store i32 %6, i32* %3
%7 = call i64 (...) @getpid()
%8 = trunc i64 %7 to i32
%9 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %3
%11 = call i32 @HandleTCPClient(i32 %10)
br label %4
}

LLVM IR (-O2):
@.str = [24 x i8] c"with child process: %d\0A\00"
define void @ProcessMain(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @AcceptTCPConnection(i32 %0)
%4 = tail call i64 (...) @getpid()
%5 = trunc i64 %4 to i32
%6 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @HandleTCPClient(i32 %3)
br label %2
}
/* Type definitions */
typedef int /*<<< orphan*/ mbstate_t;

/* Variables and functions */
int mbsinit(const mbstate_t *s) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @mbsinit(i32* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ set_port(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
void io_invert_port(uint8_t port, uint8_t polarity) {
  set_port(port, polarity, 0x02, 0x03);
}


x86 assembly (clang, -O0):
<io_invert_port>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x2,%edx
mov    $0x3,%ecx
call   1030 <set_port@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_invert_port>:
mov    $0x2,%edx
mov    $0x3,%ecx
jmp    1030 <set_port@plt>

LLVM IR (-O0):
define void @io_invert_port(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 = call i32 @set_port(i32 %5, i32 %6, i32 2, i32 3)
ret void
}

LLVM IR (-O2):
define void @io_invert_port(i32 %0, i32 %1) {
%3 = tail call i32 @set_port(i32 %0, i32 %1, i32 2, i32 3)
ret void
}
float CompRadiansToDegrees(float radians) { return radians * 57.2957795f; }


x86 assembly (clang, -O0):
<CompRadiansToDegrees>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xeef(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<CompRadiansToDegrees>:
mulss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @CompRadiansToDegrees(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fmul float %3, 0x404CA5DC20000000
ret float %4
}

LLVM IR (-O2):
define float @CompRadiansToDegrees(float %0) {
%2 = fmul float %0, 0x404CA5DC20000000
ret float %2
}
/* Type definitions */
struct rtattr {
  int dummy;
};
typedef int /*<<< orphan*/ __u32;

/* Variables and functions */
scalar_t__ RTA_DATA(struct rtattr const *);
__u32 rta_getattr_u32(const struct rtattr *rta) {
  return *(__u32 *)RTA_DATA(rta);
}


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

x86 assembly (clang, -O2):
<rta_getattr_u32>:
push   %rax
call   1030 <RTA_DATA@plt>
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.rtattr = type { i32 }
define i32 @rta_getattr_u32(%struct.rtattr* %0) {
%2 = alloca %struct.rtattr*
store %struct.rtattr* %0, %struct.rtattr** %2
%3 = load %struct.rtattr*, %struct.rtattr** %2
%4 = call i64 @RTA_DATA(%struct.rtattr* %3)
%5 = inttoptr i64 %4 to i32*
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
%struct.rtattr = type { i32 }
define i32 @rta_getattr_u32(%struct.rtattr* %0) {
%2 = tail call i64 @RTA_DATA(%struct.rtattr* %0)
%3 = inttoptr i64 %2 to i32*
%4 = load i32, i32* %3
ret i32 %4
}
/* Variables and functions */
scalar_t__ bar();
scalar_t__ blah();
int foo(void) {
  int i, s = 0;
  for (i = 0; i < 2; i++) {
    s += bar();
    s += blah();
  }
  return s;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
jge    1176 <foo+0x56>
mov    $0x0,%al
call   1030 <bar@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <blah@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1136 <foo+0x16>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <bar@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1040 <blah@plt>
mov    %rax,%rbx
add    %r14d,%ebx
xor    %eax,%eax
call   1030 <bar@plt>
mov    %rax,%r14
add    %ebx,%r14d
xor    %eax,%eax
call   1040 <blah@plt>
add    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @foo() {
%1 = tail call i64 (...) @bar()
%2 = trunc i64 %1 to i32
%3 = tail call i64 (...) @blah()
%4 = trunc i64 %3 to i32
%5 = add i32 %2, %4
%6 = tail call i64 (...) @bar()
%7 = trunc i64 %6 to i32
%8 = add i32 %5, %7
%9 = tail call i64 (...) @blah()
%10 = trunc i64 %9 to i32
%11 = add i32 %8, %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ ulixlib_printchar(int);
void printchar(char **str, int c) {
  if (str) {
    **str = c;
    ++(*str);
  } else
    (void)ulixlib_printchar(c);
}


x86 assembly (clang, -O0):
<printchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114b <printchar+0x3b>
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    1153 <printchar+0x43>
mov    -0xc(%rbp),%edi
call   1030 <ulixlib_printchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printchar>:
test   %rdi,%rdi
je     1120 <printchar+0x10>
mov    (%rdi),%rax
mov    %sil,(%rax)
addq   $0x1,(%rdi)
ret
mov    %esi,%edi
jmp    1030 <ulixlib_printchar@plt>

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

LLVM IR (-O2):
define void @printchar(i8** %0, i32 %1) {
%3 = icmp eq i8** %0, null
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = trunc i32 %1 to i8
%6 = load i8*, i8** %0
store i8 %5, i8* %6
%7 = load i8*, i8** %0
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8* %8, i8** %0
br label %11
9: ; preds = %2
%10 = tail call i32 @ulixlib_printchar(i32 %1)
br label %11
11: ; preds = %9, %4
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ n;

/* Variables and functions */
int /*<<< orphan*/ write(int, int *, int);
void source(void) {
  int n;
  for (n = 2;; n++)
    write(1, &n, sizeof(n));
}


x86 assembly (clang, -O0):
<source>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2,-0x4(%rbp)
mov    $0x1,%edi
lea    -0x4(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <source+0xf>

x86 assembly (clang, -O2):
<source>:
push   %rbp
push   %rbx
push   %rax
movl   $0x2,0x4(%rsp)
mov    $0x3,%ebp
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1030 <write@plt>
mov    %ebp,0x4(%rsp)
add    $0x1,%ebp
jmp    1130 <source+0x20>

LLVM IR (-O0):
define void @source() {
%1 = alloca i32
store i32 2, i32* %1
br label %2
2: ; preds = %4, %0
%3 = call i32 @write(i32 1, i32* %1, i32 4)
br label %4
4: ; preds = %2
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 1
store i32 %6, i32* %1
br label %2
}

LLVM IR (-O2):
define void @source() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 2, i32* %1
br label %3
3: ; preds = %3, %0
%4 = phi i32 [ %6, %3 ], [ 2, %0 ]
%5 = call i32 @write(i32 1, i32* %1, i32 4)
%6 = add nuw nsw i32 %4, 1
store i32 %6, i32* %1
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ closelog();
void LOG_Close(void) { closelog(); }


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

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

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

LLVM IR (-O2):
define void @LOG_Close() {
%1 = tail call i32 (...) @closelog()
ret void
}
int cns3xxx_min_mtu(void) { return 64; }


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

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

LLVM IR (-O0):
define i32 @cns3xxx_min_mtu() {
ret i32 64
}

LLVM IR (-O2):
define i32 @cns3xxx_min_mtu() {
ret i32 64
}
int wps_validate_m4_encr(const struct wpabuf *tlvs, int wps2) { return 0; }


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

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

LLVM IR (-O0):
%struct.wpabuf = type opaque
define i32 @wps_validate_m4_encr(%struct.wpabuf* %0, i32 %1) {
%3 = alloca %struct.wpabuf*
%4 = alloca i32
store %struct.wpabuf* %0, %struct.wpabuf** %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
%struct.wpabuf = type opaque
define i32 @wps_validate_m4_encr(%struct.wpabuf* nocapture readnone %0, i32 %1) {
ret i32 0
}
unsigned int s3c6400_get_pll(unsigned long pllval, unsigned long baseclk) {
  unsigned long mdiv, pdiv, sdiv;
  baseclk /= 1000;
  mdiv = (pllval & (0x3ff << 16)) >> 16;
  pdiv = (pllval & (0x3f << 8)) >> 8;
  sdiv = (pllval & (0x03 << 0)) >> 0;
  return (baseclk * (mdiv)) / ((pdiv) << sdiv) * 1000;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
and    $0x3ff0000,%rax
shr    $0x10,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
and    $0x3f00,%rax
shr    $0x8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
and    $0x3,%rax
shr    $0x0,%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
shl    %cl,%rdx
mov    %rdx,%rcx
xor    %edx,%edx
div    %rcx
imul   $0x3e8,%rax,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    %rsi,%rax
shr    $0x3,%rax
movabs $0x20c49ba5e353f7cf,%rcx
9b c4 20
mul    %rcx
mov    %rdi,%rcx
shr    $0x4,%rdx
mov    %ecx,%eax
shr    $0x10,%eax
and    $0x3ff,%eax
imul   %rdx,%rax
mov    %ecx,%esi
shr    $0x8,%esi
and    $0x3f,%esi
and    $0x3,%cl
shl    %cl,%rsi
mov    %rax,%rcx
shr    $0x20,%rcx
je     114c <s3c6400_get_pll+0x4c>
xor    %edx,%edx
div    %rsi
imul   $0x3e8,%eax,%eax
ret
xor    %edx,%edx
div    %esi
imul   $0x3e8,%eax,%eax
ret

LLVM IR (-O0):
define i32 @s3c6400_get_pll(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%8 = load i64, i64* %4
%9 = udiv i64 %8, 1000
store i64 %9, i64* %4
%10 = load i64, i64* %3
%11 = and i64 %10, 67043328
%12 = lshr i64 %11, 16
store i64 %12, i64* %5
%13 = load i64, i64* %3
%14 = and i64 %13, 16128
%15 = lshr i64 %14, 8
store i64 %15, i64* %6
%16 = load i64, i64* %3
%17 = and i64 %16, 3
%18 = lshr i64 %17, 0
store i64 %18, i64* %7
%19 = load i64, i64* %4
%20 = load i64, i64* %5
%21 = mul i64 %19, %20
%22 = load i64, i64* %6
%23 = load i64, i64* %7
%24 = shl i64 %22, %23
%25 = udiv i64 %21, %24
%26 = mul i64 %25, 1000
%27 = trunc i64 %26 to i32
ret i32 %27
}

LLVM IR (-O2):
define i32 @s3c6400_get_pll(i64 %0, i64 %1) {
%3 = udiv i64 %1, 1000
%4 = lshr i64 %0, 16
%5 = and i64 %4, 1023
%6 = lshr i64 %0, 8
%7 = and i64 %6, 63
%8 = and i64 %0, 3
%9 = mul i64 %3, %5
%10 = shl nuw nsw i64 %7, %8
%11 = udiv i64 %9, %10
%12 = trunc i64 %11 to i32
%13 = mul i32 %12, 1000
ret i32 %13
}
int raw() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @raw() {
ret i32 0
}
int statinc() {
  int static x;
  x++;
  return x;
}


x86 assembly (clang, -O0):
<statinc>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1a(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f11(%rip)
mov    0x2f0b(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<statinc>:
mov    0x2f1e(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f15(%rip)
ret

LLVM IR (-O0):
@statinc.x = internal global i32 0
define i32 @statinc() {
%1 = load i32, i32* @statinc.x
%2 = add nsw i32 %1, 1
store i32 %2, i32* @statinc.x
%3 = load i32, i32* @statinc.x
ret i32 %3
}

LLVM IR (-O2):
@statinc.x = internal unnamed_addr global i32 0
define i32 @statinc() {
%1 = load i32, i32* @statinc.x
%2 = add nsw i32 %1, 1
store i32 %2, i32* @statinc.x
ret i32 %2
}
/* Variables and functions */
int _in_(int);
int /*<<< orphan*/ _out_(int, int /*<<< orphan*/);
uprobe() {
  int i2, i3;
  i2 = _in_((0x38 | (2)));
  i3 = _in_((0x38 | (3)));
  for (;;) {
    _out_(0x14, 0);
    if (i2 != _in_((0x38 | (2))))
      return (2);
    if (i3 != _in_((0x38 | (3))))
      return (3);
  }
}


x86 assembly (clang, -O0):
<uprobe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x3a,%edi
call   1030 <_in_@plt>
mov    %eax,-0x8(%rbp)
mov    $0x3b,%edi
call   1030 <_in_@plt>
mov    %eax,-0xc(%rbp)
mov    $0x14,%edi
xor    %esi,%esi
call   1040 <_out_@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x3a,%edi
call   1030 <_in_@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
je     1177 <uprobe+0x57>
movl   $0x2,-0x4(%rbp)
jmp    11a5 <uprobe+0x85>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x3b,%edi
call   1030 <_in_@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
je     11a0 <uprobe+0x80>
movl   $0x3,-0x4(%rbp)
jmp    11a5 <uprobe+0x85>
jmp    1142 <uprobe+0x22>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uprobe>:
push   %rbp
push   %rbx
push   %rax
mov    $0x3a,%edi
call   1030 <_in_@plt>
mov    %eax,%ebx
mov    $0x3b,%edi
call   1030 <_in_@plt>
mov    %eax,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x14,%edi
xor    %esi,%esi
call   1040 <_out_@plt>
mov    $0x3a,%edi
call   1030 <_in_@plt>
cmp    %eax,%ebx
jne    116f <uprobe+0x4f>
mov    $0x3b,%edi
call   1030 <_in_@plt>
cmp    %eax,%ebp
je     1140 <uprobe+0x20>
mov    $0x3,%eax
jmp    1174 <uprobe+0x54>
mov    $0x2,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @uprobe() {
%1 = tail call i32 @_in_(i32 58)
%2 = tail call i32 @_in_(i32 59)
br label %3
3: ; preds = %7, %0
%4 = tail call i32 @_out_(i32 20, i32 0)
%5 = tail call i32 @_in_(i32 58)
%6 = icmp eq i32 %1, %5
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = tail call i32 @_in_(i32 59)
%9 = icmp eq i32 %2, %8
br i1 %9, label %3, label %10
10: ; preds = %7, %3
%11 = phi i32 [ 2, %3 ], [ 3, %7 ]
ret i32 %11
}
int mmcInstalled(int interface) { return (1); }


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

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

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

LLVM IR (-O2):
define i32 @mmcInstalled(i32 %0) {
ret i32 1
}
main() { return _Generic('a', int : 5, char : 2); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int removeDuplicates(int *, int);
int main(void) {
  int x[3] = {1, 1, 2};
  printf("%d\n", removeDuplicates(x, 3));
  return (0);
}


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

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xede(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xecb(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x3,%esi
call   1040 <removeDuplicates@plt>
lea    0xebc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [3 x i32] [i32 1, i32 1, i32 2]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
store i32 0, i32* %1
%3 = bitcast [3 x i32]* %2 to i8*
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%5 = call i32 @removeDuplicates(i32* %4, i32 3)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [3 x i32] [i32 1, i32 1, i32 2]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [3 x i32]
%2 = bitcast [3 x i32]* %1 to i8*
%3 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%4 = call i32 @removeDuplicates(i32* %3, i32 3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}