xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ putch(char);
void print_string(char *str) {
  while (*str != '\0') {
    putch(*str);
    str = str++;
  }
}


x86 assembly (clang, -O0):
<print_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1150 <print_string+0x40>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putch@plt>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x8(%rbp)
jmp    111c <print_string+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_string>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     112f <print_string+0x1f>
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putch@plt>
movzbl (%rbx),%eax
test   %al,%al
jne    1120 <print_string+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @print_string(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %7, %4 ], [ %2, %1 ]
%6 = tail call i32 @putch(i8 signext %5)
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void x_free(void *x) {
  if (x != NULL)
    free(x);
}


x86 assembly (clang, -O0):
<x_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <x_free+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x_free>:
test   %rdi,%rdi
je     111a <x_free+0xa>
jmp    1030 <free@plt>
ret

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

LLVM IR (-O2):
define void @x_free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ border_width;
};
struct TYPE_4__ {
  TYPE_1__ xconfigure;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
int get_XEvent_xconfigure_border_width(void *_p) {
  return (int)((XEvent *)_p)->xconfigure.border_width;
}


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

x86 assembly (clang, -O2):
<get_XEvent_xconfigure_border_width>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64 }
define i32 @get_XEvent_xconfigure_border_width(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_4__*
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i32 0, i32 0
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @get_XEvent_xconfigure_border_width(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutexattr_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int /*<<< orphan*/ *);
int /*<<< orphan*/ abort();
int /*<<< orphan*/ log_error(int, char *);
int pthread_mutexattr_destroy(int /*<<< orphan*/ *);
void mutexattrDestroy(pthread_mutexattr_t *attrs) {
  ASSERT(attrs);
  int r = pthread_mutexattr_destroy(attrs);
  if (r != 0) {
    log_error(r, "Error pthread_mutexattr_destroy()");
    abort();
  }
}


x86 assembly (clang, -O0):
<mutexattrDestroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <ASSERT@plt>
mov    -0x8(%rbp),%rdi
call   1060 <pthread_mutexattr_destroy@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1181 <mutexattrDestroy+0x41>
mov    -0xc(%rbp),%edi
lea    0xe8b(%rip),%rsi
call   1040 <log_error@plt>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mutexattrDestroy>:
push   %rbx
mov    %rdi,%rbx
call   1050 <ASSERT@plt>
mov    %rbx,%rdi
call   1060 <pthread_mutexattr_destroy@plt>
test   %eax,%eax
jne    1157 <mutexattrDestroy+0x17>
pop    %rbx
ret
lea    0xea2(%rip),%rsi
mov    %eax,%edi
call   1040 <log_error@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"Error pthread_mutexattr_destroy()\00"
define void @mutexattrDestroy(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @ASSERT(i32* %4)
%6 = load i32*, i32** %2
%7 = call i32 @pthread_mutexattr_destroy(i32* %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = load i32, i32* %3
%12 = call i32 @log_error(i32 %11, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%13 = call i32 (...) @abort()
unreachable
14: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"Error pthread_mutexattr_destroy()\00"
define void @mutexattrDestroy(i32* %0) {
%2 = tail call i32 @ASSERT(i32* %0)
%3 = tail call i32 @pthread_mutexattr_destroy(i32* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = tail call i32 @log_error(i32 %3, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %1
ret void
}
int test_imm_2Fuint16_mem(unsigned short *val) {
  return ((*val) & (0x2F << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_2Fuint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 47
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
programming_error(a, b) char *a;
int b;
{}


x86 assembly (clang, -O0):
<programming_error>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @programming_error(i8* nocapture readnone %0, i32 %1) {
ret i32 undef
}
/* Variables and functions */
int fooble(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int arr[2];
  arr[0] = 3;
  printf("fooble: result is %d\n", fooble(arr[0], arr[1]));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
call   1040 <fooble@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"fooble: result is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
store i32 0, i32* %1
%3 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
store i32 3, i32* %3
%4 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%5 = load i32, i32* %4
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%7 = load i32, i32* %6
%8 = call i32 @fooble(i32 %5, i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"fooble: result is %d\0A\00"
define i32 @main() {
%1 = tail call i32 @fooble(i32 3, i32 undef)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ write_break();
int /*<<< orphan*/ write_line(char *);
void latex_see_also_start(void) {
  write_break();
  write_line("\\subsubsection*{See also}");
}


x86 assembly (clang, -O0):
<latex_see_also_start>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <write_break@plt>
lea    0xece(%rip),%rdi
call   1040 <write_line@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<latex_see_also_start>:
push   %rax
xor    %eax,%eax
call   1030 <write_break@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1040 <write_line@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"\\subsubsection*{See also}\00"
define void @latex_see_also_start() {
%1 = call i32 (...) @write_break()
%2 = call i32 @write_line(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"\\subsubsection*{See also}\00"
define void @latex_see_also_start() {
%1 = tail call i32 (...) @write_break()
%2 = tail call i32 @write_line(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_itoa(int);
int /*<<< orphan*/ ft_putstr_fd(int /*<<< orphan*/, int);
void ft_putnbr_fd(int n, int fd) { ft_putstr_fd(ft_itoa(n), fd); }


x86 assembly (clang, -O0):
<ft_putnbr_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <ft_itoa@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%esi
call   1040 <ft_putstr_fd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr_fd>:
push   %rbx
mov    %esi,%ebx
call   1030 <ft_itoa@plt>
mov    %eax,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <ft_putstr_fd@plt>

LLVM IR (-O0):
define void @ft_putnbr_fd(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 @ft_itoa(i32 %5)
%7 = load i32, i32* %4
%8 = call i32 @ft_putstr_fd(i32 %6, i32 %7)
ret void
}

LLVM IR (-O2):
define void @ft_putnbr_fd(i32 %0, i32 %1) {
%3 = tail call i32 @ft_itoa(i32 %0)
%4 = tail call i32 @ft_putstr_fd(i32 %3, i32 %1)
ret void
}
/* Type definitions */
typedef scalar_t__ int8_t;

/* Variables and functions */
int8_t i8min(int8_t x, int8_t y) { return x < y ? x : y; }


x86 assembly (clang, -O0):
<i8min>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1127 <i8min+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <i8min+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<i8min>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovl  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @i8min(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
int intlen(int start) {
  int end = 1;
  while (start >= 10) {
    start = start / 10;
    end++;
  }
  return end;
}


x86 assembly (clang, -O0):
<intlen>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0xa,-0x4(%rbp)
jl     1134 <intlen+0x34>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <intlen+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @intlen(i32 %0) {
%2 = icmp sgt i32 %0, 9
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 1, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = udiv i32 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = icmp ugt i32 %5, 99
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 1, %1 ], [ %7, %3 ]
ret i32 %10
}
/* Type definitions */
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int /*<<< orphan*/ sendto_schedule2(int, void const *, size_t, int,
                                    struct sockaddr const *, int /*<<< orphan*/,
                                    int /*<<< orphan*/ *, int /*<<< orphan*/);
ssize_t sendto_or_schedule(int sockfd, const void *buf, size_t len, int flags,
                           const struct sockaddr *dest_addr,
                           socklen_t addrlen) {
  return sendto_schedule2(sockfd, buf, len, flags, dest_addr, addrlen, NULL, 0);
}


x86 assembly (clang, -O0):
<sendto_or_schedule>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    -0x2c(%rbp),%r9d
xor    %eax,%eax
xor    %eax,%eax
movq   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
call   1030 <sendto_schedule2@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendto_or_schedule>:
push   %rax
push   $0x0
push   $0x0
call   1030 <sendto_schedule2@plt>
add    $0x10,%rsp
pop    %rcx
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
define i32 @sendto_or_schedule(i32 %0, i8* %1, i64 %2, i32 %3, %struct.sockaddr* %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca %struct.sockaddr*
%12 = alloca i32
store i32 %0, i32* %7
store i8* %1, i8** %8
store i64 %2, i64* %9
store i32 %3, i32* %10
store %struct.sockaddr* %4, %struct.sockaddr** %11
store i32 %5, i32* %12
%13 = load i32, i32* %7
%14 = load i8*, i8** %8
%15 = load i64, i64* %9
%16 = load i32, i32* %10
%17 = load %struct.sockaddr*, %struct.sockaddr** %11
%18 = load i32, i32* %12
%19 = call i32 @sendto_schedule2(i32 %13, i8* %14, i64 %15, i32 %16, %struct.sockaddr* %17, i32 %18, i32* null, i32 0)
ret i32 %19
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
define i32 @sendto_or_schedule(i32 %0, i8* %1, i64 %2, i32 %3, %struct.sockaddr* %4, i32 %5) {
%7 = tail call i32 @sendto_schedule2(i32 %0, i8* %1, i64 %2, i32 %3, %struct.sockaddr* %4, i32 %5, i32* null, i32 0)
ret i32 %7
}
/* Variables and functions */
size_t mapcel_svc_write(void *ptr, size_t size, size_t nmemb, void *fp) {
  return 0;
}


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

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

LLVM IR (-O0):
define i64 @mapcel_svc_write(i8* %0, i64 %1, i64 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i8*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i8* %3, i8** %8
ret i64 0
}

LLVM IR (-O2):
define i64 @mapcel_svc_write(i8* nocapture readnone %0, i64 %1, i64 %2, i8* nocapture readnone %3) {
ret i64 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_create(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                  void *(*)(void *), int /*<<< orphan*/ *);
void fthread_create_(void *(*thread_func)(void *), pthread_t *theThread) {
  pthread_create(theThread, NULL, thread_func, NULL);
}


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

x86 assembly (clang, -O2):
<fthread_create_>:
mov    %rdi,%rdx
mov    %rsi,%rdi
xor    %esi,%esi
xor    %ecx,%ecx
jmp    1030 <pthread_create@plt>

LLVM IR (-O0):
define void @fthread_create_(i8* (i8*)* %0, i32* %1) {
%3 = alloca i8* (i8*)*
%4 = alloca i32*
store i8* (i8*)* %0, i8* (i8*)** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = load i8* (i8*)*, i8* (i8*)** %3
%7 = call i32 @pthread_create(i32* %5, i32* null, i8* (i8*)* %6, i32* null)
ret void
}

LLVM IR (-O2):
define void @fthread_create_(i8* (i8*)* %0, i32* %1) {
%3 = tail call i32 @pthread_create(i32* %1, i32* null, i8* (i8*)* %0, i32* null)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M584_f(char *s) {
  debug("M584_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M584_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M584_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M584_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M584_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M584_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M584_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ addID(int *);
int *unpack_rng(char *);
int *funpack_rng_ptr(char *buffer) {
  int *tmpGen;
  tmpGen = unpack_rng(buffer);
  addID(tmpGen);
  return tmpGen;
}


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

x86 assembly (clang, -O2):
<funpack_rng_ptr>:
push   %rbx
call   1030 <unpack_rng@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <addID@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i32* @funpack_rng_ptr(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32* @unpack_rng(i8* %4)
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = call i32 @addID(i32* %6)
%8 = load i32*, i32** %3
ret i32* %8
}

LLVM IR (-O2):
define i32* @funpack_rng_ptr(i8* %0) {
%2 = tail call i32* @unpack_rng(i8* %0)
%3 = tail call i32 @addID(i32* %2)
ret i32* %2
}
/* Variables and functions */
int IN(int);
volatile unsigned char spiEmptyIn(void) { return IN(0x01) & (1 << 0) ? 1 : 0; }


x86 assembly (clang, -O0):
<spiEmptyIn>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <IN@plt>
mov    %eax,%edx
and    $0x1,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<spiEmptyIn>:
push   %rax
mov    $0x1,%edi
call   1030 <IN@plt>
and    $0x1,%al
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i8 @spiEmptyIn() {
%1 = call i32 @IN(i32 1)
%2 = and i32 %1, 1
%3 = icmp ne i32 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i32 1, i32 0
%6 = trunc i32 %5 to i8
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @spiEmptyIn() {
%1 = tail call i32 @IN(i32 1)
%2 = trunc i32 %1 to i8
%3 = and i8 %2, 1
ret i8 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ intArr;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void pass_array(int intArr[]) {
  int size = sizeof(intArr);
  printf("stack size = %d \n", size);
}


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

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

LLVM IR (-O0):
@.str = [18 x i8] c"stack size = %d \0A\00"
define void @pass_array(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 8, i32* %3
%4 = load i32, i32* %3
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"stack size = %d \0A\00"
define void @pass_array(i32* nocapture readnone %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 8)
ret void
}
/* Variables and functions */
scalar_t__ usb_send_serial_data(char *, int);
void print(char *str) {
  int len = 0;
  char *b = str;
  while (*b) {
    b++;
    len++;
  }
  while (usb_send_serial_data(str, len) == 0)
    ;
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1152 <print+0x42>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112b <print+0x1b>
jmp    1157 <print+0x47>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <usb_send_serial_data@plt>
cmp    $0x0,%rax
jne    1172 <print+0x62>
jmp    1157 <print+0x47>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
cmpb   $0x0,(%rdi)
je     112e <print+0x1e>
xor    %ebx,%ebx
xchg   %ax,%ax
cmpb   $0x0,0x1(%r14,%rbx,1)
lea    0x1(%rbx),%rbx
jne    1120 <print+0x10>
jmp    1130 <print+0x20>
xor    %ebx,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <usb_send_serial_data@plt>
test   %rax,%rax
je     1130 <print+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @print(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 = %10, %1
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %4
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %6
15: ; preds = %6
br label %16
16: ; preds = %21, %15
%17 = load i8*, i8** %2
%18 = load i32, i32* %3
%19 = call i64 @usb_send_serial_data(i8* %17, i32 %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %16
br label %16
22: ; preds = %16
ret void
}

LLVM IR (-O2):
define void @print(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %6, %1
%5 = phi i32 [ 0, %1 ], [ %10, %6 ]
br label %13
6: ; preds = %1, %6
%7 = phi i8* [ %9, %6 ], [ %0, %1 ]
%8 = phi i32 [ %10, %6 ], [ 0, %1 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = add nuw nsw i32 %8, 1
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %4, label %6
13: ; preds = %4, %13
%14 = tail call i64 @usb_send_serial_data(i8* %0, i32 %5)
%15 = icmp eq i64 %14, 0
br i1 %15, label %13, label %16
16: ; preds = %13
ret void
}
/* Variables and functions */
int /*<<< orphan*/ s(char *);
doublequote() { s("\""); }


x86 assembly (clang, -O0):
<doublequote>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <s@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [2 x i8] c"\22\00"
define i32 @doublequote() {
%1 = tail call i32 @s(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
int CMod_SurfaceContents(int oldcontents) {
  switch (oldcontents) {
  case -1:
    return 0;
  case -2:
    return 1;
  case -3:
    return 32;
  case -4:
    return 16;
  case -5:
    return 8;
  case -8:
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<CMod_SurfaceContents>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x8,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x7,%eax
ja     1178 <CMod_SurfaceContents+0x78>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    117f <CMod_SurfaceContents+0x7f>
movl   $0x1,-0x4(%rbp)
jmp    117f <CMod_SurfaceContents+0x7f>
movl   $0x20,-0x4(%rbp)
jmp    117f <CMod_SurfaceContents+0x7f>
movl   $0x10,-0x4(%rbp)
jmp    117f <CMod_SurfaceContents+0x7f>
movl   $0x8,-0x4(%rbp)
jmp    117f <CMod_SurfaceContents+0x7f>
movl   $0x1,-0x4(%rbp)
jmp    117f <CMod_SurfaceContents+0x7f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CMod_SurfaceContents>:
add    $0x8,%edi
xor    %eax,%eax
cmp    $0x6,%edi
ja     1117 <CMod_SurfaceContents+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @CMod_SurfaceContents(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %11 [
i32 -1, label %5
i32 -2, label %6
i32 -3, label %7
i32 -4, label %8
i32 -5, label %9
i32 -8, label %10
]
5: ; preds = %1
store i32 0, i32* %2
br label %12
6: ; preds = %1
store i32 1, i32* %2
br label %12
7: ; preds = %1
store i32 32, i32* %2
br label %12
8: ; preds = %1
store i32 16, i32* %2
br label %12
9: ; preds = %1
store i32 8, i32* %2
br label %12
10: ; preds = %1
store i32 1, i32* %2
br label %12
11: ; preds = %1
store i32 0, i32* %2
br label %12
12: ; preds = %11, %10, %9, %8, %7, %6, %5
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@switch.table.CMod_SurfaceContents = [7 x i32] [i32 1, i32 0, i32 0, i32 8, i32 16, i32 32, i32 1]
define i32 @CMod_SurfaceContents(i32 %0) {
%2 = add i32 %0, 8
%3 = icmp ult i32 %2, 7
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [7 x i32], [7 x i32]* @switch.table.CMod_SurfaceContents, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %9
}
void _infix_operator_minus_i8_i8(signed char lhs, signed char rhs,
                                 signed char *__rval_1) {
  *__rval_1 = lhs - rhs;
}


x86 assembly (clang, -O0):
<_infix_operator_minus_i8_i8>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    %rdx,-0x10(%rbp)
movsbl -0x1(%rbp),%eax
movsbl -0x2(%rbp),%ecx
sub    %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_infix_operator_minus_i8_i8>:
sub    %sil,%dil
mov    %dil,(%rdx)
ret

LLVM IR (-O0):
define void @_infix_operator_minus_i8_i8(i8 signext %0, i8 signext %1, i8* %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8*
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8* %2, i8** %6
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = load i8, i8* %5
%10 = sext i8 %9 to i32
%11 = sub nsw i32 %8, %10
%12 = trunc i32 %11 to i8
%13 = load i8*, i8** %6
store i8 %12, i8* %13
ret void
}

LLVM IR (-O2):
define void @_infix_operator_minus_i8_i8(i8 signext %0, i8 signext %1, i8* nocapture writeonly %2) {
%4 = sub i8 %0, %1
store i8 %4, i8* %2
ret void
}
int test_imm_72int16_reg(short val) {
  return ((val) & (0x72 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_72int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0x72,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_72int16_reg(i16 signext %0) {
%2 = and i16 %0, 114
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void ktsan_thr_stop(void) {}


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

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

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

LLVM IR (-O2):
define void @ktsan_thr_stop() {
ret void
}
/* Variables and functions */
unsigned long GetAudioLen306(unsigned long);
unsigned long getaudiolen(unsigned long id) { return GetAudioLen306(id); }


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

x86 assembly (clang, -O2):
<getaudiolen>:
jmp    1030 <GetAudioLen306@plt>

LLVM IR (-O0):
define i64 @getaudiolen(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @GetAudioLen306(i64 %3)
ret i64 %4
}

LLVM IR (-O2):
define i64 @getaudiolen(i64 %0) {
%2 = tail call i64 @GetAudioLen306(i64 %0)
ret i64 %2
}
extern int nipsvm_module_init() { return 0; }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ eth_addr_compare_3way(int /*<<< orphan*/ const *,
                                         int /*<<< orphan*/ const *);
bool eth_addr_equals(const uint8_t a[6], const uint8_t b[6]) {
  return !eth_addr_compare_3way(a, b);
}


x86 assembly (clang, -O0):
<eth_addr_equals>:
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 <eth_addr_compare_3way@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eth_addr_equals>:
push   %rax
call   1030 <eth_addr_compare_3way@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @eth_addr_equals(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 @eth_addr_compare_3way(i32* %5, i32* %6)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @eth_addr_equals(i32* %0, i32* %1) {
%3 = tail call i32 @eth_addr_compare_3way(i32* %0, i32* %1)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
typedef int uint8_t;
typedef int volatile uint32_t;

/* Variables and functions */
uint8_t isBitSet(volatile uint32_t *reg, uint8_t position) {
  uint32_t mask = 1 << position;
  return *reg & mask ? 1 : 0;
}


x86 assembly (clang, -O0):
<isBitSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%eax
and    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isBitSet>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x4(%rsp)
mov    (%rdi),%ecx
xor    %eax,%eax
and    -0x4(%rsp),%ecx
setne  %al
ret

LLVM IR (-O0):
define i32 @isBitSet(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* %4
%7 = shl i32 1, %6
store volatile i32 %7, i32* %5
%8 = load i32*, i32** %3
%9 = load volatile i32, i32* %8
%10 = load volatile i32, i32* %5
%11 = and i32 %9, %10
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 1, i32 0
ret i32 %14
}

LLVM IR (-O2):
define i32 @isBitSet(i32* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = shl nuw i32 1, %1
store volatile i32 %5, i32* %3
%6 = load volatile i32, i32* %0
%7 = load volatile i32, i32* %3
%8 = and i32 %7, %6
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
scalar_t__ tlog_utf8_buf_is_valid(char const *, int /*<<< orphan*/);
bool tlog_utf8_str_is_valid(const char *str) {
  assert(str != NULL);
  return str != NULL && tlog_utf8_buf_is_valid(str, strlen(str));
}


x86 assembly (clang, -O0):
<tlog_utf8_str_is_valid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     1184 <tlog_utf8_str_is_valid+0x54>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1050 <tlog_utf8_buf_is_valid@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tlog_utf8_str_is_valid>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
test   %rbx,%rbx
je     1166 <tlog_utf8_str_is_valid+0x36>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <tlog_utf8_buf_is_valid@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @tlog_utf8_str_is_valid(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load i8*, i8** %2
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %15
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = load i8*, i8** %2
%12 = call i32 @strlen(i8* %11)
%13 = call i64 @tlog_utf8_buf_is_valid(i8* %10, i32 %12)
%14 = icmp ne i64 %13, 0
br label %15
15: ; preds = %9, %1
%16 = phi i1 [ false, %1 ], [ %14, %9 ]
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @tlog_utf8_str_is_valid(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
br i1 %2, label %5, label %10
5: ; preds = %1
%6 = tail call i32 @strlen(i8* %0)
%7 = tail call i64 @tlog_utf8_buf_is_valid(i8* %0, i32 %6)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %5, %1
%11 = phi i32 [ 0, %1 ], [ %9, %5 ]
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ little_endian_read_16(int /*<<< orphan*/ const *, int);
uint16_t bnep_event_channel_opened_get_source_uuid(const uint8_t *event) {
  return little_endian_read_16(event, 5);
}


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

x86 assembly (clang, -O2):
<bnep_event_channel_opened_get_source_uuid>:
mov    $0x5,%esi
jmp    1030 <little_endian_read_16@plt>

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

LLVM IR (-O2):
define i32 @bnep_event_channel_opened_get_source_uuid(i32* %0) {
%2 = tail call i32 @little_endian_read_16(i32* %0, i32 5)
ret i32 %2
}
/* Type definitions */
struct timespec {
  double tv_sec;
  int tv_nsec;
};

/* Variables and functions */
double seconds_between(const struct timespec *a, const struct timespec *b) {
  return (b->tv_sec - a->tv_sec) + (b->tv_nsec - a->tv_nsec) * 1e-9;
}


x86 assembly (clang, -O0):
<seconds_between>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%eax
mov    -0x8(%rbp),%rcx
sub    0x8(%rcx),%eax
cvtsi2sd %eax,%xmm0
movsd  0xeca(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<seconds_between>:
movsd  (%rsi),%xmm1
subsd  (%rdi),%xmm1
mov    0x8(%rsi),%eax
sub    0x8(%rdi),%eax
cvtsi2sd %eax,%xmm0
mulsd  0xee6(%rip),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
%struct.timespec = type { double, i32 }
define double @seconds_between(%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** %4
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 0
%7 = load double, double* %6
%8 = load %struct.timespec*, %struct.timespec** %3
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 0
%10 = load double, double* %9
%11 = fsub double %7, %10
%12 = load %struct.timespec*, %struct.timespec** %4
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i32 0, i32 1
%14 = load i32, i32* %13
%15 = load %struct.timespec*, %struct.timespec** %3
%16 = getelementptr inbounds %struct.timespec, %struct.timespec* %15, i32 0, i32 1
%17 = load i32, i32* %16
%18 = sub nsw i32 %14, %17
%19 = sitofp i32 %18 to double
%20 = call double @llvm.fmuladd.f64(double %19, double 1.000000e-09, double %11)
ret double %20
}

LLVM IR (-O2):
%struct.timespec = type { double, i32 }
define double @seconds_between(%struct.timespec* nocapture %0, %struct.timespec* nocapture %1) {
%3 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%6 = load double, double* %5
%7 = fsub double %4, %6
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%11 = load i32, i32* %10
%12 = sub nsw i32 %9, %11
%13 = sitofp i32 %12 to double
%14 = tail call double @llvm.fmuladd.f64(double %13, double 1.000000e-09, double %7)
ret double %14
}
/* Variables and functions */
int /*<<< orphan*/ restart(int);
void RST_30() { restart(0x30); }


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

x86 assembly (clang, -O2):
<RST_30>:
mov    $0x30,%edi
jmp    1030 <restart@plt>

LLVM IR (-O0):
define void @RST_30() {
%1 = call i32 @restart(i32 48)
ret void
}

LLVM IR (-O2):
define void @RST_30() {
%1 = tail call i32 @restart(i32 48)
ret void
}
/* Variables and functions */
int fib_aux(int);
int fib_td(int n) {
  if (n <= 1)
    return n;
  static int tabla_td[100] = {-1};
  return fib_aux(n);
}


x86 assembly (clang, -O0):
<fib_td>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     1130 <fib_td+0x20>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113b <fib_td+0x2b>
mov    -0x8(%rbp),%edi
call   1030 <fib_aux@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib_td>:
cmp    $0x2,%edi
jge    1118 <fib_td+0x8>
mov    %edi,%eax
ret
jmp    1030 <fib_aux@plt>

LLVM IR (-O0):
@fib_td.tabla_td = internal global <{ i32, [99 x i32] }> <{ i32 -1, [99 x i32] zeroinitializer }>
define i32 @fib_td(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i32, i32* %3
store i32 %7, i32* %2
br label %11
8: ; preds = %1
%9 = load i32, i32* %3
%10 = call i32 @fib_aux(i32 %9)
store i32 %10, i32* %2
br label %11
11: ; preds = %8, %6
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @fib_td(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @fib_aux(i32 %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ %0, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ stacktrace();
void f4() { stacktrace(); }


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

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

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

LLVM IR (-O2):
define void @f4() {
%1 = tail call i32 (...) @stacktrace()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void cgi_def_ini(void) {
  fprintf(stderr, "cgi: error: no device drivers specified\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [41 x i8] c"cgi: error: no device drivers specified\0A\00"
define void @cgi_def_ini() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [41 x i8] c"cgi: error: no device drivers specified\0A\00"
define void @cgi_def_ini() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int f417(int *);
int f418(int *p) { return f417(p); }


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

x86 assembly (clang, -O2):
<f418>:
jmp    1030 <f417@plt>

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

LLVM IR (-O2):
define i32 @f418(i32* %0) {
%2 = tail call i32 @f417(i32* %0)
ret i32 %2
}
/* Variables and functions */
scalar_t__ fnmatch(char const *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(char *, char const *, unsigned int);
int match_fnmatch(const char *pattern, const char *buf, unsigned int len) {
  char tmp[len + 1];
  memcpy((tmp), (buf), (len));
  tmp[len] = 0;
  return fnmatch(pattern, tmp, 0) == 0;
}


x86 assembly (clang, -O0):
<match_fnmatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x30(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x30(%rbp),%rsi
mov    -0x14(%rbp),%eax
movb   $0x0,(%rsi,%rax,1)
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
call   1030 <fnmatch@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x20(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_fnmatch>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r15d
mov    %rdi,%r14
lea    0x1(%r15),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
call   1040 <memcpy@plt>
mov    %r15d,%eax
movb   $0x0,(%rax,%rbx,1)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <fnmatch@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @match_fnmatch(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = add i32 %9, 1
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %7
%13 = alloca i8, i64 %11
store i64 %11, i64* %8
%14 = load i8*, i8** %5
%15 = load i32, i32* %6
%16 = call i32 @memcpy(i8* %13, i8* %14, i32 %15)
%17 = load i32, i32* %6
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %13, i64 %18
store i8 0, i8* %19
%20 = load i8*, i8** %4
%21 = call i64 @fnmatch(i8* %20, i8* %13, i32 0)
%22 = icmp eq i64 %21, 0
%23 = zext i1 %22 to i32
%24 = load i8*, i8** %7
ret i32 %23
}

LLVM IR (-O2):
define i32 @match_fnmatch(i8* %0, i8* %1, i32 %2) {
%4 = add i32 %2, 1
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = call i32 @memcpy(i8* %6, i8* %1, i32 %2)
%8 = zext i32 %2 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
store i8 0, i8* %9
%10 = call i64 @fnmatch(i8* %0, i8* %6, i32 0)
%11 = icmp eq i64 %10, 0
%12 = zext i1 %11 to i32
ret i32 %12
}