xunge/DecIR huggingface dataset:
/* Type definitions */
struct ll {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ll_push(struct ll **, struct ll *);
void ll_append(struct ll **tail, struct ll *n) {
  ll_push(tail, n);
  *tail = n;
}


x86 assembly (clang, -O0):
<ll_append>:
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 <ll_push@plt>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ll_append>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <ll_push@plt>
mov    %r14,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.ll = type { i32 }
define void @ll_append(%struct.ll** %0, %struct.ll* %1) {
%3 = alloca %struct.ll**
%4 = alloca %struct.ll*
store %struct.ll** %0, %struct.ll*** %3
store %struct.ll* %1, %struct.ll** %4
%5 = load %struct.ll**, %struct.ll*** %3
%6 = load %struct.ll*, %struct.ll** %4
%7 = call i32 @ll_push(%struct.ll** %5, %struct.ll* %6)
%8 = load %struct.ll*, %struct.ll** %4
%9 = load %struct.ll**, %struct.ll*** %3
store %struct.ll* %8, %struct.ll** %9
ret void
}

LLVM IR (-O2):
%struct.ll = type { i32 }
define void @ll_append(%struct.ll** %0, %struct.ll* %1) {
%3 = tail call i32 @ll_push(%struct.ll** %0, %struct.ll* %1)
store %struct.ll* %1, %struct.ll** %0
ret void
}
/* Variables and functions */
char *getenv(char *);
const char *detect_arch(void) {
  const char *arch;
  arch = getenv("SETUP_ARCH");
  if (arch == NULL) {
    arch = "x86_64";
  }
  return arch;
}


x86 assembly (clang, -O0):
<detect_arch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113e <detect_arch+0x2e>
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<detect_arch>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
lea    0xee4(%rip),%rcx
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"SETUP_ARCH\00"
@.str.1 = [7 x i8] c"x86_64\00"
define i8* @detect_arch() {
%1 = alloca i8*
%2 = call i8* @getenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %6
5: ; preds = %0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %6
6: ; preds = %5, %0
%7 = load i8*, i8** %1
ret i8* %7
}

LLVM IR (-O2):
@.str = [11 x i8] c"SETUP_ARCH\00"
@.str.1 = [7 x i8] c"x86_64\00"
define i8* @detect_arch() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
%3 = select i1 %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %1
ret i8* %3
}
/* Variables and functions */
int TTWAIN_Native2RasterPD(void *, void *, int *, int *);
int TTWAIN_Native2Raster(void *handle, void *the_ras, int *lx, int *ly) {
  return TTWAIN_Native2RasterPD(handle, the_ras, lx, ly);
}


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

x86 assembly (clang, -O2):
<TTWAIN_Native2Raster>:
jmp    1030 <TTWAIN_Native2RasterPD@plt>

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

