xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ die(char *, int);
int read(int, double *, int);
int readd(int fd, double *dest) {
  int r = read(fd, dest, sizeof(double));
  if (r != sizeof(double) && r)
    die("Couldn't read double (Got %d)\n", r);
  return r;
}


x86 assembly (clang, -O0):
<readd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1030 <read@plt>
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    $0x8,%rax
je     116a <readd+0x4a>
cmpl   $0x0,-0x14(%rbp)
je     116a <readd+0x4a>
mov    -0x14(%rbp),%esi
lea    0xe9b(%rip),%rdi
call   1040 <die@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readd>:
push   %rbx
mov    $0x8,%edx
call   1030 <read@plt>
mov    %eax,%ebx
test   $0xfffffff7,%eax
je     1142 <readd+0x22>
lea    0xec5(%rip),%rdi
mov    %ebx,%esi
call   1040 <die@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Couldn't read double (Got %d)\0A\00"
define i32 @readd(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
store i32 %0, i32* %3
store double* %1, double** %4
%6 = load i32, i32* %3
%7 = load double*, double** %4
%8 = call i32 @read(i32 %6, double* %7, i32 8)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = icmp ne i64 %10, 8
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32, i32* %5
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %5
%17 = call i32 @die(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %15, %12, %2
%19 = load i32, i32* %5
ret i32 %19
}

LLVM IR (-O2):
@.str = [31 x i8] c"Couldn't read double (Got %d)\0A\00"
define i32 @readd(i32 %0, double* nocapture %1) {
%3 = tail call i32 @read(i32 %0, double* %1, i32 8)
%4 = and i32 %3, -9
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @die(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %3)
br label %8
8: ; preds = %6, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void *offset(void const *const, size_t const);
void *blockIndex(const void *const addr, const size_t index,
                 const size_t elem_size) {
  assert(((addr)) && "Unexpected null pointer.");
  ;
  assert(((elem_size) > 0) && "Non-positive number.");
  return offset(addr, elem_size * index);
}


x86 assembly (clang, -O0):
<blockIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x19(%rbp)
je     114e <blockIndex+0x2e>
mov    $0x1,%al
mov    %al,-0x19(%rbp)
jmp    114e <blockIndex+0x2e>
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x1a(%rbp)
jbe    1175 <blockIndex+0x55>
mov    $0x1,%al
mov    %al,-0x1a(%rbp)
jmp    1175 <blockIndex+0x55>
mov    -0x1a(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
imul   -0x10(%rbp),%rsi
call   1040 <offset@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blockIndex>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
xor    %edi,%edi
test   %r15,%r15
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1030 <assert@plt>
imul   %r14,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <offset@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Unexpected null pointer.\00"
@.str.1 = [21 x i8] c"Non-positive number.\00"
define i8* @blockIndex(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %10
9: ; preds = %3
br label %10
10: ; preds = %9, %3
%11 = phi i1 [ false, %3 ], [ true, %9 ]
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i64, i64* %6
%15 = icmp ugt i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %10
br label %17
17: ; preds = %16, %10
%18 = phi i1 [ false, %10 ], [ true, %16 ]
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load i8*, i8** %4
%22 = load i64, i64* %6
%23 = load i64, i64* %5
%24 = mul i64 %22, %23
%25 = call i8* @offset(i8* %21, i64 %24)
ret i8* %25
}

LLVM IR (-O2):
define i8* @blockIndex(i8* %0, i64 %1, i64 %2) {
%4 = icmp ne i8* %0, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = icmp ne i64 %2, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = mul i64 %2, %1
%11 = tail call i8* @offset(i8* %0, i64 %10)
ret i8* %11
}
/* Type definitions */
typedef int /*<<< orphan*/ mpz_t;

/* Variables and functions */
int /*<<< orphan*/ mpz_clear(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init_set_ui(int /*<<< orphan*/, unsigned long);
int /*<<< orphan*/ mpz_triangular(int /*<<< orphan*/, int /*<<< orphan*/);
void mpz_triangular_ui(mpz_t rot, unsigned long int op) {
  mpz_t zop;
  mpz_init_set_ui(zop, op);
  mpz_triangular(rot, zop);
  mpz_clear(zop);
  return;
}


x86 assembly (clang, -O0):
<mpz_triangular_ui>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <mpz_init_set_ui@plt>
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <mpz_triangular@plt>
mov    -0x14(%rbp),%edi
call   1050 <mpz_clear@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpz_triangular_ui>:
push   %rbx
mov    %edi,%ebx
call   1030 <mpz_init_set_ui@plt>
mov    %ebx,%edi
call   1040 <mpz_triangular@plt>
pop    %rbx
jmp    1050 <mpz_clear@plt>

LLVM IR (-O0):
define void @mpz_triangular_ui(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32
store i32 %0, i32* %3
store i64 %1, i64* %4
%6 = load i32, i32* %5
%7 = load i64, i64* %4
%8 = call i32 @mpz_init_set_ui(i32 %6, i64 %7)
%9 = load i32, i32* %3
%10 = load i32, i32* %5
%11 = call i32 @mpz_triangular(i32 %9, i32 %10)
%12 = load i32, i32* %5
%13 = call i32 @mpz_clear(i32 %12)
ret void
}

LLVM IR (-O2):
define void @mpz_triangular_ui(i32 %0, i64 %1) {
%3 = tail call i32 @mpz_init_set_ui(i32 undef, i64 %1)
%4 = tail call i32 @mpz_triangular(i32 %0, i32 undef)
%5 = tail call i32 @mpz_clear(i32 undef)
ret void
}
/* Variables and functions */
int wfile_unix_style_match(char *, char *);
int wfile_wild_match(char *pattern, char *name) {
  return (wfile_unix_style_match(pattern, name));
}


x86 assembly (clang, -O0):
<wfile_wild_match>:
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 <wfile_unix_style_match@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wfile_wild_match>:
jmp    1030 <wfile_unix_style_match@plt>

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

LLVM IR (-O2):
define i32 @wfile_wild_match(i8* %0, i8* %1) {
%3 = tail call i32 @wfile_unix_style_match(i8* %0, i8* %1)
ret i32 %3
}
void INT_Excep_MTU9_TGIB9(void) {}


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

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

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

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

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ fputs(char const *, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void Fputs(const char *ptr, FILE *stream) {
  if (fputs(ptr, stream) == EOF)
    fprintf(stderr, "fputs error");
}


x86 assembly (clang, -O0):
<Fputs>:
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 <fputs@plt>
mov    0x2ea4(%rip),%rcx
cmp    (%rcx),%rax
jne    1162 <Fputs+0x42>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
lea    0xea3(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fputs>:
push   %rax
call   1030 <fputs@plt>
mov    0x2ebb(%rip),%rcx
cmp    (%rcx),%rax
jne    1148 <Fputs+0x28>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
lea    0xebe(%rip),%rsi
pop    %rax
jmp    1040 <fprintf@plt>
pop    %rax
ret

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

LLVM IR (-O2):
@EOF = global i64 0
@stderr = global i32 0
@.str = [12 x i8] c"fputs error\00"
define void @Fputs(i8* nocapture %0, i32* nocapture %1) {
%3 = tail call i64 @fputs(i8* %0, i32* %1)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %6, %2
ret void
}
void strcpy(unsigned char *str1, unsigned char *str2) {
  asm("2:		lodsb;		or %%al,%%al;		jz 1f;	"
      "	stosb;		jmp 2b;		1:mov $0,%%al;stosb" ::"S"(
          (unsigned long)str1),
      "D"((unsigned long)str2));
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdi
lods   %ds:(%rsi),%al
or     %al,%al
je     1123 <strcpy+0x23>
stos   %al,%es:(%rdi)
jmp    1114 <strcpy+0x14>
mov    $0x0,%al
stos   %al,%es:(%rdi)
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rsi,%rax
mov    %rdi,%rsi
mov    %rax,%rdi
lods   %ds:(%rsi),%al
or     %al,%al
je     1111 <strcpy+0x11>
stos   %al,%es:(%rdi)
jmp    1109 <strcpy+0x9>
mov    $0x0,%al
stos   %al,%es:(%rdi)
ret

LLVM IR (-O0):
define void @strcpy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
%7 = load i8*, i8** %4
%8 = ptrtoint i8* %7 to i64
ret void
}

LLVM IR (-O2):
define void @strcpy(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = ptrtoint i8* %1 to i64
tail call void asm sideeffect "2:\09\09lodsb;\09\09or %al,%al;\09\09jz 1f;\09\09stosb;\09\09jmp 2b;\09\091:mov $$0,%al;stosb", "{si},{di},~{dirflag},~{fpsr},~{flags}"(i64 %3, i64 %4)
ret void
}
/* Type definitions */
struct lldp_tlv {
  int dummy;
};

/* Variables and functions */
char *decode_organizationally_specific_tlv(struct lldp_tlv *tlv) {
  return NULL;
}


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

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

LLVM IR (-O0):
%struct.lldp_tlv = type { i32 }
define i8* @decode_organizationally_specific_tlv(%struct.lldp_tlv* %0) {
%2 = alloca %struct.lldp_tlv*
store %struct.lldp_tlv* %0, %struct.lldp_tlv** %2
ret i8* null
}

LLVM IR (-O2):
%struct.lldp_tlv = type { i32 }
define noalias i8* @decode_organizationally_specific_tlv(%struct.lldp_tlv* nocapture readnone %0) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ WARN_ON(int);
void radix__flush_tlb_lpid(unsigned int lpid) { WARN_ON(1); }


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

x86 assembly (clang, -O2):
<radix__flush_tlb_lpid>:
mov    $0x1,%edi
jmp    1030 <WARN_ON@plt>

LLVM IR (-O0):
define void @radix__flush_tlb_lpid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @WARN_ON(i32 1)
ret void
}

LLVM IR (-O2):
define void @radix__flush_tlb_lpid(i32 %0) {
%2 = tail call i32 @WARN_ON(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ ispunct(int);
void t_ispunct_0x7b() {
  Assert_real((ispunct(123)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_ispunct.c",
              620, ("ispunct should be 1 for {"));
}


x86 assembly (clang, -O0):
<t_ispunct_0x7b>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7b,%edi
call   1030 <ispunct@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x26c,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_ispunct_0x7b>:
push   %rax
mov    $0x7b,%edi
call   1030 <ispunct@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x26c,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [26 x i8] c"ispunct should be 1 for {\00"
define void @t_ispunct_0x7b() {
%1 = call i32 @ispunct(i32 123)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 620, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [26 x i8] c"ispunct should be 1 for {\00"
define void @t_ispunct_0x7b() {
%1 = tail call i32 @ispunct(i32 123)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 620, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void VMR3GetStateU(void) {}


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

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

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

LLVM IR (-O2):
define void @VMR3GetStateU() {
ret void
}
/* Variables and functions */
char *strrchr(char *, char);
char *getPathSlash(char *path) {
  char *slash = strrchr(path, '/');
  char *backslash = strrchr(path, '\\');
  if (!slash || (slash && backslash > slash))
    slash = backslash;
  if (slash)
    return slash;
  else
    return NULL;
}


x86 assembly (clang, -O0):
<getPathSlash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x5c,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1164 <getPathSlash+0x54>
cmpq   $0x0,-0x18(%rbp)
je     116c <getPathSlash+0x5c>
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    116c <getPathSlash+0x5c>
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1184 <getPathSlash+0x74>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    118c <getPathSlash+0x7c>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getPathSlash>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x5c,%esi
call   1030 <strrchr@plt>
cmp    %rbx,%rax
mov    %rbx,%rcx
cmova  %rax,%rcx
test   %rbx,%rbx
cmovne %rcx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @getPathSlash(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i8* @strrchr(i8* %6, i8 signext 47)
store i8* %7, i8** %4
%8 = load i8*, i8** %3
%9 = call i8* @strrchr(i8* %8, i8 signext 92)
store i8* %9, i8** %5
%10 = load i8*, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %19
12: ; preds = %1
%13 = load i8*, i8** %4
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i8*, i8** %5
%17 = load i8*, i8** %4
%18 = icmp ugt i8* %16, %17
br i1 %18, label %19, label %21
19: ; preds = %15, %1
%20 = load i8*, i8** %5
store i8* %20, i8** %4
br label %21
21: ; preds = %19, %15, %12
%22 = load i8*, i8** %4
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = load i8*, i8** %4
store i8* %25, i8** %2
br label %27
26: ; preds = %21
store i8* null, i8** %2
br label %27
27: ; preds = %26, %24
%28 = load i8*, i8** %2
ret i8* %28
}

LLVM IR (-O2):
define i8* @getPathSlash(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 92)
%4 = icmp eq i8* %2, null
%5 = icmp ugt i8* %3, %2
%6 = select i1 %4, i1 true, i1 %5
%7 = select i1 %6, i8* %3, i8* %2
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
server(int rd, int wr) { printf("server called with %d %d\n", rd, wr); }


x86 assembly (clang, -O0):
<server>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<server>:
mov    %esi,%edx
mov    %edi,%esi
lea    0xee5(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"server called with %d %d\0A\00"
define i32 @server(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* %4
%7 = load i32, i32* %5
%8 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
@.str = [26 x i8] c"server called with %d %d\0A\00"
define i32 @server(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret i32 undef
}
/* Variables and functions */
scalar_t__ TextCharWidth(int /*<<< orphan*/);
int TextWidth(const char *s) {
  int w = 0;
  while (*s)
    w += TextCharWidth(*s++);
  return w;
}


x86 assembly (clang, -O0):
<TextWidth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1159 <TextWidth+0x49>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <TextCharWidth@plt>
mov    %rax,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
jmp    1123 <TextWidth+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TextWidth>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     1147 <TextWidth+0x37>
mov    %rdi,%rbx
add    $0x1,%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%edi
call   1030 <TextCharWidth@plt>
add    %eax,%ebp
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <TextWidth+0x20>
jmp    1149 <TextWidth+0x39>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @TextWidth(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %13, %4 ], [ %2, %1 ]
%6 = phi i32 [ %12, %4 ], [ 0, %1 ]
%7 = phi i8* [ %8, %4 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = sext i8 %5 to i32
%10 = tail call i64 @TextCharWidth(i32 %9)
%11 = trunc i64 %10 to i32
%12 = add i32 %6, %11
%13 = load i8, i8* %8
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %1
%16 = phi i32 [ 0, %1 ], [ %12, %4 ]
ret i32 %16
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ minor_code;
};
struct TYPE_4__ {
  TYPE_1__ xgraphicsexpose;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
int get_XEvent_xgraphicsexpose_minor_code(void *_p) {
  return (int)((XEvent *)_p)->xgraphicsexpose.minor_code;
}


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

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

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

LLVM IR (-O2):
define i32 @get_XEvent_xgraphicsexpose_minor_code(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ ngen(char *, char *, int /*<<< orphan*/);
void cginc1ib(void) { ngen("%s\t(%%eax)", "incb", 0); }


x86 assembly (clang, -O0):
<cginc1ib>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee9(%rip),%rsi
xor    %edx,%edx
call   1030 <ngen@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cginc1ib>:
lea    0xee9(%rip),%rdi
lea    0xeed(%rip),%rsi
xor    %edx,%edx
jmp    1030 <ngen@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"%s\09(%%eax)\00"
@.str.1 = [5 x i8] c"incb\00"
define void @cginc1ib() {
%1 = call i32 @ngen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"%s\09(%%eax)\00"
@.str.1 = [5 x i8] c"incb\00"
define void @cginc1ib() {
%1 = tail call i32 @ngen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ op_write1(int);
void op_enc_rrca(void) { op_write1(0x0f); }


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

x86 assembly (clang, -O2):
<op_enc_rrca>:
mov    $0xf,%edi
jmp    1030 <op_write1@plt>

LLVM IR (-O0):
define void @op_enc_rrca() {
%1 = call i32 @op_write1(i32 15)
ret void
}

LLVM IR (-O2):
define void @op_enc_rrca() {
%1 = tail call i32 @op_write1(i32 15)
ret void
}
int max_i(int a, int b) { return a > b ? a : b; }


x86 assembly (clang, -O0):
<max_i>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <max_i+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <max_i+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max_i>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
ret

LLVM IR (-O0):
define i32 @max_i(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 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @max_i(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
double _add(double a, double b) { return a + b; }


x86 assembly (clang, -O0):
<_add>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_add>:
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @_add(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fadd double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @_add(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
/* Variables and functions */
int socket(int, int, int);
int fdevent_socket_nb_cloexec(int domain, int type, int protocol) {
  int fd;
  if (-1 != (fd = socket(domain, type, protocol))) {
  }
  return fd;
}


x86 assembly (clang, -O0):
<fdevent_socket_nb_cloexec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <socket@plt>
mov    %eax,%ecx
mov    %ecx,-0x10(%rbp)
mov    $0xffffffff,%eax
cmp    %ecx,%eax
je     1146 <fdevent_socket_nb_cloexec+0x36>
jmp    1146 <fdevent_socket_nb_cloexec+0x36>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdevent_socket_nb_cloexec>:
jmp    1030 <socket@plt>

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

LLVM IR (-O2):
define i32 @fdevent_socket_nb_cloexec(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @socket(i32 %0, i32 %1, i32 %2)
ret i32 %4
}
void nrom_update() { return; }


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

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

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

LLVM IR (-O2):
define void @nrom_update() {
ret void
}
/* Type definitions */
typedef unsigned long long __u16;

/* Variables and functions */
__u16 hea_u16_bit(int b) {
  return ((~0ULL << (63 - (b + 48))) & (~0ULL >> (b + 48)));
}


x86 assembly (clang, -O0):
<hea_u16_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
add    $0x30,%ecx
mov    $0x3f,%eax
sub    %ecx,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0xffffffffffffffff,%rax
shl    %cl,%rax
mov    -0x4(%rbp),%ecx
add    $0x30,%ecx
mov    %ecx,%ecx
mov    $0xffffffffffffffff,%rdx
shr    %cl,%rdx
mov    %rdx,%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hea_u16_bit>:
mov    $0xf,%cl
sub    %dil,%cl
mov    $0xffffffffffffffff,%rax
shl    %cl,%rax
lea    0x30(%rdi),%ecx
shl    %cl,%rax
shr    %cl,%rax
ret

LLVM IR (-O0):
define i64 @hea_u16_bit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 48
%5 = sub nsw i32 63, %4
%6 = zext i32 %5 to i64
%7 = shl i64 -1, %6
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 48
%10 = zext i32 %9 to i64
%11 = lshr i64 -1, %10
%12 = and i64 %7, %11
ret i64 %12
}

LLVM IR (-O2):
define i64 @hea_u16_bit(i32 %0) {
%2 = add nsw i32 %0, 48
%3 = sub i32 15, %0
%4 = zext i32 %3 to i64
%5 = shl nsw i64 -1, %4
%6 = zext i32 %2 to i64
%7 = lshr i64 -1, %6
%8 = and i64 %5, %7
ret i64 %8
}
/* Variables and functions */
int hampath_min_graph_size();
int valid_hampath_params(int **adjacency, int dimension) {
  return (adjacency != NULL) && (dimension >= hampath_min_graph_size()) &&
         (dimension <= 2147483647);
}


x86 assembly (clang, -O0):
<valid_hampath_params>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     115b <valid_hampath_params+0x4b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <hampath_min_graph_size@plt>
mov    -0x14(%rbp),%ecx
mov    %eax,%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0xd(%rbp)
jl     115b <valid_hampath_params+0x4b>
cmpl   $0x7fffffff,-0xc(%rbp)
setle  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_hampath_params>:
test   %rdi,%rdi
je     112a <valid_hampath_params+0x1a>
push   %rbx
mov    %esi,%ebx
xor    %eax,%eax
call   1030 <hampath_min_graph_size@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ebx,%ecx
setle  %al
pop    %rbx
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @valid_hampath_params(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 = icmp ne i32** %5, null
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = load i32, i32* %4
%9 = call i32 (...) @hampath_min_graph_size()
%10 = icmp sge i32 %8, %9
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32, i32* %4
%13 = icmp sle i32 %12, 2147483647
br label %14
14: ; preds = %11, %7, %2
%15 = phi i1 [ false, %7 ], [ false, %2 ], [ %13, %11 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @valid_hampath_params(i32** readnone %0, i32 %1) {
%3 = icmp eq i32** %0, null
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 (...) @hampath_min_graph_size()
%6 = icmp sle i32 %5, %1
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %2
%9 = phi i32 [ 0, %2 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
size_t strlen(char *);
void lcc_chomp(char *str) {
  size_t str_len;
  str_len = strlen(str);
  while (str_len > 0) {
    if (str[str_len - 1] >= 32)
      break;
    str[str_len - 1] = 0;
    str_len--;
  }
}


x86 assembly (clang, -O0):
<lcc_chomp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jbe    1173 <lcc_chomp+0x63>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jl     1152 <lcc_chomp+0x42>
jmp    1173 <lcc_chomp+0x63>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1129 <lcc_chomp+0x19>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcc_chomp>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %rax,%rax
je     1132 <lcc_chomp+0x22>
xchg   %ax,%ax
cmpb   $0x1f,-0x1(%rbx,%rax,1)
jg     1132 <lcc_chomp+0x22>
movb   $0x0,-0x1(%rbx,%rax,1)
add    $0xffffffffffffffff,%rax
jne    1120 <lcc_chomp+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @lcc_chomp(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %10
%5 = phi i64 [ %6, %10 ], [ %2, %1 ]
%6 = add i64 %5, -1
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp sgt i8 %8, 31
br i1 %9, label %12, label %10
10: ; preds = %4
store i8 0, i8* %7
%11 = icmp eq i64 %6, 0
br i1 %11, label %12, label %4
12: ; preds = %10, %4, %1
ret void
}
/* Type definitions */
struct termios {
  int dummy;
};

/* Variables and functions */
int ioctl(int, int, struct termios *);
int tcgetattr(int fildes, struct termios *tp) {
  return ioctl(fildes, 0x5401, tp);
}


x86 assembly (clang, -O0):
<tcgetattr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    $0x5401,%esi
call   1030 <ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcgetattr>:
mov    %rsi,%rdx
mov    $0x5401,%esi
jmp    1030 <ioctl@plt>

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

LLVM IR (-O2):
%struct.termios = type { i32 }
define i32 @tcgetattr(i32 %0, %struct.termios* %1) {
%3 = tail call i32 @ioctl(i32 %0, i32 21505, %struct.termios* %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ set_port(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
void io_set_port_pullups(uint8_t port, uint8_t value) {
  set_port(port, value, 0x0C, 0x0D);
}


x86 assembly (clang, -O0):
<io_set_port_pullups>:
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    $0xc,%edx
mov    $0xd,%ecx
call   1030 <set_port@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_set_port_pullups>:
mov    $0xc,%edx
mov    $0xd,%ecx
jmp    1030 <set_port@plt>

LLVM IR (-O0):
define void @io_set_port_pullups(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @set_port(i32 %5, i32 %6, i32 12, i32 13)
ret void
}

LLVM IR (-O2):
define void @io_set_port_pullups(i32 %0, i32 %1) {
%3 = tail call i32 @set_port(i32 %0, i32 %1, i32 12, i32 13)
ret void
}
void RTTestPassed(void) {}


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

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

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

LLVM IR (-O2):
define void @RTTestPassed() {
ret void
}
int big_leaf(int arg) {
  int array[60];
  array[arg * 3] = 4;
  return array[arg];
}


x86 assembly (clang, -O0):
<big_leaf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
imul   $0x3,-0x4(%rbp),%eax
cltq
movl   $0x4,-0x100(%rbp,%rax,4)
movslq -0x4(%rbp),%rax
mov    -0x100(%rbp,%rax,4),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<big_leaf>:
sub    $0x78,%rsp
lea    (%rdi,%rdi,2),%eax
cltq
movl   $0x4,-0x80(%rsp,%rax,4)
movslq %edi,%rax
mov    -0x80(%rsp,%rax,4),%eax
add    $0x78,%rsp
ret

LLVM IR (-O0):
define i32 @big_leaf(i32 %0) {
%2 = alloca i32
%3 = alloca [60 x i32]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = mul nsw i32 %4, 3
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [60 x i32], [60 x i32]* %3, i64 0, i64 %6
store i32 4, i32* %7
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [60 x i32], [60 x i32]* %3, i64 0, i64 %9
%11 = load i32, i32* %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @big_leaf(i32 %0) {
%2 = alloca [60 x i32]
%3 = bitcast [60 x i32]* %2 to i8*
%4 = mul nsw i32 %0, 3
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds [60 x i32], [60 x i32]* %2, i64 0, i64 %5
store i32 4, i32* %6
%7 = sext i32 %0 to i64
%8 = getelementptr inbounds [60 x i32], [60 x i32]* %2, i64 0, i64 %7
%9 = load i32, i32* %8
ret i32 %9
}
/* Variables and functions */
double tan(double const);
double _ftan(const double theta, const char *parent_func,
             const char *parent_file, const unsigned int parent_line) {
  return tan(theta);
}


x86 assembly (clang, -O0):
<_ftan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <tan@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ftan>:
jmp    1030 <tan@plt>

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

LLVM IR (-O2):
define double @_ftan(double %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i32 %3) {
%5 = tail call double @tan(double %0)
ret double %5
}
int multiply(int a, int b) {
  int result = 0;
  while (b != 0) {
    if (b % 2)
      result = result + a;
    b = b >> 1;
    a = a << 1;
  }
  return result;
}


x86 assembly (clang, -O0):
<multiply>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     114f <multiply+0x4f>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1138 <multiply+0x38>
mov    -0xc(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1111 <multiply+0x11>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiply>:
xor    %eax,%eax
test   %esi,%esi
je     1126 <multiply+0x26>
mov    %esi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %esi,%edx
and    $0x1,%edx
neg    %edx
and    %edi,%edx
add    %edx,%eax
sar    %ecx
add    %edi,%edi
cmp    $0x1,%esi
mov    %ecx,%esi
ja     1110 <multiply+0x10>
ret

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

LLVM IR (-O2):
define i32 @multiply(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %15, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %11, %4 ], [ 0, %2 ]
%6 = phi i32 [ %12, %4 ], [ %1, %2 ]
%7 = phi i32 [ %13, %4 ], [ %0, %2 ]
%8 = and i32 %6, 1
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 0, i32 %7
%11 = add nsw i32 %10, %5
%12 = ashr i32 %6, 1
%13 = shl i32 %7, 1
%14 = icmp ult i32 %6, 2
br i1 %14, label %15, label %4
15: ; preds = %4, %2
%16 = phi i32 [ 0, %2 ], [ %11, %4 ]
ret i32 %16
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ putc(unsigned char, int /*<<< orphan*/ *);
void gdPutWord(int w, FILE *out) {
  putc((unsigned char)(w >> 8), out);
  putc((unsigned char)(w & 0xFF), out);
}


x86 assembly (clang, -O0):
<gdPutWord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
mov    -0x10(%rbp),%rsi
movzbl %al,%edi
call   1030 <putc@plt>
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    -0x10(%rbp),%rsi
movzbl %al,%edi
call   1030 <putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gdPutWord>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebx
movzbl %bh,%edi
call   1030 <putc@plt>
movzbl %bl,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putc@plt>

LLVM IR (-O0):
define void @gdPutWord(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 = ashr i32 %5, 8
%7 = trunc i32 %6 to i8
%8 = load i32*, i32** %4
%9 = call i32 @putc(i8 zeroext %7, i32* %8)
%10 = load i32, i32* %3
%11 = and i32 %10, 255
%12 = trunc i32 %11 to i8
%13 = load i32*, i32** %4
%14 = call i32 @putc(i8 zeroext %12, i32* %13)
ret void
}

LLVM IR (-O2):
define void @gdPutWord(i32 %0, i32* nocapture %1) {
%3 = lshr i32 %0, 8
%4 = trunc i32 %3 to i8
%5 = tail call i32 @putc(i8 zeroext %4, i32* %1)
%6 = trunc i32 %0 to i8
%7 = tail call i32 @putc(i8 zeroext %6, i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gAnd(int const, int const);
int gNot(int const);
int gOr(int /*<<< orphan*/, int /*<<< orphan*/);
void mux(const int s, const int *in, int *out) {
  int notS = gNot(s);
  *out = gOr(gAnd(notS, in[0]), gAnd(s, in[1]));
}


x86 assembly (clang, -O0):
<mux>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <gNot@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1050 <gAnd@plt>
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%esi
call   1050 <gAnd@plt>
mov    -0x20(%rbp),%edi
mov    %eax,%esi
call   1030 <gOr@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mux>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
call   1040 <gNot@plt>
mov    (%rbx),%esi
mov    %eax,%edi
call   1050 <gAnd@plt>
mov    %eax,%r15d
mov    0x4(%rbx),%esi
mov    %ebp,%edi
call   1050 <gAnd@plt>
mov    %r15d,%edi
mov    %eax,%esi
call   1030 <gOr@plt>
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @mux(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%8 = load i32, i32* %4
%9 = call i32 @gNot(i32 %8)
store i32 %9, i32* %7
%10 = load i32, i32* %7
%11 = load i32*, i32** %5
%12 = getelementptr inbounds i32, i32* %11, i64 0
%13 = load i32, i32* %12
%14 = call i32 @gAnd(i32 %10, i32 %13)
%15 = load i32, i32* %4
%16 = load i32*, i32** %5
%17 = getelementptr inbounds i32, i32* %16, i64 1
%18 = load i32, i32* %17
%19 = call i32 @gAnd(i32 %15, i32 %18)
%20 = call i32 @gOr(i32 %14, i32 %19)
%21 = load i32*, i32** %6
store i32 %20, i32* %21
ret void
}

LLVM IR (-O2):
define void @mux(i32 %0, i32* nocapture %1, i32* nocapture writeonly %2) {
%4 = tail call i32 @gNot(i32 %0)
%5 = load i32, i32* %1
%6 = tail call i32 @gAnd(i32 %4, i32 %5)
%7 = getelementptr inbounds i32, i32* %1, i64 1
%8 = load i32, i32* %7
%9 = tail call i32 @gAnd(i32 %0, i32 %8)
%10 = tail call i32 @gOr(i32 %6, i32 %9)
store i32 %10, i32* %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wint_t;

/* Variables and functions */
int isxdigit(int /*<<< orphan*/);
int iswxdigit(wint_t wc) { return isxdigit(wc); }


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

x86 assembly (clang, -O2):
<iswxdigit>:
jmp    1030 <isxdigit@plt>

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

LLVM IR (-O2):
define i32 @iswxdigit(i32 %0) {
%2 = tail call i32 @isxdigit(i32 %0)
ret i32 %2
}
/* Variables and functions */
int get_nybble(char *);
int get_byte(char *s) { return get_nybble(s) * 16 + get_nybble(s + 1); }


x86 assembly (clang, -O0):
<get_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get_nybble@plt>
shl    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
call   1030 <get_nybble@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_byte>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <get_nybble@plt>
mov    %eax,%ebp
shl    $0x4,%ebp
add    $0x1,%rbx
mov    %rbx,%rdi
call   1030 <get_nybble@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_byte(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @get_nybble(i8* %3)
%5 = mul nsw i32 %4, 16
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = call i32 @get_nybble(i8* %7)
%9 = add nsw i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @get_byte(i8* %0) {
%2 = tail call i32 @get_nybble(i8* %0)
%3 = shl nsw i32 %2, 4
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = tail call i32 @get_nybble(i8* %4)
%6 = add nsw i32 %3, %5
ret i32 %6
}
double aclock_diff(double start, double end) {
  double d = (end - start);
  return d;
}


x86 assembly (clang, -O0):
<aclock_diff>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<aclock_diff>:
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @aclock_diff(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %4
%7 = load double, double* %3
%8 = fsub double %6, %7
store double %8, double* %5
%9 = load double, double* %5
ret double %9
}

LLVM IR (-O2):
define double @aclock_diff(double %0, double %1) {
%3 = fsub double %1, %0
ret double %3
}