xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, int);
char *xmalloc(int);
char *memdup(const char *str, int len) {
  char *s = xmalloc(len + 1);
  memcpy(s, str, len);
  s[len] = 0;
  return s;
}


x86 assembly (clang, -O0):
<memdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1030 <xmalloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memdup>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r15d
mov    %rdi,%r14
lea    0x1(%r15),%edi
call   1030 <xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1040 <memcpy@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @memdup(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 1
%8 = call i8* @xmalloc(i32 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = load i8*, i8** %3
%11 = load i32, i32* %4
%12 = call i32 @memcpy(i8* %9, i8* %10, i32 %11)
%13 = load i8*, i8** %5
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
store i8 0, i8* %16
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
define i8* @memdup(i8* %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call i8* @xmalloc(i32 %3)
%5 = tail call i32 @memcpy(i8* %4, i8* %0, i32 %1)
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i8, i8* %4, i64 %6
store i8 0, i8* %7
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ fail();
int /*<<< orphan*/ printf(char *, char *);
void senderr(char *component) {
  printf("Could not send %s to server\n", component);
  fail();
}


x86 assembly (clang, -O0):
<senderr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <fail@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<senderr>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <fail@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"Could not send %s to server\0A\00"
define void @senderr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (...) @fail()
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"Could not send %s to server\0A\00"
define void @senderr(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (...) @fail()
ret void
}
void handle_62(int sig) {}


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

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

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

LLVM IR (-O2):
define void @handle_62(i32 %0) {
ret void
}
/* Type definitions */
struct iphdr {
  int /*<<< orphan*/ tos;
};
typedef int /*<<< orphan*/ __u8;

/* Variables and functions */
__u8 ipv4_get_dsfield(struct iphdr *iph) { return iph->tos; }


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

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

LLVM IR (-O0):
%struct.iphdr = type { i32 }
define i32 @ipv4_get_dsfield(%struct.iphdr* %0) {
%2 = alloca %struct.iphdr*
store %struct.iphdr* %0, %struct.iphdr** %2
%3 = load %struct.iphdr*, %struct.iphdr** %2
%4 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %3, i32 0, i32 0
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
%struct.iphdr = type { i32 }
define i32 @ipv4_get_dsfield(%struct.iphdr* nocapture %0) {
%2 = getelementptr inbounds %struct.iphdr, %struct.iphdr* %0, i64 0, i32 0
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_byte_sh(short s) {
  int i;
  unsigned char *p;
  p = (unsigned char *)&s;
  for (i = 0; i < sizeof(short); i++) {
    printf("%02x", *p);
    p++;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_byte_sh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
lea    -0x2(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
cmp    $0x2,%rax
jae    116b <print_byte_sh+0x5b>
mov    -0x10(%rbp),%rax
movzbl (%rax),%esi
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112e <print_byte_sh+0x1e>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_byte_sh>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%eax
movzbl %ah,%ebx
movzbl %al,%esi
lea    0xecd(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%02x\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_byte_sh(i16 signext %0) {
%2 = alloca i16
%3 = alloca i32
%4 = alloca i8*
store i16 %0, i16* %2
%5 = bitcast i16* %2 to i8*
store i8* %5, i8** %4
store i32 0, i32* %3
br label %6
6: ; preds = %17, %1
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = icmp ult i64 %8, 2
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %4
br label %17
17: ; preds = %10
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %6
20: ; preds = %6
%21 = 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 = [5 x i8] c"%02x\00"
define void @print_byte_sh(i16 signext %0) {
%2 = lshr i16 %0, 8
%3 = zext i16 %2 to i32
%4 = and i16 %0, 255
%5 = zext i16 %4 to i32
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %3)
%8 = tail call i32 @putchar(i32 10)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ waitpid(int, int *, int /*<<< orphan*/);
void sig_chld(int signo) {
  pid_t pid;
  int stat;
  while ((pid = waitpid(-1, &stat, WNOHANG)) > 0) {
  }
  return;
}


x86 assembly (clang, -O0):
<sig_chld>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
lea    -0xc(%rbp),%rsi
call   1030 <waitpid@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1143 <sig_chld+0x33>
jmp    111b <sig_chld+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_chld>:
push   %r14
push   %rbx
push   %rax
mov    0x2ecd(%rip),%r14
lea    0x4(%rsp),%rbx
mov    (%r14),%edx
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1030 <waitpid@plt>
test   %eax,%eax
jg     1120 <sig_chld+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@WNOHANG = global i32 0
define void @sig_chld(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
br label %4
4: ; preds = %4, %1
%5 = load i32, i32* @WNOHANG
%6 = call i32 @waitpid(i32 -1, i32* %2, i32 %5)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %4, label %8
8: ; preds = %4
ret void
}
/* Variables and functions */
int foo_1();
__attribute__((no)) int foo(void) { return foo_1(); }


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

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

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

LLVM IR (-O2):
define i32 @foo() {
%1 = tail call i32 (...) @foo_1()
ret i32 %1
}
cbuf18(f, n) { return (cbuf(f, n, 18)); }


x86 assembly (clang, -O0):
<cbuf18>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x12,%edx
mov    $0x0,%al
call   1030 <cbuf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbuf18>:
mov    $0x12,%edx
xor    %eax,%eax
jmp    1030 <cbuf@plt>

LLVM IR (-O0):
define i32 @cbuf18(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 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %5, i32 %6, i32 18)
ret i32 %7
}

LLVM IR (-O2):
define i32 @cbuf18(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %0, i32 %1, i32 18)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("Hello, World!\n");
  exit(0);
}


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, World!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [14 x i8] c"Hello, World!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello world!\n");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eae(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2ebc(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello world!\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [13 x i8] c"Hello world!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
ret i32 %2
}
/* Type definitions */
struct tempfile {
  int dummy;
};

/* Variables and functions */
int xmks_tempfile_m(struct tempfile *, char const *, int);
int xmks_tempfile(struct tempfile *tempfile, const char *template) {
  return xmks_tempfile_m(tempfile, template, 0600);
}


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

x86 assembly (clang, -O2):
<xmks_tempfile>:
mov    $0x180,%edx
jmp    1030 <xmks_tempfile_m@plt>

LLVM IR (-O0):
%struct.tempfile = type { i32 }
define i32 @xmks_tempfile(%struct.tempfile* %0, i8* %1) {
%3 = alloca %struct.tempfile*
%4 = alloca i8*
store %struct.tempfile* %0, %struct.tempfile** %3
store i8* %1, i8** %4
%5 = load %struct.tempfile*, %struct.tempfile** %3
%6 = load i8*, i8** %4
%7 = call i32 @xmks_tempfile_m(%struct.tempfile* %5, i8* %6, i32 384)
ret i32 %7
}

LLVM IR (-O2):
%struct.tempfile = type { i32 }
define i32 @xmks_tempfile(%struct.tempfile* %0, i8* %1) {
%3 = tail call i32 @xmks_tempfile_m(%struct.tempfile* %0, i8* %1, i32 384)
ret i32 %3
}
/* Variables and functions */
int EXIT_SUCCESS;
int FrontRearIndex(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  printf("%d\n", FrontRearIndex("aaaaacefghij", "aaac", 0));
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec7(%rip),%rdi
lea    0xecd(%rip),%rsi
xor    %edx,%edx
call   1040 <FrontRearIndex@plt>
mov    %eax,%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedc(%rip),%rdi
lea    0xee2(%rip),%rsi
xor    %edx,%edx
call   1040 <FrontRearIndex@plt>
lea    0xec3(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [13 x i8] c"aaaaacefghij\00"
@.str.2 = [5 x i8] c"aaac\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @FrontRearIndex(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void ttl_error_print_nl(FILE *f) { fprintf(f, "\n"); }


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

x86 assembly (clang, -O2):
<ttl_error_print_nl>:
mov    %rdi,%rsi
mov    $0xa,%edi
jmp    1030 <fputc@plt>

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

LLVM IR (-O2):
define void @ttl_error_print_nl(i32* nocapture %0) {
%2 = tail call i32 @fputc(i32 10, i32* %0)
ret void
}
/* Variables and functions */
int __set_attribute(int, char *, char *);
int pin_set_direction(int pin, int direction) {
  if (direction != 0 && direction != 1)
    return -1;
  return __set_attribute(pin, "direction", direction == 0 ? "in" : "out");
}


x86 assembly (clang, -O0):
<pin_set_direction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     113e <pin_set_direction+0x2e>
cmpl   $0x1,-0xc(%rbp)
je     113e <pin_set_direction+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1168 <pin_set_direction+0x58>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%ecx
lea    0xec2(%rip),%rdx
lea    0xeb8(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rdx
lea    0xea0(%rip),%rsi
call   1030 <__set_attribute@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pin_set_direction>:
cmp    $0x1,%esi
ja     1135 <pin_set_direction+0x25>
test   %esi,%esi
lea    0xeec(%rip),%rax
lea    0xee8(%rip),%rdx
cmove  %rax,%rdx
lea    0xed0(%rip),%rsi
jmp    1030 <__set_attribute@plt>
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"direction\00"
@.str.1 = [3 x i8] c"in\00"
@.str.2 = [4 x i8] c"out\00"
define i32 @pin_set_direction(i32 %0, i32 %1) {
%3 = icmp ult i32 %1, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = icmp eq i32 %1, 0
%6 = select i1 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%7 = tail call i32 @__set_attribute(i32 %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ -1, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ free(void *);
void xfree(void *ptr) {
  assert(ptr != NULL);
  free(ptr);
}


x86 assembly (clang, -O0):
<xfree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfree>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @xfree(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 = call i32 @free(i8* %7)
ret void
}

LLVM IR (-O2):
define void @xfree(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ genincrdecr(char *, int);
extern void genpush(int d) { genincrdecr("incr", d); }


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

x86 assembly (clang, -O2):
<genpush>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <genincrdecr@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"incr\00"
define void @genpush(i32 %0) {
%2 = tail call i32 @genincrdecr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
usage() {
  fprintf(stderr, "usage: %s from:to file\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 = [24 x i8] c"usage: %s from:to file\0A\00"
define i32 @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"usage: %s from:to file\0A\00"
define i32 @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int strncasecmp(char const *, char const *, size_t);
int jet_strncasecmp(const char *s1, const char *s2, size_t n) {
  return strncasecmp(s1, s2, n);
}


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

x86 assembly (clang, -O2):
<jet_strncasecmp>:
jmp    1030 <strncasecmp@plt>

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

LLVM IR (-O2):
define i32 @jet_strncasecmp(i8* nocapture %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @strncasecmp(i8* %0, i8* %1, i64 %2)
ret i32 %4
}
unsigned char GetExifTypeSize(unsigned short exifType) {
  switch (exifType) {
  case 1:
    return 1;
  case 2:
    return 1;
  case 3:
    return 2;
  case 4:
    return 4;
  case 5:
    return 8;
  case 7:
    return 1;
  case 9:
    return 4;
  case 10:
    return 8;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<GetExifTypeSize>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x9,%eax
ja     117d <GetExifTypeSize+0x7d>
mov    -0x10(%rbp),%rax
lea    0xed4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x1,-0x1(%rbp)
jmp    1181 <GetExifTypeSize+0x81>
movb   $0x1,-0x1(%rbp)
jmp    1181 <GetExifTypeSize+0x81>
movb   $0x2,-0x1(%rbp)
jmp    1181 <GetExifTypeSize+0x81>
movb   $0x4,-0x1(%rbp)
jmp    1181 <GetExifTypeSize+0x81>
movb   $0x8,-0x1(%rbp)
jmp    1181 <GetExifTypeSize+0x81>
movb   $0x1,-0x1(%rbp)
jmp    1181 <GetExifTypeSize+0x81>
movb   $0x4,-0x1(%rbp)
jmp    1181 <GetExifTypeSize+0x81>
movb   $0x8,-0x1(%rbp)
jmp    1181 <GetExifTypeSize+0x81>
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetExifTypeSize>:
add    $0xffffffff,%edi
cmp    $0x9,%di
ja     1118 <GetExifTypeSize+0x18>
movswq %di,%rax
lea    0xeec(%rip),%rcx
mov    (%rax,%rcx,1),%al
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
@switch.table.GetExifTypeSize = [10 x i8] c"\01\01\02\04\08\00\01\00\04\08"
define zeroext i8 @GetExifTypeSize(i16 zeroext %0) {
%2 = add i16 %0, -1
%3 = icmp ult i16 %2, 10
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i16 %2 to i64
%6 = getelementptr inbounds [10 x i8], [10 x i8]* @switch.table.GetExifTypeSize, i64 0, i64 %5
%7 = load i8, i8* %6
br label %8
8: ; preds = %1, %4
%9 = phi i8 [ %7, %4 ], [ 0, %1 ]
ret i8 %9
}
/* Variables and functions */
int /*<<< orphan*/ asprintf(char **, char *, char const *);
const char *foo(const char *str) {
  char *result;
  asprintf(&result, "foo(%s)", str);
  return result;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    -0x10(%rbp),%rdi
lea    0xed5(%rip),%rsi
call   1030 <asprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
mov    %rdi,%rdx
lea    0xee5(%rip),%rsi
mov    %rsp,%rdi
call   1030 <asprintf@plt>
mov    (%rsp),%rax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"foo(%s)\00"
define i8* @foo(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i32 @asprintf(i8** %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = load i8*, i8** %2
ret i8* %5
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ fibonacci(int const, int const);
int main(void) {
  const uint64_t n = 11527523930876953L, m = 26673;
  fibonacci(n, m);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xd10a2c19,-0x8(%rbp)
movl   $0x6831,-0xc(%rbp)
mov    $0xd10a2c19,%edi
mov    $0x6831,%esi
call   1030 <fibonacci@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xd10a2c19,%edi
mov    $0x6831,%esi
call   1030 <fibonacci@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @fibonacci(i32 -787862503, i32 26673)
ret i32 0
}
void set_pmu_sleep_clk_high() {}


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

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

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

LLVM IR (-O2):
define void @set_pmu_sleep_clk_high() {
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int32_t collatz(int32_t n0) {
  int32_t steps = 0;
  int32_t n = n0;
  while (n > 1) {
    if (n % 2 == 0) {
      n = n / 2;
    } else {
      n = 3 * n + 1;
    }
    steps++;
  }
  return steps;
}


x86 assembly (clang, -O0):
<collatz>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jle    115d <collatz+0x5d>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1145 <collatz+0x45>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    114f <collatz+0x4f>
imul   $0x3,-0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1114 <collatz+0x14>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<collatz>:
xor    %eax,%eax
cmp    $0x2,%edi
jl     1127 <collatz+0x27>
xor    %eax,%eax
nopl   0x0(%rax)
mov    %edi,%ecx
shr    %ecx
test   $0x1,%dil
lea    0x1(%rdi,%rdi,2),%edi
cmove  %ecx,%edi
add    $0x1,%eax
cmp    $0x1,%edi
jg     1110 <collatz+0x10>
ret

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

LLVM IR (-O2):
define i32 @collatz(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %14
3: ; preds = %1, %3
%4 = phi i32 [ %11, %3 ], [ %0, %1 ]
%5 = phi i32 [ %12, %3 ], [ 0, %1 ]
%6 = and i32 %4, 1
%7 = icmp eq i32 %6, 0
%8 = lshr i32 %4, 1
%9 = mul nsw i32 %4, 3
%10 = add nsw i32 %9, 1
%11 = select i1 %7, i32 %8, i32 %10
%12 = add nuw nsw i32 %5, 1
%13 = icmp sgt i32 %11, 1
br i1 %13, label %3, label %14
14: ; preds = %3, %1
%15 = phi i32 [ 0, %1 ], [ %12, %3 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void _printlog(char *msg) { printf("%s\n", msg); }


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

x86 assembly (clang, -O2):
<_printlog>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @_printlog(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
void ref_mul_int32_t(int32_t arg1, int32_t arg2, int32_t *result) {
  *result = arg1 * arg2;
}


x86 assembly (clang, -O0):
<ref_mul_int32_t>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
imul   -0x8(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ref_mul_int32_t>:
imul   %esi,%edi
mov    %edi,(%rdx)
ret

LLVM IR (-O0):
define void @ref_mul_int32_t(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = mul nsw i32 %7, %8
%10 = load i32*, i32** %6
store i32 %9, i32* %10
ret void
}

LLVM IR (-O2):
define void @ref_mul_int32_t(i32 %0, i32 %1, i32* nocapture writeonly %2) {
%4 = mul nsw i32 %1, %0
store i32 %4, i32* %2
ret void
}
void mhl_unpowered_start(void) {}


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

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

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

LLVM IR (-O2):
define void @mhl_unpowered_start() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ error(char *, int);
void alisp_stop(void) { error("interrupted", -1); }


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"interrupted\00"
define void @alisp_stop() {
%1 = call i32 @error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 -1)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"interrupted\00"
define void @alisp_stop() {
%1 = tail call i32 @error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 -1)
ret void
}
void gfx_commit(void) {}


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

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

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

LLVM IR (-O2):
define void @gfx_commit() {
ret void
}
void initLoadAvg(struct SensorModul *sm) { long nproc, id; }


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

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

LLVM IR (-O0):
%struct.SensorModul = type opaque
define void @initLoadAvg(%struct.SensorModul* %0) {
%2 = alloca %struct.SensorModul*
%3 = alloca i64
%4 = alloca i64
store %struct.SensorModul* %0, %struct.SensorModul** %2
ret void
}

LLVM IR (-O2):
%struct.SensorModul = type opaque
define void @initLoadAvg(%struct.SensorModul* nocapture %0) {
ret void
}
unsigned strv_length(char *const *l) {
  unsigned n = 0;
  if (!l)
    return 0;
  for (; *l; l++)
    n++;
  return n;
}


x86 assembly (clang, -O0):
<strv_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1126 <strv_length+0x26>
movl   $0x0,-0x4(%rbp)
jmp    1159 <strv_length+0x59>
jmp    112b <strv_length+0x2b>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1153 <strv_length+0x53>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    112b <strv_length+0x2b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strv_length>:
xor    %eax,%eax
test   %rdi,%rdi
je     111c <strv_length+0x1c>
cmpq   $0x0,(%rdi)
je     111c <strv_length+0x1c>
xor    %eax,%eax
nop
cmpq   $0x0,0x8(%rdi,%rax,8)
lea    0x1(%rax),%rax
jne    1110 <strv_length+0x10>
ret

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

LLVM IR (-O2):
define i32 @strv_length(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %13, label %6
6: ; preds = %3, %6
%7 = phi i32 [ %9, %6 ], [ 0, %3 ]
%8 = phi i8** [ %10, %6 ], [ %0, %3 ]
%9 = add i32 %7, 1
%10 = getelementptr inbounds i8*, i8** %8, i64 1
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %6
13: ; preds = %6, %3, %1
%14 = phi i32 [ 0, %1 ], [ 0, %3 ], [ %9, %6 ]
ret i32 %14
}
/* Type definitions */
struct timeval {
  int /*<<< orphan*/ tv_sec;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ croak_perror(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
scalar_t__ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
void fprinttimestamp(FILE *file) {
  struct timeval time;
  if (gettimeofday(&time, NULL) != 0) {
    croak_perror("Unable to get time or day!");
  }
  fprintf(file, "%lu", time.tv_sec);
}


x86 assembly (clang, -O0):
<fprinttimestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
cmp    $0x0,%rax
je     115f <fprinttimestamp+0x2f>
lea    0xea6(%rip),%rdi
call   1030 <croak_perror@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xeae(%rip),%rsi
call   1050 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprinttimestamp>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
test   %rax,%rax
je     1155 <fprinttimestamp+0x25>
lea    0xeb0(%rip),%rdi
call   1030 <croak_perror@plt>
mov    0x8(%rsp),%edx
lea    0xebb(%rip),%rsi
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1050 <fprintf@plt>

LLVM IR (-O0):
%struct.timeval = type { i32 }
@.str = [27 x i8] c"Unable to get time or day!\00"
@.str.1 = [4 x i8] c"%lu\00"
define void @fprinttimestamp(i32* %0) {
%2 = alloca i32*
%3 = alloca %struct.timeval
store i32* %0, i32** %2
%4 = call i64 @gettimeofday(%struct.timeval* %3, i32* null)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @croak_perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = load i32*, i32** %2
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%11 = load i32, i32* %10
%12 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
@.str = [27 x i8] c"Unable to get time or day!\00"
@.str.1 = [4 x i8] c"%lu\00"
define void @fprinttimestamp(i32* nocapture %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i64 @gettimeofday(%struct.timeval* %2, i32* null)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @croak_perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%10 = load i32, i32* %9
%11 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret void
}
/* Variables and functions */
int a();
int /*<<< orphan*/ b();
int /*<<< orphan*/ c();
void testRemoveDeadBindings() {
  int i = a();
  if ((i))
    a();
  else
    b();
  c();
}


x86 assembly (clang, -O0):
<testRemoveDeadBindings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <a@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1158 <testRemoveDeadBindings+0x28>
mov    $0x0,%al
call   1050 <a@plt>
jmp    115f <testRemoveDeadBindings+0x2f>
mov    $0x0,%al
call   1030 <b@plt>
mov    $0x0,%al
call   1040 <c@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testRemoveDeadBindings>:
push   %rax
xor    %eax,%eax
call   1050 <a@plt>
test   %eax,%eax
je     1145 <testRemoveDeadBindings+0x15>
xor    %eax,%eax
call   1050 <a@plt>
jmp    114c <testRemoveDeadBindings+0x1c>
xor    %eax,%eax
call   1030 <b@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <c@plt>

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

LLVM IR (-O2):
define void @testRemoveDeadBindings() {
%1 = tail call i32 (...) @a()
%2 = icmp eq i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @a()
br label %7
5: ; preds = %0
%6 = tail call i32 (...) @b()
br label %7
7: ; preds = %5, %3
%8 = tail call i32 (...) @c()
ret void
}
void SwapUVRow_NEON() {}


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

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

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

LLVM IR (-O2):
define void @SwapUVRow_NEON() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ reload_services();
int /*<<< orphan*/ unlink(char *);
void cleanup(int signal) {
  printf("Try to recover from endless waiting.\n");
  reload_services();
  unlink("/tmp/tmp_samba_lock");
  exit(1);
}


x86 assembly (clang, -O0):
<cleanup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <reload_services@plt>
lea    0xec1(%rip),%rdi
call   1030 <unlink@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<cleanup>:
push   %rax
lea    0xecc(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <reload_services@plt>
lea    0xea5(%rip),%rdi
call   1030 <unlink@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"Try to recover from endless waiting.\0A\00"
@.str.1 = [20 x i8] c"/tmp/tmp_samba_lock\00"
define void @cleanup(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @reload_services()
%5 = call i32 @unlink(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str.1 = [20 x i8] c"/tmp/tmp_samba_lock\00"
@str = [37 x i8] c"Try to recover from endless waiting.\00"
define void @cleanup(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (...) @reload_services()
%4 = tail call i32 @unlink(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
}
int isBinaryOperator(char c) {
  return (c == '+' || c == '-' || c == '*' || c == '/');
}


x86 assembly (clang, -O0):
<isBinaryOperator>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2b,%ecx
mov    %al,-0x2(%rbp)
je     114d <isBinaryOperator+0x4d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2d,%ecx
mov    %al,-0x2(%rbp)
je     114d <isBinaryOperator+0x4d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x2a,%ecx
mov    %al,-0x2(%rbp)
je     114d <isBinaryOperator+0x4d>
movsbl -0x1(%rbp),%eax
cmp    $0x2f,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isBinaryOperator>:
cmp    $0x2d,%dil
ja     1120 <isBinaryOperator+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x2c0000000000,%rdx
bt     %rcx,%rdx
jae    1120 <isBinaryOperator+0x20>
ret
xor    %eax,%eax
cmp    $0x2f,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @isBinaryOperator(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 43
br i1 %5, label %18, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 45
br i1 %9, label %18, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 42
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 47
br label %18
18: ; preds = %14, %10, %6, %1
%19 = phi i1 [ true, %10 ], [ true, %6 ], [ true, %1 ], [ %17, %14 ]
%20 = zext i1 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @isBinaryOperator(i8 signext %0) {
switch i8 %0, label %2 [
i8 45, label %5
i8 43, label %5
i8 42, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, 47
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %6
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ test_condition();
int /*<<< orphan*/ test_lexical_unit();
int /*<<< orphan*/ test_list();
int /*<<< orphan*/ test_media_query();
int /*<<< orphan*/ test_mpool();
int /*<<< orphan*/ test_page_margin();
int /*<<< orphan*/ test_parser();
int /*<<< orphan*/ test_selector();
int /*<<< orphan*/ test_vector();
int main(void) {
  test_mpool();
  test_list();
  test_vector();
  test_lexical_unit();
  test_condition();
  test_selector();
  test_media_query();
  test_page_margin();
  test_parser();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   10b0 <test_mpool@plt>
mov    $0x0,%al
call   1070 <test_list@plt>
mov    $0x0,%al
call   1040 <test_vector@plt>
mov    $0x0,%al
call   1090 <test_lexical_unit@plt>
mov    $0x0,%al
call   1050 <test_condition@plt>
mov    $0x0,%al
call   1060 <test_selector@plt>
mov    $0x0,%al
call   1080 <test_media_query@plt>
mov    $0x0,%al
call   1030 <test_page_margin@plt>
mov    $0x0,%al
call   10a0 <test_parser@plt>
mov    0x2dfb(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   10b0 <test_mpool@plt>
xor    %eax,%eax
call   1070 <test_list@plt>
xor    %eax,%eax
call   1040 <test_vector@plt>
xor    %eax,%eax
call   1090 <test_lexical_unit@plt>
xor    %eax,%eax
call   1050 <test_condition@plt>
xor    %eax,%eax
call   1060 <test_selector@plt>
xor    %eax,%eax
call   1080 <test_media_query@plt>
xor    %eax,%eax
call   1030 <test_page_margin@plt>
xor    %eax,%eax
call   10a0 <test_parser@plt>
mov    0x2e09(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_mpool()
%3 = call i32 (...) @test_list()
%4 = call i32 (...) @test_vector()
%5 = call i32 (...) @test_lexical_unit()
%6 = call i32 (...) @test_condition()
%7 = call i32 (...) @test_selector()
%8 = call i32 (...) @test_media_query()
%9 = call i32 (...) @test_page_margin()
%10 = call i32 (...) @test_parser()
%11 = load i32, i32* @EXIT_SUCCESS
ret i32 %11
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @test_mpool()
%2 = tail call i32 (...) @test_list()
%3 = tail call i32 (...) @test_vector()
%4 = tail call i32 (...) @test_lexical_unit()
%5 = tail call i32 (...) @test_condition()
%6 = tail call i32 (...) @test_selector()
%7 = tail call i32 (...) @test_media_query()
%8 = tail call i32 (...) @test_page_margin()
%9 = tail call i32 (...) @test_parser()
%10 = load i32, i32* @EXIT_SUCCESS
ret i32 %10
}