xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t MULx_0x69(uint8_t v) {
  uint8_t r;
  r = v << 1;
  if (v & 0x80) {
    r ^= 0x69;
  }
  return r;
}


x86 assembly (clang, -O0):
<MULx_0x69>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     112a <MULx_0x69+0x2a>
mov    -0x8(%rbp),%eax
xor    $0x69,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MULx_0x69>:
lea    (%rdi,%rdi,1),%ecx
mov    %ecx,%eax
xor    $0x69,%eax
test   $0x80,%dil
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @MULx_0x69(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = shl i32 %4, 1
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = and i32 %6, 128
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %3
%11 = xor i32 %10, 105
store i32 %11, i32* %3
br label %12
12: ; preds = %9, %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @MULx_0x69(i32 %0) {
%2 = shl i32 %0, 1
%3 = and i32 %0, 128
%4 = icmp eq i32 %3, 0
%5 = xor i32 %2, 105
%6 = select i1 %4, i32 %2, i32 %5
ret i32 %6
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int nanosleep(struct timespec const *, struct timespec *);
int thrd_sleep(const struct timespec *duration, struct timespec *remaining) {
  return (nanosleep(duration, remaining));
}


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

x86 assembly (clang, -O2):
<thrd_sleep>:
jmp    1030 <nanosleep@plt>

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

LLVM IR (-O2):
%struct.timespec = type { i32 }
define i32 @thrd_sleep(%struct.timespec* %0, %struct.timespec* %1) {
%3 = tail call i32 @nanosleep(%struct.timespec* %0, %struct.timespec* %1)
ret i32 %3
}
int strlength(char *str) {
  int i = 0;
  for (; *str != '\0'; str++, i++)
    ;
  return i;
}


x86 assembly (clang, -O0):
<strlength>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     113e <strlength+0x3e>
jmp    1124 <strlength+0x24>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlength+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlength>:
cmpb   $0x0,(%rdi)
je     111c <strlength+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlength+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strlength(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 i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
int __VERIFIER_nondet_int();
int main() {
  int x, y;
  x = __VERIFIER_nondet_int();
  y = __VERIFIER_nondet_int();
  while (x >= 0) {
    y = 1;
    while (y < x) {
      y = 2 * y;
    }
    x = x - 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     116c <main+0x5c>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    115e <main+0x4e>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1144 <main+0x34>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1133 <main+0x23>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
ret i32 0
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
void sprint_dec_direct(char *str, uint8_t direct) {
  sprintf(str,
          "DEC   "
          "0x%02X"
          "                      ",
          direct);
}


x86 assembly (clang, -O0):
<sprint_dec_direct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sprint_dec_direct>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"DEC 0x%02X \00"
define void @sprint_dec_direct(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"DEC 0x%02X \00"
define void @sprint_dec_direct(i8* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
int pinmux_hog_maps(struct pinctrl_dev *pctldev) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.pinctrl_dev = type opaque
define i32 @pinmux_hog_maps(%struct.pinctrl_dev* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int call_omp_get_num_procs() {
  fputs("WARNING: OpenMP not enabled: call_omp_get_num_procs\n", stderr);
  return 1;
}


x86 assembly (clang, -O0):
<call_omp_get_num_procs>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_omp_get_num_procs>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [53 x i8] c"WARNING: OpenMP not enabled: call_omp_get_num_procs\0A\00"
@stderr = global i32 0
define i32 @call_omp_get_num_procs() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}

LLVM IR (-O2):
@.str = [53 x i8] c"WARNING: OpenMP not enabled: call_omp_get_num_procs\0A\00"
@stderr = global i32 0
define i32 @call_omp_get_num_procs() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}
int eq(void *x, void *y) { return x == y; }


x86 assembly (clang, -O0):
<eq>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<eq>:
xor    %eax,%eax
cmp    %rsi,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @eq(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = icmp eq i8* %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @eq(i8* readnone %0, i8* readnone %1) {
%3 = icmp eq i8* %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
void gtk_file_chooser_button_get_title() {}


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

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

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

LLVM IR (-O2):
define void @gtk_file_chooser_button_get_title() {
ret void
}
/* Type definitions */
struct Formatter {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ formatter_kill(struct Formatter *);
int /*<<< orphan*/ free(struct Formatter *);
void formatter_free(struct Formatter *formatter) {
  formatter_kill(formatter);
  free(formatter);
}


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

x86 assembly (clang, -O2):
<formatter_free>:
push   %rbx
mov    %rdi,%rbx
call   1040 <formatter_kill@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.Formatter = type { i32 }
define void @formatter_free(%struct.Formatter* %0) {
%2 = tail call i32 @formatter_kill(%struct.Formatter* %0)
%3 = tail call i32 @free(%struct.Formatter* %0)
ret void
}
int foo(char x) {
  char y = x;
  return ++x > y;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x1(%rbp),%al
add    $0x1,%al
mov    %al,-0x1(%rbp)
movsbl %al,%eax
movsbl -0x2(%rbp),%ecx
cmp    %ecx,%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
xor    %eax,%eax
cmp    $0x7f,%dil
setne  %al
ret

LLVM IR (-O0):
define i32 @foo(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = load i8, i8* %2
store i8 %4, i8* %3
%5 = load i8, i8* %2
%6 = add i8 %5, 1
store i8 %6, i8* %2
%7 = sext i8 %6 to i32
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sgt i32 %7, %9
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @foo(i8 signext %0) {
%2 = icmp ne i8 %0, 127
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;
typedef int /*<<< orphan*/ locale_t;

/* Variables and functions */
int wcscasecmp(int /*<<< orphan*/ const *, int /*<<< orphan*/ const *);
int wcscasecmp_l(const wchar_t *l, const wchar_t *r, locale_t locale) {
  return wcscasecmp(l, r);
}


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

x86 assembly (clang, -O2):
<wcscasecmp_l>:
jmp    1030 <wcscasecmp@plt>

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

LLVM IR (-O2):
define i32 @wcscasecmp_l(i32* %0, i32* %1, i32 %2) {
%4 = tail call i32 @wcscasecmp(i32* %0, i32* %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char *);
void usage(char *prog_name, char *filename) {
  printf("Usage : %s <data to add to %s>\n", prog_name, filename);
  exit(0);
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Usage : %s <data to add to %s>\0A\00"
define void @usage(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [32 x i8] c"Usage : %s <data to add to %s>\0A\00"
define void @usage(i8* %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%4 = tail call i32 @exit(i32 0)
unreachable
}
void global(void) {}


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

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

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

LLVM IR (-O2):
define void @global() {
ret void
}
/* Type definitions */
typedef scalar_t__ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, scalar_t__);
scalar_t__ recv(int, unsigned char *, size_t, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
ssize_t socket_read(int sockfd, unsigned char *data, size_t n) {
  ssize_t m = recv(sockfd, data, n, 0);
  if (m < 0) {
    fprintf(stderr, "edvs_net_read: recv error %zd\n", m);
    return -1;
  }
  return m;
}


x86 assembly (clang, -O0):
<socket_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jge    117a <socket_read+0x5a>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
lea    0xe98(%rip),%rsi
call   1040 <fprintf@plt>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1182 <socket_read+0x62>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_read>:
push   %rax
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %rax,%rax
js     112f <socket_read+0xf>
pop    %rcx
ret
mov    0x2eaa(%rip),%rcx
mov    (%rcx),%edi
lea    0xec1(%rip),%rsi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    $0xffffffffffffffff,%rax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"edvs_net_read: recv error %zd\0A\00"
define i64 @socket_read(i32 %0, i8* %1, i64 %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
store i32 %0, i32* %5
store i8* %1, i8** %6
store i64 %2, i64* %7
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = load i64, i64* %7
%12 = call i64 @recv(i32 %9, i8* %10, i64 %11, i32 0)
store i64 %12, i64* %8
%13 = load i64, i64* %8
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %3
%16 = load i32, i32* @stderr
%17 = load i64, i64* %8
%18 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i64 %17)
store i64 -1, i64* %4
br label %21
19: ; preds = %3
%20 = load i64, i64* %8
store i64 %20, i64* %4
br label %21
21: ; preds = %19, %15
%22 = load i64, i64* %4
ret i64 %22
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"edvs_net_read: recv error %zd\0A\00"
define i64 @socket_read(i32 %0, i8* %1, i64 %2) {
%4 = tail call i64 @recv(i32 %0, i8* %1, i64 %2, i32 0)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i64 %4)
br label %9
9: ; preds = %3, %6
%10 = phi i64 [ -1, %6 ], [ %4, %3 ]
ret i64 %10
}
/* Variables and functions */
char *multiplyChars(char *, char *);
int string2int(char *);
char *substractChars(char *, char *);
char *factorial(char *number) {
  int value = 0;
  char *result;
  result = number;
  while (value != 1) {
    number = substractChars(number, (char *)"1");
    result = multiplyChars(result, number);
    value = string2int(number);
  }
  return result;
}


x86 assembly (clang, -O0):
<factorial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x1,-0xc(%rbp)
je     118b <factorial+0x5b>
mov    -0x8(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1050 <substractChars@plt>
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <multiplyChars@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <string2int@plt>
mov    %eax,-0xc(%rbp)
jmp    114b <factorial+0x1b>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<factorial>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
lea    0xec1(%rip),%r14
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <substractChars@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1030 <multiplyChars@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1040 <string2int@plt>
cmp    $0x1,%eax
jne    1150 <factorial+0x20>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"1\00"
define i8* @factorial(i8* %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = phi i8* [ %0, %1 ], [ %5, %2 ]
%5 = tail call i8* @substractChars(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = tail call i8* @multiplyChars(i8* %3, i8* %5)
%7 = tail call i32 @string2int(i8* %5)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %2
9: ; preds = %2
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void *memcheck(void *ptr) {
  if (ptr == NULL) {
    fprintf(stderr, "Out of memory.\n");
    exit(EXIT_FAILURE);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<memcheck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    115a <memcheck+0x3a>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xeb9(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memcheck>:
test   %rdi,%rdi
je     1129 <memcheck+0x9>
mov    %rdi,%rax
ret
push   %rax
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"Out of memory.\0A\00"
@EXIT_FAILURE = global i32 0
define i8* @memcheck(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
10: ; preds = %1
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"Out of memory.\0A\00"
@EXIT_FAILURE = global i32 0
define i8* @memcheck(i8* readnone returned %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %1
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int umount(char *spec) {
  printf("umount() not implemented\n");
  exit(-1);
}


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"umount() not implemented\0A\00"
define i32 @umount(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@str = [25 x i8] c"umount() not implemented\00"
define i32 @umount(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 -1)
unreachable
}
void SPIM_DisableTxInt(void) {}


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

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

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

LLVM IR (-O2):
define void @SPIM_DisableTxInt() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ HplMcs51GeneralIOC__P20__makeOutput();
void ReverseGPIOP__0__In__makeOutput(void) {
  HplMcs51GeneralIOC__P20__makeOutput();
}


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

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

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

LLVM IR (-O2):
define void @ReverseGPIOP__0__In__makeOutput() {
%1 = tail call i32 (...) @HplMcs51GeneralIOC__P20__makeOutput()
ret void
}
/* Type definitions */
struct target {
  int dummy;
};

/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ snprintf(char *, int, char *);
char *dump_sys_setsid(int depth, struct target *target) {
  char *param_str = malloc(5);
  snprintf(param_str, 5, "void");
  return param_str;
}


x86 assembly (clang, -O0):
<dump_sys_setsid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x5,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x5,%esi
lea    0xeb3(%rip),%rdx
call   1030 <snprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_sys_setsid>:
push   %rbx
mov    $0x5,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xecb(%rip),%rdx
mov    %rax,%rdi
mov    $0x5,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.target = type { i32 }
@.str = [5 x i8] c"void\00"
define i8* @dump_sys_setsid(i32 %0, %struct.target* %1) {
%3 = alloca i32
%4 = alloca %struct.target*
%5 = alloca i8*
store i32 %0, i32* %3
store %struct.target* %1, %struct.target** %4
%6 = call i8* @malloc(i32 5)
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = call i32 @snprintf(i8* %7, i32 5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = load i8*, i8** %5
ret i8* %9
}

LLVM IR (-O2):
%struct.target = type { i32 }
@.str = [5 x i8] c"void\00"
define i8* @dump_sys_setsid(i32 %0, %struct.target* nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(5) i8* @malloc(i32 5)
%4 = tail call i32 @snprintf(i8* %3, i32 5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ f(int *);
int main() {
  int e = 1;
  f(&e);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <f@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x1,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%3 = call i32 @f(i32* %1)
ret i32 0
}
/* Type definitions */
struct termios {
  int /*<<< orphan*/ c_lflag;
};

/* Variables and functions */
int /*<<< orphan*/ ECHO;
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ free(struct termios *);
struct termios *get_termio_attr();
int /*<<< orphan*/ tcsetattr(int /*<<< orphan*/, int /*<<< orphan*/,
                             struct termios *);
void disable_echo(void) {
  struct termios *current;
  current = get_termio_attr();
  current->c_lflag &= ~ECHO;
  tcsetattr(STDIN_FILENO, 0, current);
  free(current);
}


x86 assembly (clang, -O0):
<disable_echo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <get_termio_attr@plt>
mov    %rax,-0x8(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    (%rax),%ecx
mov    %ecx,(%rax)
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1050 <tcsetattr@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disable_echo>:
push   %rbx
xor    %eax,%eax
call   1040 <get_termio_attr@plt>
mov    %rax,%rbx
mov    0x2ea6(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %eax,(%rbx)
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
mov    %rbx,%rdx
call   1050 <tcsetattr@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.termios = type { i32 }
@ECHO = global i32 0
@STDIN_FILENO = global i32 0
define void @disable_echo() {
%1 = alloca %struct.termios*
%2 = call %struct.termios* (...) @get_termio_attr()
store %struct.termios* %2, %struct.termios** %1
%3 = load i32, i32* @ECHO
%4 = xor i32 %3, -1
%5 = load %struct.termios*, %struct.termios** %1
%6 = getelementptr inbounds %struct.termios, %struct.termios* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = and i32 %7, %4
store i32 %8, i32* %6
%9 = load i32, i32* @STDIN_FILENO
%10 = load %struct.termios*, %struct.termios** %1
%11 = call i32 @tcsetattr(i32 %9, i32 0, %struct.termios* %10)
%12 = load %struct.termios*, %struct.termios** %1
%13 = call i32 @free(%struct.termios* %12)
ret void
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@ECHO = global i32 0
@STDIN_FILENO = global i32 0
define void @disable_echo() {
%1 = tail call %struct.termios* (...) @get_termio_attr()
%2 = load i32, i32* @ECHO
%3 = xor i32 %2, -1
%4 = getelementptr inbounds %struct.termios, %struct.termios* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = and i32 %5, %3
store i32 %6, i32* %4
%7 = load i32, i32* @STDIN_FILENO
%8 = tail call i32 @tcsetattr(i32 %7, i32 0, %struct.termios* %1)
%9 = tail call i32 @free(%struct.termios* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mbed_die();
void exit(int return_code) {
  if (return_code) {
    mbed_die();
  }
  while (1)
    ;
}


x86 assembly (clang, -O0):
<exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     112c <exit+0x1c>
mov    $0x0,%al
call   1030 <mbed_die@plt>
jmp    1131 <exit+0x21>
jmp    1131 <exit+0x21>

x86 assembly (clang, -O2):
<exit>:
test   %edi,%edi
je     1120 <exit+0x10>
push   %rax
xor    %eax,%eax
call   1030 <mbed_die@plt>
add    $0x8,%rsp
jmp    1120 <exit+0x10>

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

LLVM IR (-O2):
define void @exit(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @mbed_die()
br label %5
5: ; preds = %3, %1
br label %6
6: ; preds = %5, %6
br label %6
}
int ntz(int v) {
  int c = 0;
  for (; (v & 1) == 0; v >>= 1)
    ++c;
  return c;
}


x86 assembly (clang, -O0):
<ntz>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1134 <ntz+0x34>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <ntz+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ntz>:
xor    %eax,%eax
test   $0x1,%dil
jne    111d <ntz+0x1d>
xor    %eax,%eax
mov    %edi,%ecx
nopl   0x0(%rax)
add    $0x1,%eax
sar    %ecx
test   $0x2,%dil
mov    %ecx,%edi
je     1110 <ntz+0x10>
ret

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

LLVM IR (-O2):
define i32 @ntz(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %11
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = phi i32 [ %8, %4 ], [ %0, %1 ]
%7 = add nuw nsw i32 %5, 1
%8 = ashr i32 %6, 1
%9 = and i32 %6, 2
%10 = icmp eq i32 %9, 0
br i1 %10, label %4, label %11
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void zconffree(void *ptr) { free((char *)ptr); }


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

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

LLVM IR (-O2):
define void @zconffree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
void *ourmalloc(nbytes)
unsigned nbytes;
{
  void *ptr;
  if ((ptr = malloc(nbytes)) == 0)
    outofmemoryerror("");
  return ptr;
}


x86 assembly (clang, -O0):
<ourmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1151 <ourmalloc+0x31>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1040 <outofmemoryerror@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ourmalloc>:
push   %rbx
mov    %edi,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113e <ourmalloc+0x1e>
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1040 <outofmemoryerror@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @ourmalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = zext i32 %4 to i64
%6 = call i8* @malloc(i64 %5)
store i8* %6, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @outofmemoryerror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @ourmalloc(i32 %0) {
%2 = zext i32 %0 to i64
%3 = tail call i8* @malloc(i64 %2)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @outofmemoryerror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret i8* %3
}
void cond_resched_lock(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<cond_resched_lock>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cond_resched_lock>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.cond_resched_lock = [18 x i8] c"cond_resched_lock\00"
define void @cond_resched_lock() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.cond_resched_lock, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.cond_resched_lock = [18 x i8] c"cond_resched_lock\00"
define void @cond_resched_lock() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.cond_resched_lock, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ __bswapdi2(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/, int /*<<< orphan*/,
                          int /*<<< orphan*/);
int test__bswapdi2(uint64_t a, uint64_t expected) {
  uint64_t actual = __bswapdi2(a);
  if (actual != expected)
    printf("error in test__bswapsi2(0x%0llX) = 0x%0llX, expected 0x%0llX\n", a,
           actual, expected);
  return actual != expected;
}


x86 assembly (clang, -O0):
<test__bswapdi2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1160 <__bswapdi2>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     114a <test__bswapdi2+0x3a>
mov    -0x4(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret
xchg   %ax,%ax

x86 assembly (clang, -O2):
<test__bswapdi2>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%r14d
call   1150 <__bswapdi2>
mov    %eax,%ebp
cmp    %ebx,%eax
je     1137 <test__bswapdi2+0x27>
lea    0xed5(%rip),%rdi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
cmp    %ebx,%ebp
setne  %al
pop    %rbx
pop    %r14
pop    %rbp
ret
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)

LLVM IR (-O0):
@.str = [62 x i8] c"error in test__bswapsi2(0x%0llX) = 0x%0llX, expected 0x%0llX\0A\00"
define i32 @test__bswapdi2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = call i32 @__bswapdi2(i32 %6)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %8, %9
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i32, i32* %3
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %13, i32 %14)
br label %16
16: ; preds = %11, %2
%17 = load i32, i32* %5
%18 = load i32, i32* %4
%19 = icmp ne i32 %17, %18
%20 = zext i1 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
@.str = [62 x i8] c"error in test__bswapsi2(0x%0llX) = 0x%0llX, expected 0x%0llX\0A\00"
define i32 @test__bswapdi2(i32 %0, i32 %1) {
%3 = tail call i32 @__bswapdi2(i32 %0)
%4 = icmp ne i32 %3, %1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %3, i32 %1)
br label %7
7: ; preds = %5, %2
%8 = zext i1 %4 to i32
ret i32 %8
}
/* Type definitions */
struct Cyc_Absyn_Exp {
  int dummy;
};

/* Variables and functions */
struct Cyc_Absyn_Exp *Cyc_Absyn_prim2_exp(unsigned int, struct Cyc_Absyn_Exp *,
                                          struct Cyc_Absyn_Exp *, unsigned int);
struct Cyc_Absyn_Exp *Cyc_Absyn_gte_exp(struct Cyc_Absyn_Exp *e1,
                                        struct Cyc_Absyn_Exp *e2,
                                        unsigned loc) {
  struct Cyc_Absyn_Exp *_T0;
  _T0 = Cyc_Absyn_prim2_exp(9U, e1, e2, loc);
  return _T0;
}


x86 assembly (clang, -O0):
<Cyc_Absyn_gte_exp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    $0x9,%edi
call   1030 <Cyc_Absyn_prim2_exp@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_Absyn_gte_exp>:
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x9,%edi
jmp    1030 <Cyc_Absyn_prim2_exp@plt>

LLVM IR (-O0):
%struct.Cyc_Absyn_Exp = type { i32 }
define %struct.Cyc_Absyn_Exp* @Cyc_Absyn_gte_exp(%struct.Cyc_Absyn_Exp* %0, %struct.Cyc_Absyn_Exp* %1, i32 %2) {
%4 = alloca %struct.Cyc_Absyn_Exp*
%5 = alloca %struct.Cyc_Absyn_Exp*
%6 = alloca i32
%7 = alloca %struct.Cyc_Absyn_Exp*
store %struct.Cyc_Absyn_Exp* %0, %struct.Cyc_Absyn_Exp** %4
store %struct.Cyc_Absyn_Exp* %1, %struct.Cyc_Absyn_Exp** %5
store i32 %2, i32* %6
%8 = load %struct.Cyc_Absyn_Exp*, %struct.Cyc_Absyn_Exp** %4
%9 = load %struct.Cyc_Absyn_Exp*, %struct.Cyc_Absyn_Exp** %5
%10 = load i32, i32* %6
%11 = call %struct.Cyc_Absyn_Exp* @Cyc_Absyn_prim2_exp(i32 9, %struct.Cyc_Absyn_Exp* %8, %struct.Cyc_Absyn_Exp* %9, i32 %10)
store %struct.Cyc_Absyn_Exp* %11, %struct.Cyc_Absyn_Exp** %7
%12 = load %struct.Cyc_Absyn_Exp*, %struct.Cyc_Absyn_Exp** %7
ret %struct.Cyc_Absyn_Exp* %12
}

LLVM IR (-O2):
%struct.Cyc_Absyn_Exp = type { i32 }
define %struct.Cyc_Absyn_Exp* @Cyc_Absyn_gte_exp(%struct.Cyc_Absyn_Exp* %0, %struct.Cyc_Absyn_Exp* %1, i32 %2) {
%4 = tail call %struct.Cyc_Absyn_Exp* @Cyc_Absyn_prim2_exp(i32 9, %struct.Cyc_Absyn_Exp* %0, %struct.Cyc_Absyn_Exp* %1, i32 %2)
ret %struct.Cyc_Absyn_Exp* %4
}
void swap(int *intArr, int i, int j) {
  int tmp;
  tmp = intArr[i];
  intArr[i] = intArr[j];
  intArr[j] = tmp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

LLVM IR (-O0):
define void @swap(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
store i32 %12, i32* %7
%13 = load i32*, i32** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32*, i32** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 %17, i32* %21
%22 = load i32, i32* %7
%23 = load i32*, i32** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
ret void
}

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int is_own_vap_mac(int *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  uint8_t mac[] = {0xc0, 0x00, 0xff, 0x00, 0x00, 0x08};
  printf("%d\n", is_own_vap_mac(mac));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <is_own_vap_mac@plt>
mov    %eax,%esi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
call   1040 <is_own_vap_mac@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.mac = [6 x i32] [i32 192, i32 0, i32 255, i32 0, i32 0, i32 8]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%4 = call i32 @is_own_vap_mac(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
}

LLVM IR (-O2):
@__const.main.mac = [6 x i32] [i32 192, i32 0, i32 255, i32 0, i32 0, i32 8]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%4 = call i32 @is_own_vap_mac(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
}
/* Variables and functions */
int /*<<< orphan*/ g(int *, int *);
void f(int *q, int a) { g(q, &a); }


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

x86 assembly (clang, -O2):
<f>:
push   %rax
mov    %esi,0x4(%rsp)
lea    0x4(%rsp),%rsi
call   1030 <g@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @f(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 = call i32 @g(i32* %5, i32* %4)
ret void
}

LLVM IR (-O2):
define void @f(i32* %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = call i32 @g(i32* %0, i32* %3)
ret void
}
unsigned long XCheckNVStructEx(unsigned char *lpPhoBuf, unsigned long dwPhoSize,
                               unsigned long bBigEndian,
                               unsigned long bModule) {
  if (!XCheckNVStruct(lpPhoBuf, dwPhoSize, bBigEndian, bModule)) {
    printf("%s %d\n", __FUNCTION__, 416);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<XCheckNVStructEx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    $0x0,%al
call   1040 <XCheckNVStruct@plt>
cmp    $0x0,%eax
jne    117f <XCheckNVStructEx+0x5f>
lea    0xea1(%rip),%rdi
lea    0xea1(%rip),%rsi
mov    $0x1a0,%edx
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x8(%rbp)
jmp    1187 <XCheckNVStructEx+0x67>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XCheckNVStructEx>:
push   %rbx
xor    %eax,%eax
call   1040 <XCheckNVStruct@plt>
mov    $0x1,%ebx
test   %eax,%eax
jne    114d <XCheckNVStructEx+0x2d>
lea    0xec8(%rip),%rdi
lea    0xec8(%rip),%rsi
xor    %ebx,%ebx
mov    $0x1a0,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%s %d\0A\00"
@__FUNCTION__.XCheckNVStructEx = [17 x i8] c"XCheckNVStructEx\00"
define i64 @XCheckNVStructEx(i8* %0, i64 %1, i64 %2, i64 %3) {
%5 = tail call i32 (i8*, i64, i64, i64, ...) bitcast (i32 (...)* @XCheckNVStruct to i32 (i8*, i64, i64, i64, ...)*)(i8* %0, i64 %1, i64 %2, i64 %3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @__FUNCTION__.XCheckNVStructEx, i64 0, i64 0), i32 416)
br label %9
9: ; preds = %4, %7
%10 = phi i64 [ 0, %7 ], [ 1, %4 ]
ret i64 %10
}