LLVM IR (-O2):
define i32 @TTWAIN_Native2Raster(i8* %0, i8* %1, i32* %2, i32* %3) {
%5 = tail call i32 @TTWAIN_Native2RasterPD(i8* %0, i8* %1, i32* %2, i32* %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_buf(const unsigned char *buf, int len) {
  int i;
  for (i = 0; i < len; i++) {
    printf("%02x ", buf[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_buf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115a <print_buf+0x4a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_buf+0x16>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_buf>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1158 <print_buf+0x38>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print_buf+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"%02x \00"
define void @print_buf(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
%15 = tail call i32 @putchar(i32 10)
ret void
}
int intel_num_planes(struct intel_crtc *crtc) { return 3; }


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

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

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

LLVM IR (-O2):
%struct.intel_crtc = type opaque
define i32 @intel_num_planes(%struct.intel_crtc* nocapture readnone %0) {
ret i32 3
}
/* Variables and functions */
scalar_t__ crypt(char *, char *);
char *ib_password(char *val) {
  val = (char *)crypt(val, "9z");
  val = (char *)(crypt(val + 2, "9z") + 2);
  return (char *)val;
}


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

x86 assembly (clang, -O2):
<ib_password>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rsi
call   1030 <crypt@plt>
lea    0x2(%rax),%rdi
mov    %rbx,%rsi
call   1030 <crypt@plt>
add    $0x2,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"9z\00"
define i8* @ib_password(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @crypt(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 2
%8 = call i64 @crypt(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = add nsw i64 %8, 2
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %2
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
@.str = [3 x i8] c"9z\00"
define i8* @ib_password(i8* %0) {
%2 = tail call i64 @crypt(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = inttoptr i64 %2 to i8*
%4 = getelementptr inbounds i8, i8* %3, i64 2
%5 = tail call i64 @crypt(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = add nsw i64 %5, 2
%7 = inttoptr i64 %6 to i8*
ret i8* %7
}
void foo(int *a, char *b, char *c) {
  __builtin_memmove(c, b, a[c[0]]);
  __builtin_memmove(c, b, a[b[0]]);
  int d = c[0] == b[0];
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbq (%rcx),%rcx
movslq (%rax,%rcx,4),%rdx
call   1030 <memmove@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbq (%rcx),%rcx
movslq (%rax,%rcx,4),%rdx
call   1030 <memmove@plt>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
movsbq (%rdx),%rax
movslq (%rdi,%rax,4),%rdx
mov    %rbx,%rdi
call   1030 <memmove@plt>
movsbq (%r14),%rax
movslq (%r15,%rax,4),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <memmove@plt>

LLVM IR (-O0):
define void @foo(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = load i8*, i8** %5
%10 = load i32*, i32** %4
%11 = load i8*, i8** %6
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i64
%15 = getelementptr inbounds i32, i32* %10, i64 %14
%16 = load i32, i32* %15
%17 = sext i32 %16 to i64
%18 = load i8*, i8** %6
%19 = load i8*, i8** %5
%20 = load i32*, i32** %4
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i64 0
%23 = load i8, i8* %22
%24 = sext i8 %23 to i64
%25 = getelementptr inbounds i32, i32* %20, i64 %24
%26 = load i32, i32* %25
%27 = sext i32 %26 to i64
%28 = load i8*, i8** %6
%29 = getelementptr inbounds i8, i8* %28, i64 0
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = load i8*, i8** %5
%33 = getelementptr inbounds i8, i8* %32, i64 0
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %31, %35
%37 = zext i1 %36 to i32
store i32 %37, i32* %7
ret void
}

LLVM IR (-O2):
define void @foo(i32* nocapture %0, i8* nocapture %1, i8* nocapture %2) {
%4 = load i8, i8* %2
%5 = sext i8 %4 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = load i32, i32* %6
%8 = sext i32 %7 to i64
tail call void @llvm.memmove.p0i8.p0i8.i64(i8* align 1 %2, i8* align 1 %1, i64 %8, i1 false)
%9 = load i8, i8* %1
%10 = sext i8 %9 to i64
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = sext i32 %12 to i64
tail call void @llvm.memmove.p0i8.p0i8.i64(i8* align 1 %2, i8* align 1 %1, i64 %13, i1 false)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ btree_close(int);
int /*<<< orphan*/ dfile_close(int);
void g_close_object_file(int file_id) {
  dfile_close(file_id);
  btree_close(file_id);
}


x86 assembly (clang, -O0):
<g_close_object_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <dfile_close@plt>
mov    -0x4(%rbp),%edi
call   1040 <btree_close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_close_object_file>:
push   %rbx
mov    %edi,%ebx
call   1030 <dfile_close@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <btree_close@plt>

LLVM IR (-O0):
define void @g_close_object_file(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @dfile_close(i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @btree_close(i32 %5)
ret void
}

LLVM IR (-O2):
define void @g_close_object_file(i32 %0) {
%2 = tail call i32 @dfile_close(i32 %0)
%3 = tail call i32 @btree_close(i32 %0)
ret void
}
void find_addr2line(void) {}


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

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

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

LLVM IR (-O2):
define void @find_addr2line() {
ret void
}
void g_option_group_add_entries() {}


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

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

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

LLVM IR (-O2):
define void @g_option_group_add_entries() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ write(int, unsigned char *, unsigned int);
ssize_t i2c_write(int fd, unsigned char *buf, unsigned int len) {
  assert(NULL != buf);
  return write(fd, buf, len);
}


x86 assembly (clang, -O0):
<i2c_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_write>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %edi,%edi
test   %rsi,%rsi
setne  %dil
call   1040 <assert@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <write@plt>

LLVM IR (-O0):
define i32 @i2c_write(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %5
%8 = icmp ne i8* null, %7
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i32, i32* %4
%12 = load i8*, i8** %5
%13 = load i32, i32* %6
%14 = call i32 @write(i32 %11, i8* %12, i32 %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @i2c_write(i32 %0, i8* %1, i32 %2) {
%4 = icmp ne i8* %1, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @write(i32 %0, i8* %1, i32 %2)
ret i32 %7
}
/* Variables and functions */
void *memalloc(int);
void *memset(void *, int /*<<< orphan*/, int);
void *memalloczeroed(int size) {
  void *p = memalloc(size);
  return memset(p, 0, size);
}


x86 assembly (clang, -O0):
<memalloczeroed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <memalloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
xor    %esi,%esi
call   1040 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memalloczeroed>:
push   %rbx
mov    %edi,%ebx
call   1030 <memalloc@plt>
mov    %rax,%rdi
xor    %esi,%esi
mov    %ebx,%edx
pop    %rbx
jmp    1040 <memset@plt>

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

LLVM IR (-O2):
define i8* @memalloczeroed(i32 %0) {
%2 = tail call i8* @memalloc(i32 %0)
%3 = tail call i8* @memset(i8* %2, i32 0, i32 %0)
ret i8* %3
}
/* Variables and functions */
int SSL_read(void *, void *, int);
int dv_openssl_error(void *, int);
int dv_openssl_read(void *s, void *buf, int num) {
  int ret = 0;
  ret = SSL_read(s, buf, num);
  if (ret >= 0) {
    return ret;
  }
  return dv_openssl_error(s, ret);
}


x86 assembly (clang, -O0):
<dv_openssl_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <SSL_read@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jl     1162 <dv_openssl_read+0x42>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1171 <dv_openssl_read+0x51>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1030 <dv_openssl_error@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dv_openssl_read>:
push   %rbx
mov    %rdi,%rbx
call   1040 <SSL_read@plt>
test   %eax,%eax
js     112f <dv_openssl_read+0xf>
pop    %rbx
ret
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1030 <dv_openssl_error@plt>

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

LLVM IR (-O2):
define i32 @dv_openssl_read(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @SSL_read(i8* %0, i8* %1, i32 %2)
%5 = icmp sgt i32 %4, -1
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @dv_openssl_error(i8* %0, i32 %4)
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ %7, %6 ], [ %4, %3 ]
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int Pclose(FILE *fp) {
  int n;
  if ((n = pclose(fp)) == -1)
    fprintf(stderr, "pclose error");
  return (n);
}


x86 assembly (clang, -O0):
<Pclose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pclose@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
jne    1156 <Pclose+0x36>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
lea    0xeaf(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pclose>:
push   %rbx
call   1030 <pclose@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1142 <Pclose+0x22>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
lea    0xec3(%rip),%rsi
call   1040 <fprintf@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [13 x i8] c"pclose error\00"
define i32 @Pclose(i32* nocapture %0) {
%2 = tail call i32 @pclose(i32* %0)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %4, %1
ret i32 %2
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t swap(uint8_t val) { return ((val >> 4) & 0xFF) | ((val & 0xFF) << 4); }


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
and    $0xff,%eax
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
shl    $0x4,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movzbl %dil,%eax
shr    $0x4,%edi
movzbl %dil,%ecx
shl    $0x4,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @swap(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 4
%5 = and i32 %4, 255
%6 = load i32, i32* %2
%7 = and i32 %6, 255
%8 = shl i32 %7, 4
%9 = or i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @swap(i32 %0) {
%2 = lshr i32 %0, 4
%3 = and i32 %2, 255
%4 = shl i32 %0, 4
%5 = and i32 %4, 4080
%6 = or i32 %3, %5
ret i32 %6
}
void mpu_enable(int enable) {
  unsigned long *pmpu = (unsigned long *)0xE000ED90;
  if (enable)
    *(pmpu + 1) = 0x7;
  else
    *(pmpu + 1) = 0x0;
}


x86 assembly (clang, -O0):
<mpu_enable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0xe000ed90,%eax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     112b <mpu_enable+0x2b>
mov    -0x10(%rbp),%rax
movq   $0x7,0x8(%rax)
jmp    1137 <mpu_enable+0x37>
mov    -0x10(%rbp),%rax
movq   $0x0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpu_enable>:
xor    %eax,%eax
test   %edi,%edi
mov    $0x7,%ecx
cmove  %rax,%rcx
mov    $0xe000ed98,%eax
mov    %rcx,(%rax)
ret

LLVM IR (-O0):
define void @mpu_enable(i32 %0) {
%2 = alloca i32
%3 = alloca i64*
store i32 %0, i32* %2
store i64* inttoptr (i64 3758157200 to i64*), i64** %3
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i64*, i64** %3
%8 = getelementptr inbounds i64, i64* %7, i64 1
store i64 7, i64* %8
br label %12
9: ; preds = %1
%10 = load i64*, i64** %3
%11 = getelementptr inbounds i64, i64* %10, i64 1
store i64 0, i64* %11
br label %12
12: ; preds = %9, %6
ret void
}

LLVM IR (-O2):
define void @mpu_enable(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i64 0, i64 7
store i64 %3, i64* inttoptr (i64 3758157208 to i64*)
ret void
}
void window_title_exit_emptysub() {}


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

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

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

LLVM IR (-O2):
define void @window_title_exit_emptysub() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "usage: banner [-d] [-t] [-w width] message ...\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [48 x i8] c"usage: banner [-d] [-t] [-w width] message ...\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [48 x i8] c"usage: banner [-d] [-t] [-w width] message ...\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
__attribute((section(".ghc.f2.1"), used)) void f2(int n) {
  printf("f2: %d\n", n * 2);
}


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

x86 assembly (clang, -O2):
<f2>:
lea    (%rdi,%rdi,1),%esi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"f2: %d\0A\00"
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void (i32)* @f2 to i8*)], section "llvm.metadata"
define void @f2(i32 %0) section ".ghc.f2.1" {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 2
%5 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"f2: %d\0A\00"
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void (i32)* @f2 to i8*)], section "llvm.metadata"
define void @f2(i32 %0) section ".ghc.f2.1" {
%2 = shl nsw i32 %0, 1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
char *dconv(n, s)
register char *s;
register unsigned n;
{
  *s = 0;
  do {
    *--s = n % 10 + '0';
  } while ((n /= 10) != 0);
  return s;
}


x86 assembly (clang, -O0):
<dconv>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,-0x1(%rax)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jne    1112 <dconv+0x12>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dconv>:
mov    %rsi,%rax
movb   $0x0,(%rsi)
mov    $0xcccccccd,%r8d
nopl   0x0(%rax)
mov    %edi,%edx
imul   %r8,%rdx
shr    $0x23,%rdx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edi,%ecx
sub    %esi,%ecx
or     $0x30,%cl
mov    %cl,-0x1(%rax)
add    $0xffffffffffffffff,%rax
cmp    $0x9,%edi
mov    %edx,%edi
ja     1110 <dconv+0x10>
ret

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

LLVM IR (-O2):
define i8* @dconv(i32 %0, i8* writeonly %1) {
store i8 0, i8* %1
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ %0, %2 ], [ %10, %3 ]
%5 = phi i8* [ %1, %2 ], [ %9, %3 ]
%6 = urem i32 %4, 10
%7 = trunc i32 %6 to i8
%8 = or i8 %7, 48
%9 = getelementptr inbounds i8, i8* %5, i64 -1
store i8 %8, i8* %9
%10 = udiv i32 %4, 10
%11 = icmp ult i32 %4, 10
br i1 %11, label %12, label %3
12: ; preds = %3
ret i8* %9
}
int test_imm_DDint32_mem(int *val) {
  return ((*val) & (0xDD << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_DDint32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 221
%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_DDint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 221
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ IF_mult();
int /*<<< orphan*/ putLong(long long);
void IF_neg(void) {
  putLong((long long)-1);
  IF_mult();
}


x86 assembly (clang, -O0):
<IF_neg>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffffffffffff,%rdi
call   1040 <putLong@plt>
mov    $0x0,%al
call   1030 <IF_mult@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<IF_neg>:
push   %rax
mov    $0xffffffffffffffff,%rdi
call   1040 <putLong@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <IF_mult@plt>

LLVM IR (-O0):
define void @IF_neg() {
%1 = call i32 @putLong(i64 -1)
%2 = call i32 (...) @IF_mult()
ret void
}

LLVM IR (-O2):
define void @IF_neg() {
%1 = tail call i32 @putLong(i64 -1)
%2 = tail call i32 (...) @IF_mult()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fileno(int /*<<< orphan*/);
scalar_t__ isatty(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
void printfail() {
  printf(isatty(fileno(stdout)) ? "\e[1;31mFailed\e[0m\n" : "Failed\n");
}


x86 assembly (clang, -O0):
<printfail>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1050 <fileno@plt>
mov    %eax,%edi
call   1030 <isatty@plt>
mov    %rax,%rcx
lea    0xec0(%rip),%rdi
lea    0xea6(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<printfail>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1050 <fileno@plt>
mov    %eax,%edi
call   1030 <isatty@plt>
test   %rax,%rax
lea    0xec3(%rip),%rax
lea    0xea9(%rip),%rdi
cmove  %rax,%rdi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [19 x i8] c"\1B[1;31mFailed\1B[0m\0A\00"
@.str.1 = [8 x i8] c"Failed\0A\00"
define void @printfail() {
%1 = load i32, i32* @stdout
%2 = call i32 @fileno(i32 %1)
%3 = call i64 @isatty(i32 %2)
%4 = icmp ne i64 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0)
%7 = call i32 @printf(i8* %6)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [19 x i8] c"\1B[1;31mFailed\1B[0m\0A\00"
@.str.1 = [8 x i8] c"Failed\0A\00"
define void @printfail() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fileno(i32 %1)
%3 = tail call i64 @isatty(i32 %2)
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0)
%6 = tail call i32 @printf(i8* dereferenceable(1) %5)
ret void
}
/* Variables and functions */
bool nrf53_errata_84(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf53_errata_84() {
ret i32 0
}
void l2x0_restart(void) {}


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

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

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

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

/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ pgen_alloc_bst_insert(struct bst_node **, void *);
void *pgen_alloc(struct bst_node *bst, size_t size) {
  void *p;
  if (!(p = malloc(size)))
    return NULL;
  if (!pgen_alloc_bst_insert(&bst, p))
    return NULL;
  return p;
}


x86 assembly (clang, -O0):
<pgen_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1154 <pgen_alloc+0x34>
movq   $0x0,-0x8(%rbp)
jmp    117f <pgen_alloc+0x5f>
mov    -0x20(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1030 <pgen_alloc_bst_insert@plt>
cmp    $0x0,%eax
jne    1177 <pgen_alloc+0x57>
movq   $0x0,-0x8(%rbp)
jmp    117f <pgen_alloc+0x5f>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pgen_alloc>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,0x8(%rsp)
mov    %rsi,%rdi
call   1040 <malloc@plt>
test   %rax,%rax
je     1153 <pgen_alloc+0x33>
mov    %rax,%rbx
lea    0x8(%rsp),%rdi
mov    %rax,%rsi
call   1030 <pgen_alloc_bst_insert@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
cmovne %rbx,%rax
jmp    1155 <pgen_alloc+0x35>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.bst_node = type { i32 }
define i8* @pgen_alloc(%struct.bst_node* %0, i64 %1) {
%3 = alloca %struct.bst_node*
store %struct.bst_node* %0, %struct.bst_node** %3
%4 = tail call i8* @malloc(i64 %1)
%5 = icmp eq i8* %4, null
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = call i32 @pgen_alloc_bst_insert(%struct.bst_node** %3, i8* %4)
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i8* null, i8* %4
br label %10
10: ; preds = %6, %2
%11 = phi i8* [ null, %2 ], [ %9, %6 ]
ret i8* %11
}
unsigned short z2w10bit(unsigned short z) {
  return (0x03 & (z >> 8)) | ((0xFF & z) << 2);
}


x86 assembly (clang, -O0):
<z2w10bit>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
and    $0x3,%eax
movzwl -0x2(%rbp),%ecx
and    $0xff,%ecx
shl    $0x2,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<z2w10bit>:
movzbl %dil,%eax
mov    %edi,%ecx
shr    $0x8,%ecx
and    $0x3,%ecx
lea    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define zeroext i16 @z2w10bit(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = ashr i32 %4, 8
%6 = and i32 3, %5
%7 = load i16, i16* %2
%8 = zext i16 %7 to i32
%9 = and i32 255, %8
%10 = shl i32 %9, 2
%11 = or i32 %6, %10
%12 = trunc i32 %11 to i16
ret i16 %12
}

LLVM IR (-O2):
define zeroext i16 @z2w10bit(i16 zeroext %0) {
%2 = lshr i16 %0, 8
%3 = and i16 %2, 3
%4 = shl i16 %0, 2
%5 = and i16 %4, 1020
%6 = or i16 %3, %5
ret i16 %6
}
int __islower_ascii(int ch) { return (unsigned int)(ch - 'a') < 26u; }


x86 assembly (clang, -O0):
<__islower_ascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x61,%eax
cmp    $0x1a,%eax
setb   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__islower_ascii>:
add    $0xffffff9f,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @__islower_ascii(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 97
%5 = icmp ult i32 %4, 26
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @__islower_ascii(i32 %0) {
%2 = add nsw i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
bool letter(char c) {
  return ((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'));
}


x86 assembly (clang, -O0):
<letter>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1129 <letter+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5a,%ecx
mov    %al,-0x2(%rbp)
jle    114e <letter+0x4e>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x61,%ecx
mov    %al,-0x3(%rbp)
jl     1148 <letter+0x48>
movsbl -0x1(%rbp),%eax
cmp    $0x7a,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<letter>:
and    $0xdf,%dil
add    $0xbf,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @letter(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 90
br i1 %9, label %20, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 97
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 122
br label %18
18: ; preds = %14, %10
%19 = phi i1 [ false, %10 ], [ %17, %14 ]
br label %20
20: ; preds = %18, %6
%21 = phi i1 [ true, %6 ], [ %19, %18 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @letter(i8 signext %0) {
%2 = and i8 %0, -33
%3 = add i8 %2, -65
%4 = icmp ult i8 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fork();
int main(void) {
  for (;;)
    fork();
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <fork@plt>
jmp    111f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <fork@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %2, %0
%3 = call i32 (...) @fork()
br label %2
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @fork()
br label %1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int find_pids_pos(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                  int /*<<< orphan*/ *, int /*<<< orphan*/ *, int,
                  int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                  int /*<<< orphan*/ *);
int find_pids(uint16_t *vpid, uint16_t *apid, uint16_t *ac3pid, uint8_t *buf,
              int len) {
  return find_pids_pos(vpid, apid, ac3pid, buf, len, NULL, NULL, NULL);
}


x86 assembly (clang, -O0):
<find_pids>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%r9d
movq   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
call   1030 <find_pids_pos@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_pids>:
sub    $0x18,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,(%rsp)
xor    %r9d,%r9d
call   1030 <find_pids_pos@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @find_pids(i32* %0, i32* %1, i32* %2, i32* %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32 %4, i32* %10
%11 = load i32*, i32** %6
%12 = load i32*, i32** %7
%13 = load i32*, i32** %8
%14 = load i32*, i32** %9
%15 = load i32, i32* %10
%16 = call i32 @find_pids_pos(i32* %11, i32* %12, i32* %13, i32* %14, i32 %15, i32* null, i32* null, i32* null)
ret i32 %16
}

LLVM IR (-O2):
define i32 @find_pids(i32* %0, i32* %1, i32* %2, i32* %3, i32 %4) {
%6 = tail call i32 @find_pids_pos(i32* %0, i32* %1, i32* %2, i32* %3, i32 %4, i32* null, i32* null, i32* null)
ret i32 %6
}
/* Variables and functions */
int fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int f_black() { return fputs("[30m", stdout); }


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

x86 assembly (clang, -O2):
<f_black>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"\1B[30m\00"
@stdout = global i32 0
define i32 @f_black() {
%1 = load i32, i32* @stdout
%2 = call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[30m\00"
@stdout = global i32 0
define i32 @f_black() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ isdigit(unsigned char);
int alldigits(const char *s) {
  unsigned char c;
  c = *s++;
  do {
    if (!isdigit(c))
      return 0;
  } while ((c = *s++) != 0);
  return 1;
}


x86 assembly (clang, -O0):
<alldigits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    114e <alldigits+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    117a <alldigits+0x6a>
jmp    1153 <alldigits+0x43>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movzbl %al,%eax
cmp    $0x0,%eax
jne    1130 <alldigits+0x20>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alldigits>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
add    $0x1,%rbx
nopw   0x0(%rax,%rax,1)
movzbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     113e <alldigits+0x2e>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <alldigits+0x10>
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @alldigits(i8* nocapture %0) {
%2 = load i8, i8* %0
br label %3
3: ; preds = %9, %1
%4 = phi i8* [ %0, %1 ], [ %6, %9 ]
%5 = phi i8 [ %2, %1 ], [ %10, %9 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = tail call i32 @isdigit(i8 zeroext %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = load i8, i8* %6
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %3
12: ; preds = %9, %3
%13 = phi i32 [ 0, %3 ], [ 1, %9 ]
ret i32 %13
}
/* Variables and functions */
double M_PI;
double rad2deg(double rad) { return rad * 180.0 / M_PI; }


x86 assembly (clang, -O0):
<rad2deg>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mov    0x2ecb(%rip),%rax
divsd  (%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rad2deg>:
mulsd  0xef8(%rip),%xmm0
mov    0x2ed9(%rip),%rax
divsd  (%rax),%xmm0
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @rad2deg(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 1.800000e+02
%5 = load double, double* @M_PI
%6 = fdiv double %4, %5
ret double %6
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @rad2deg(double %0) {
%2 = fmul double %0, 1.800000e+02
%3 = load double, double* @M_PI
%4 = fdiv double %2, %3
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_dmatrix(double **m, long nrl, long nrh, long ncl, long nch) {
  free((char *)(m[nrl] + ncl - 1));
  free((char *)(m + nrl - 1));
}


x86 assembly (clang, -O0):
<free_dmatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x20(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_dmatrix>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi,%rsi,8),%rax
lea    (%rax,%rcx,8),%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <free@plt>
lea    (%rbx,%r14,8),%rdi
add    $0xfffffffffffffff8,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_dmatrix(double** nocapture %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = getelementptr inbounds double*, double** %0, i64 %1
%7 = load double*, double** %6
%8 = getelementptr inbounds double, double* %7, i64 %3
%9 = getelementptr inbounds double, double* %8, i64 -1
%10 = bitcast double* %9 to i8*
%11 = tail call i32 @free(i8* %10)
%12 = getelementptr inbounds double*, double** %6, i64 -1
%13 = bitcast double** %12 to i8*
%14 = tail call i32 @free(i8* %13)
ret void
}