xunge/DecIR huggingface dataset:
int uni2ascii(const unsigned char *unisrc, char *asciidest, int maxlen) {
  for (int i = 0; i < maxlen; (i++, asciidest++, unisrc += 2)) {
    *asciidest = *unisrc;
    if (*asciidest == '\0')
      return i;
  }
}


x86 assembly (clang, -O0):
<uni2ascii>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1174 <uni2ascii+0x74>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1149 <uni2ascii+0x49>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <uni2ascii+0x74>
jmp    114e <uni2ascii+0x4e>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
jmp    1116 <uni2ascii+0x16>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uni2ascii>:
test   %edx,%edx
jle    1124 <uni2ascii+0x24>
mov    %edx,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movzbl (%rdi,%rcx,2),%edx
mov    %dl,(%rsi,%rcx,1)
test   %dl,%dl
je     1127 <uni2ascii+0x27>
add    $0x1,%rcx
cmp    %ecx,%eax
jne    1110 <uni2ascii+0x10>
ret
xor    %eax,%eax
ret
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @uni2ascii(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %24, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %7
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %31
13: ; preds = %9
%14 = load i8*, i8** %5
%15 = load i8, i8* %14
%16 = load i8*, i8** %6
store i8 %15, i8* %16
%17 = load i8*, i8** %6
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %13
%22 = load i32, i32* %8
store i32 %22, i32* %4
br label %31
23: ; preds = %13
br label %24
24: ; preds = %23
%25 = load i32, i32* %8
%26 = add nsw i32 %25, 1
store i32 %26, i32* %8
%27 = load i8*, i8** %6
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %6
%29 = load i8*, i8** %5
%30 = getelementptr inbounds i8, i8* %29, i64 2
store i8* %30, i8** %5
br label %9
31: ; preds = %21, %9
%32 = load i32, i32* %4
ret i32 %32
}

LLVM IR (-O2):
define i32 @uni2ascii(i8* nocapture %0, i8* nocapture writeonly %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %16
5: ; preds = %3, %11
%6 = phi i32 [ %12, %11 ], [ 0, %3 ]
%7 = phi i8* [ %13, %11 ], [ %1, %3 ]
%8 = phi i8* [ %14, %11 ], [ %0, %3 ]
%9 = load i8, i8* %8
store i8 %9, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %5
%12 = add nuw nsw i32 %6, 1
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = getelementptr inbounds i8, i8* %8, i64 2
%15 = icmp eq i32 %12, %2
br i1 %15, label %16, label %5
16: ; preds = %11, %5, %3
%17 = phi i32 [ 0, %3 ], [ %6, %5 ], [ %2, %11 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
int no_file_error(const char *name) {
  fprintf(stderr, "%s: No processor trace file specified.\n", name);
  return -1;
}


x86 assembly (clang, -O0):
<no_file_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<no_file_error>:
push   %rax
mov    %rdi,%rdx
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"%s: No processor trace file specified.\0A\00"
define i32 @no_file_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 -1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"%s: No processor trace file specified.\0A\00"
define i32 @no_file_error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 -1
}
/* Type definitions */
struct nlmsghdr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ NLMSG_SPACE(int);
scalar_t__ malloc(int /*<<< orphan*/);
struct nlmsghdr *nlmsg_malloc(int length) {
  return (struct nlmsghdr *)malloc(NLMSG_SPACE(length));
}


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

x86 assembly (clang, -O2):
<nlmsg_malloc>:
push   %rax
call   1030 <NLMSG_SPACE@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <malloc@plt>

LLVM IR (-O0):
%struct.nlmsghdr = type { i32 }
define %struct.nlmsghdr* @nlmsg_malloc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @NLMSG_SPACE(i32 %3)
%5 = call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to %struct.nlmsghdr*
ret %struct.nlmsghdr* %6
}

LLVM IR (-O2):
%struct.nlmsghdr = type { i32 }
define %struct.nlmsghdr* @nlmsg_malloc(i32 %0) {
%2 = tail call i32 @NLMSG_SPACE(i32 %0)
%3 = tail call i64 @malloc(i32 %2)
%4 = inttoptr i64 %3 to %struct.nlmsghdr*
ret %struct.nlmsghdr* %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int nybble(int const);
uint8_t hex(const uint8_t *data, uint8_t *crc) {
  uint8_t val = (nybble(data[0]) << 4) | nybble(data[1]);
  *crc += val;
  return val;
}


x86 assembly (clang, -O0):
<hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <nybble@plt>
shl    $0x4,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
call   1030 <nybble@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1030 <nybble@plt>
mov    %eax,%ebp
shl    $0x4,%ebp
mov    0x4(%rbx),%edi
call   1030 <nybble@plt>
or     %ebp,%eax
add    %eax,(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @hex(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 0
%8 = load i32, i32* %7
%9 = call i32 @nybble(i32 %8)
%10 = shl i32 %9, 4
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 1
%13 = load i32, i32* %12
%14 = call i32 @nybble(i32 %13)
%15 = or i32 %10, %14
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = load i32*, i32** %4
%18 = load i32, i32* %17
%19 = add nsw i32 %18, %16
store i32 %19, i32* %17
%20 = load i32, i32* %5
ret i32 %20
}

LLVM IR (-O2):
define i32 @hex(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = tail call i32 @nybble(i32 %3)
%5 = shl i32 %4, 4
%6 = getelementptr inbounds i32, i32* %0, i64 1
%7 = load i32, i32* %6
%8 = tail call i32 @nybble(i32 %7)
%9 = or i32 %8, %5
%10 = load i32, i32* %1
%11 = add nsw i32 %10, %9
store i32 %11, i32* %1
ret i32 %9
}
unsigned int perfctr_cstatus_nractrs(unsigned int cstatus) {
  return cstatus & 0x7F;
}


x86 assembly (clang, -O0):
<perfctr_cstatus_nractrs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<perfctr_cstatus_nractrs>:
mov    %edi,%eax
and    $0x7f,%eax
ret

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

LLVM IR (-O2):
define i32 @perfctr_cstatus_nractrs(i32 %0) {
%2 = and i32 %0, 127
ret i32 %2
}
char InsertChr(char c) {
  return ((c >= 'A' && c <= 'Z')                 ? c + 'a' - 'A'
          : ((c >= '0' && c <= '9') || c == '-') ? '.'
                                                 : c);
}


x86 assembly (clang, -O0):
<InsertChr>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1136 <InsertChr+0x36>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     1136 <InsertChr+0x36>
movsbl -0x1(%rbp),%eax
add    $0x61,%eax
sub    $0x41,%eax
mov    %eax,-0x8(%rbp)
jmp    1177 <InsertChr+0x77>
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     1150 <InsertChr+0x50>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jle    115d <InsertChr+0x5d>
movsbl -0x1(%rbp),%eax
cmp    $0x2d,%eax
jne    116a <InsertChr+0x6a>
mov    $0x2e,%eax
mov    %eax,-0xc(%rbp)
jmp    1171 <InsertChr+0x71>
movsbl -0x1(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<InsertChr>:
mov    %edi,%eax
lea    -0x41(%rax),%ecx
cmp    $0x19,%cl
ja     110d <InsertChr+0xd>
add    $0x20,%al
ret
lea    -0x30(%rax),%ecx
cmp    $0xa,%cl
movzbl %al,%ecx
mov    $0x2e,%edx
cmovb  %edx,%ecx
cmp    $0x2d,%al
cmove  %edx,%ecx
mov    %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @InsertChr(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 90
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = add nsw i32 %12, 97
%14 = sub nsw i32 %13, 65
br label %33
15: ; preds = %6, %1
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = icmp sge i32 %17, 48
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = icmp sle i32 %21, 57
br i1 %22, label %27, label %23
23: ; preds = %19, %15
%24 = load i8, i8* %2
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 45
br i1 %26, label %27, label %28
27: ; preds = %23, %19
br label %31
28: ; preds = %23
%29 = load i8, i8* %2
%30 = sext i8 %29 to i32
br label %31
31: ; preds = %28, %27
%32 = phi i32 [ 46, %27 ], [ %30, %28 ]
br label %33
33: ; preds = %31, %10
%34 = phi i32 [ %14, %10 ], [ %32, %31 ]
%35 = trunc i32 %34 to i8
ret i8 %35
}

LLVM IR (-O2):
define signext i8 @InsertChr(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = add nuw nsw i8 %0, 32
br label %12
6: ; preds = %1
%7 = add i8 %0, -48
%8 = icmp ult i8 %7, 10
%9 = icmp eq i8 %0, 45
%10 = or i1 %9, %8
%11 = select i1 %10, i8 46, i8 %0
br label %12
12: ; preds = %6, %4
%13 = phi i8 [ %5, %4 ], [ %11, %6 ]
ret i8 %13
}
/* Variables and functions */
int /*<<< orphan*/ fge22(int);
int /*<<< orphan*/ fge32(int);
int /*<<< orphan*/ fgt22(int);
int /*<<< orphan*/ fgt32(int);
int /*<<< orphan*/ fle22(int);
int /*<<< orphan*/ fle32(int);
int /*<<< orphan*/ flt22(int);
int /*<<< orphan*/ flt32(int);
int main(int argc, char *argv[]) {
  fle22(argc);
  fle32(argc);
  flt22(argc);
  flt32(argc);
  fgt22(argc);
  fgt32(argc);
  fge22(argc);
  fge32(argc);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <fle22@plt>
mov    -0x4(%rbp),%edi
call   1050 <fle32@plt>
mov    -0x4(%rbp),%edi
call   10a0 <flt22@plt>
mov    -0x4(%rbp),%edi
call   1060 <flt32@plt>
mov    -0x4(%rbp),%edi
call   1030 <fgt22@plt>
mov    -0x4(%rbp),%edi
call   1070 <fgt32@plt>
mov    -0x4(%rbp),%edi
call   1090 <fge22@plt>
mov    -0x4(%rbp),%edi
call   1080 <fge32@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %edi,%ebx
call   1040 <fle22@plt>
mov    %ebx,%edi
call   1050 <fle32@plt>
mov    %ebx,%edi
call   10a0 <flt22@plt>
mov    %ebx,%edi
call   1060 <flt32@plt>
mov    %ebx,%edi
call   1030 <fgt22@plt>
mov    %ebx,%edi
call   1070 <fgt32@plt>
mov    %ebx,%edi
call   1090 <fge22@plt>
mov    %ebx,%edi
call   1080 <fge32@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = call i32 @fle22(i32 %5)
%7 = load i32, i32* %3
%8 = call i32 @fle32(i32 %7)
%9 = load i32, i32* %3
%10 = call i32 @flt22(i32 %9)
%11 = load i32, i32* %3
%12 = call i32 @flt32(i32 %11)
%13 = load i32, i32* %3
%14 = call i32 @fgt22(i32 %13)
%15 = load i32, i32* %3
%16 = call i32 @fgt32(i32 %15)
%17 = load i32, i32* %3
%18 = call i32 @fge22(i32 %17)
%19 = load i32, i32* %3
%20 = call i32 @fge32(i32 %19)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @fle22(i32 %0)
%4 = tail call i32 @fle32(i32 %0)
%5 = tail call i32 @flt22(i32 %0)
%6 = tail call i32 @flt32(i32 %0)
%7 = tail call i32 @fgt22(i32 %0)
%8 = tail call i32 @fgt32(i32 %0)
%9 = tail call i32 @fge22(i32 %0)
%10 = tail call i32 @fge32(i32 %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int c = 42;
  c = c * c + 42;
  printf("Having done stuff, c is now %d\n", c);
}


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"Having done stuff, c is now %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 42, i32* %1
%2 = load i32, i32* %1
%3 = load i32, i32* %1
%4 = mul nsw i32 %2, %3
%5 = add nsw i32 %4, 42
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"Having done stuff, c is now %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 1806)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ wclear(int /*<<< orphan*/ *);
void clearWindow(WINDOW *window) { wclear(window); }


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

x86 assembly (clang, -O2):
<clearWindow>:
jmp    1030 <wclear@plt>

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

LLVM IR (-O2):
define void @clearWindow(i32* %0) {
%2 = tail call i32 @wclear(i32* %0)
ret void
}
/* Variables and functions */
scalar_t__ isspace(char);
void whitespace_to_under(char *s, int sLen) {
  for (; sLen-- > 0; s++) {
    if (isspace(*s))
      *s = '_';
  }
}


x86 assembly (clang, -O0):
<whitespace_to_under>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
jle    1166 <whitespace_to_under+0x56>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1150 <whitespace_to_under+0x40>
mov    -0x8(%rbp),%rax
movb   $0x5f,(%rax)
jmp    1155 <whitespace_to_under+0x45>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111f <whitespace_to_under+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<whitespace_to_under>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
jle    114e <whitespace_to_under+0x3e>
mov    %esi,%ebp
mov    %rdi,%rbx
add    $0x1,%ebp
jmp    113c <whitespace_to_under+0x2c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
jbe    114e <whitespace_to_under+0x3e>
movsbl (%rbx),%edi
call   1030 <isspace@plt>
test   %rax,%rax
je     1130 <whitespace_to_under+0x20>
movb   $0x5f,(%rbx)
jmp    1130 <whitespace_to_under+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @whitespace_to_under(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %15
4: ; preds = %2, %12
%5 = phi i32 [ %7, %12 ], [ %1, %2 ]
%6 = phi i8* [ %13, %12 ], [ %0, %2 ]
%7 = add nsw i32 %5, -1
%8 = load i8, i8* %6
%9 = tail call i64 @isspace(i8 signext %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %4
store i8 95, i8* %6
br label %12
12: ; preds = %4, %11
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = icmp ugt i32 %5, 1
br i1 %14, label %4, label %15
15: ; preds = %12, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void get_subdirname(void) { printf("arm"); }


x86 assembly (clang, -O0):
<get_subdirname>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"arm\00"
define void @get_subdirname() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct mm_struct {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ write_aux_reg(int, unsigned long);
void mmu_setup_asid(struct mm_struct *mm, unsigned long asid) {
  write_aux_reg(0x468, asid | ((1 << 31) | (1 << 30)));
}


x86 assembly (clang, -O0):
<mmu_setup_asid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
or     $0xffffffffc0000000,%rsi
mov    $0x468,%edi
call   1030 <write_aux_reg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mmu_setup_asid>:
or     $0xffffffffc0000000,%rsi
mov    $0x468,%edi
jmp    1030 <write_aux_reg@plt>

LLVM IR (-O0):
%struct.mm_struct = type { i32 }
define void @mmu_setup_asid(%struct.mm_struct* %0, i64 %1) {
%3 = alloca %struct.mm_struct*
%4 = alloca i64
store %struct.mm_struct* %0, %struct.mm_struct** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = or i64 %5, -1073741824
%7 = call i32 @write_aux_reg(i32 1128, i64 %6)
ret void
}

LLVM IR (-O2):
%struct.mm_struct = type { i32 }
define void @mmu_setup_asid(%struct.mm_struct* nocapture readnone %0, i64 %1) {
%3 = or i64 %1, -1073741824
%4 = tail call i32 @write_aux_reg(i32 1128, i64 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, unsigned char);
void sprint_add_Rn(char *str, unsigned char n) {
  sprintf(str, "ADD   A, R%X                     ", n);
}


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

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

LLVM IR (-O0):
@.str = [34 x i8] c"ADD A, R%X \00"
define void @sprint_add_Rn(i8* %0, i8 zeroext %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 @sprintf(i8* %5, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"ADD A, R%X \00"
define void @sprint_add_Rn(i8* nocapture writeonly %0, i8 zeroext %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8 zeroext %1)
ret void
}
int _hx509_sel_yywrap() { return 1; }


x86 assembly (clang, -O0):
<_hx509_sel_yywrap>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @_hx509_sel_yywrap() {
ret i32 1
}

LLVM IR (-O2):
define i32 @_hx509_sel_yywrap() {
ret i32 1
}
void kernel_main(struct multiboot *mb) {
  ksetup_console();
  kprintf("\ec");
  kputs("renaOS "
        "\x1B[36m"
        "0.1"
        "\x1B[0m"
        "\n");
  setup_system(mb);
  asm("sti");
  for (;;)
    asm("hlt");
}


x86 assembly (clang, -O0):
<kernel_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1060 <ksetup_console@plt>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1050 <kprintf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <kputs@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <setup_system@plt>
sti
hlt
jmp    117b <kernel_main+0x3b>

x86 assembly (clang, -O2):
<kernel_main>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1060 <ksetup_console@plt>
lea    0xeae(%rip),%rdi
xor    %eax,%eax
call   1050 <kprintf@plt>
lea    0xea3(%rip),%rdi
xor    %eax,%eax
call   1040 <kputs@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <setup_system@plt>
sti
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
hlt
jmp    1180 <kernel_main+0x40>

LLVM IR (-O0):
%struct.multiboot = type opaque
@.str = [3 x i8] c"\1Bc\00"
@.str.1 = [21 x i8] c"renaOS \1B[36m0.1\1B[0m\0A\00"
define void @kernel_main(%struct.multiboot* %0) {
%2 = alloca %struct.multiboot*
store %struct.multiboot* %0, %struct.multiboot** %2
%3 = call i32 (...) @ksetup_console()
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @kputs to i32 (i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%6 = load %struct.multiboot*, %struct.multiboot** %2
%7 = call i32 (%struct.multiboot*, ...) bitcast (i32 (...)* @setup_system to i32 (%struct.multiboot*, ...)*)(%struct.multiboot* %6)
br label %8
8: ; preds = %8, %1
br label %8
}

LLVM IR (-O2):
%struct.multiboot = type opaque
@.str = [3 x i8] c"\1Bc\00"
@.str.1 = [21 x i8] c"renaOS \1B[36m0.1\1B[0m\0A\00"
define void @kernel_main(%struct.multiboot* %0) {
%2 = tail call i32 (...) @ksetup_console()
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kputs to i32 (i8*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 (%struct.multiboot*, ...) bitcast (i32 (...)* @setup_system to i32 (%struct.multiboot*, ...)*)(%struct.multiboot* %0)
tail call void asm sideeffect "sti", "~{dirflag},~{fpsr},~{flags}"()
br label %6
6: ; preds = %6, %1
tail call void asm sideeffect "hlt", "~{dirflag},~{fpsr},~{flags}"()
br label %6
}
/* Variables and functions */
double get_nextpeople_qss(int);
double get_nextpeople(int i, double dummy_t) { return get_nextpeople_qss(i); }


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

x86 assembly (clang, -O2):
<get_nextpeople>:
jmp    1030 <get_nextpeople_qss@plt>

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

LLVM IR (-O2):
define double @get_nextpeople(i32 %0, double %1) {
%3 = tail call double @get_nextpeople_qss(i32 %0)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int setbits(int, int, int, int);
int main() {
  printf("setbits(11, 1, 2, 6) -> %u\n", setbits(11, 1, 2, 6));
  printf("setbits(11, 3, 2, 6) -> %u\n", setbits(11, 3, 2, 6));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x6,%ecx
call   1040 <setbits@plt>
mov    %eax,%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    $0xb,%edi
mov    $0x3,%esi
mov    $0x2,%edx
mov    $0x6,%ecx
call   1040 <setbits@plt>
mov    %eax,%esi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xb,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x6,%ecx
call   1040 <setbits@plt>
lea    0xebf(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0xb,%edi
mov    $0x3,%esi
mov    $0x2,%edx
mov    $0x6,%ecx
call   1040 <setbits@plt>
lea    0xeb4(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"setbits(11, 1, 2, 6) -> %u\0A\00"
@.str.1 = [28 x i8] c"setbits(11, 3, 2, 6) -> %u\0A\00"
define i32 @main() {
%1 = call i32 @setbits(i32 11, i32 1, i32 2, i32 6)
%2 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 @setbits(i32 11, i32 3, i32 2, i32 6)
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"setbits(11, 1, 2, 6) -> %u\0A\00"
@.str.1 = [28 x i8] c"setbits(11, 3, 2, 6) -> %u\0A\00"
define i32 @main() {
%1 = tail call i32 @setbits(i32 11, i32 1, i32 2, i32 6)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @setbits(i32 11, i32 3, i32 2, i32 6)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 0
}
int lm_rem_resource_dlm(struct lockspace *ls, struct resource *r) { return -1; }


x86 assembly (clang, -O0):
<lm_rem_resource_dlm>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.lockspace = type opaque
%struct.resource = type opaque
define i32 @lm_rem_resource_dlm(%struct.lockspace* %0, %struct.resource* %1) {
%3 = alloca %struct.lockspace*
%4 = alloca %struct.resource*
store %struct.lockspace* %0, %struct.lockspace** %3
store %struct.resource* %1, %struct.resource** %4
ret i32 -1
}

LLVM IR (-O2):
%struct.lockspace = type opaque
%struct.resource = type opaque
define i32 @lm_rem_resource_dlm(%struct.lockspace* nocapture readnone %0, %struct.resource* nocapture readnone %1) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void funcPram(int x) { printf("This is a function\n with a pram %d\n", x); }


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

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

LLVM IR (-O0):
@.str = [36 x i8] c"This is a function\0A with a pram %d\0A\00"
define void @funcPram(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"This is a function\0A with a pram %d\0A\00"
define void @funcPram(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ decrement(int *);
int /*<<< orphan*/ increment(int *);
int /*<<< orphan*/ reset(int *);
int main() {
  int count = 20;
  increment(&count);
  decrement(&count);
  reset(&count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <increment@plt>
lea    -0x8(%rbp),%rdi
call   1040 <decrement@plt>
lea    -0x8(%rbp),%rdi
call   1050 <reset@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x14,0xc(%rsp)
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <increment@plt>
mov    %rbx,%rdi
call   1040 <decrement@plt>
mov    %rbx,%rdi
call   1050 <reset@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 20, i32* %2
%3 = call i32 @increment(i32* %2)
%4 = call i32 @decrement(i32* %2)
%5 = call i32 @reset(i32* %2)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 20, i32* %1
%3 = call i32 @increment(i32* %1)
%4 = call i32 @decrement(i32* %1)
%5 = call i32 @reset(i32* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ pushNarray(char *, unsigned int);
void pushinteger16array_(void *x, unsigned int *n) {
  pushNarray((char *)x, (*n * 16));
}


x86 assembly (clang, -O0):
<pushinteger16array_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
shl    $0x4,%esi
call   1030 <pushNarray@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pushinteger16array_>:
mov    (%rsi),%esi
shl    $0x4,%esi
jmp    1030 <pushNarray@plt>

LLVM IR (-O0):
define void @pushinteger16array_(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 = load i32, i32* %6
%8 = mul i32 %7, 16
%9 = call i32 @pushNarray(i8* %5, i32 %8)
ret void
}

LLVM IR (-O2):
define void @pushinteger16array_(i8* %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = shl i32 %3, 4
%5 = tail call i32 @pushNarray(i8* %0, i32 %4)
ret void
}
/* Variables and functions */
scalar_t__ random32();
double randomDouble() { return ((double)random32() / (double)4294967296.0); }


x86 assembly (clang, -O0):
<randomDouble>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <random32@plt>
cvtsi2sd %rax,%xmm0
movsd  0xed8(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomDouble>:
push   %rax
xor    %eax,%eax
call   1030 <random32@plt>
cvtsi2sd %rax,%xmm0
mulsd  0xedb(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @randomDouble() {
%1 = call i64 (...) @random32()
%2 = sitofp i64 %1 to double
%3 = fdiv double %2, 0x41F0000000000000
ret double %3
}

LLVM IR (-O2):
define double @randomDouble() {
%1 = tail call i64 (...) @random32()
%2 = sitofp i64 %1 to double
%3 = fmul double %2, 0x3DF0000000000000
ret double %3
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int /*<<< orphan*/ *malloc(int);
int pthread_getattr_np(int /*<<< orphan*/, int /*<<< orphan*/ *);
int my_pthread_getattr_np(pthread_t thid, pthread_attr_t *__attr) {
  pthread_attr_t *realattr;
  realattr = malloc(sizeof(pthread_attr_t));
  *((int *)__attr) = (int)realattr;
  return pthread_getattr_np(thid, realattr);
}


x86 assembly (clang, -O0):
<my_pthread_getattr_np>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1030 <pthread_getattr_np@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_pthread_getattr_np>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %eax,(%rbx)
mov    %ebp,%edi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <pthread_getattr_np@plt>

LLVM IR (-O0):
define i32 @my_pthread_getattr_np(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = call i32* @malloc(i32 4)
store i32* %6, i32** %5
%7 = load i32*, i32** %5
%8 = ptrtoint i32* %7 to i32
%9 = load i32*, i32** %4
store i32 %8, i32* %9
%10 = load i32, i32* %3
%11 = load i32*, i32** %5
%12 = call i32 @pthread_getattr_np(i32 %10, i32* %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @my_pthread_getattr_np(i32 %0, i32* nocapture writeonly %1) {
%3 = tail call i32* @malloc(i32 4)
%4 = ptrtoint i32* %3 to i64
%5 = trunc i64 %4 to i32
store i32 %5, i32* %1
%6 = tail call i32 @pthread_getattr_np(i32 %0, i32* %3)
ret i32 %6
}
long unsigned int f(char *a) {
  a[0] = '1';
  return __builtin_strlen(a);
}


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

x86 assembly (clang, -O2):
<f>:
movb   $0x31,(%rdi)
jmp    1030 <strlen@plt>

LLVM IR (-O0):
define i64 @f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
store i8 49, i8* %4
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
ret i64 %6
}

LLVM IR (-O2):
define i64 @f(i8* nocapture %0) {
store i8 49, i8* %0
%2 = tail call i64 @strlen(i8* %0)
ret i64 %2
}
/* Variables and functions */
int xyzzy0(int);
int test0(void) { return xyzzy0(5); }


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

x86 assembly (clang, -O2):
<test0>:
mov    $0x5,%edi
jmp    1030 <xyzzy0@plt>

LLVM IR (-O0):
define i32 @test0() {
%1 = call i32 @xyzzy0(i32 5)
ret i32 %1
}

LLVM IR (-O2):
define i32 @test0() {
%1 = tail call i32 @xyzzy0(i32 5)
ret i32 %1
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void copy4(uint8_t *out, uint32_t x) {
  out[0] = x & 0xFF;
  out[1] = (x >> 8) & 0xFF;
  out[2] = (x >> 16) & 0xFF;
  out[3] = (x >> 24) & 0xFF;
}


x86 assembly (clang, -O0):
<copy4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x10,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy4>:
mov    %esi,%eax
movzbl %al,%ecx
mov    %ecx,(%rdi)
movzbl %ah,%ecx
mov    %ecx,0x4(%rdi)
mov    %esi,%ecx
shr    $0x10,%ecx
movzbl %cl,%ecx
mov    %ecx,0x8(%rdi)
shr    $0x18,%eax
mov    %eax,0xc(%rdi)
ret

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

LLVM IR (-O2):
define void @copy4(i32* nocapture writeonly %0, i32 %1) {
%3 = and i32 %1, 255
store i32 %3, i32* %0
%4 = lshr i32 %1, 8
%5 = and i32 %4, 255
%6 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %5, i32* %6
%7 = lshr i32 %1, 16
%8 = and i32 %7, 255
%9 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %8, i32* %9
%10 = lshr i32 %1, 24
%11 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %10, i32* %11
ret void
}
int cairo_code_draw_envMaximumLabel_get_width() { return 7; }


x86 assembly (clang, -O0):
<cairo_code_draw_envMaximumLabel_get_width>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @cairo_code_draw_envMaximumLabel_get_width() {
ret i32 7
}

LLVM IR (-O2):
define i32 @cairo_code_draw_envMaximumLabel_get_width() {
ret i32 7
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t enupr(uint16_t x) { return x & 0x000000ff; }


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

x86 assembly (clang, -O2):
<enupr>:
movzbl %dil,%eax
ret

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

LLVM IR (-O2):
define i32 @enupr(i32 %0) {
%2 = and i32 %0, 255
ret i32 %2
}
int has_xml_markers(const char *str, int len) {
  int i;
  for (i = 0; i < len; i++) {
    if (str[i] == '<' || str[i] == '>') {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<has_xml_markers>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1167 <has_xml_markers+0x67>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3c,%eax
je     1148 <has_xml_markers+0x48>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3e,%eax
jne    1154 <has_xml_markers+0x54>
movl   $0x1,-0x4(%rbp)
jmp    116e <has_xml_markers+0x6e>
jmp    1159 <has_xml_markers+0x59>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <has_xml_markers+0x12>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_xml_markers>:
test   %esi,%esi
jle    1125 <has_xml_markers+0x25>
mov    %esi,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movzbl (%rdi,%rcx,1),%edx
or     $0x2,%dl
cmp    $0x3e,%dl
je     1128 <has_xml_markers+0x28>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1110 <has_xml_markers+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @has_xml_markers(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 0, i32* %6
br label %7
7: ; preds = %29, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %32
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 60
br i1 %18, label %27, label %19
19: ; preds = %11
%20 = load i8*, i8** %4
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 62
br i1 %26, label %27, label %28
27: ; preds = %19, %11
store i32 1, i32* %3
br label %33
28: ; preds = %19
br label %29
29: ; preds = %28
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %7
32: ; preds = %7
store i32 0, i32* %3
br label %33
33: ; preds = %32, %27
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
define i32 @has_xml_markers(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %10
%7 = phi i64 [ 0, %4 ], [ %11, %10 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
switch i8 %9, label %10 [
i8 60, label %13
i8 62, label %13
]
10: ; preds = %6
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %6, %10, %2
%14 = phi i32 [ 0, %2 ], [ 0, %10 ], [ 1, %6 ], [ 1, %6 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ errno;
int __attribute__((weak)) _kill(int pid, int sig) {
  errno = EINVAL;
  return -1;
}


x86 assembly (clang, -O0):
<_kill>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ec7(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec6(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_kill>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
@errno = global i32 0
define weak i32 @_kill(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @EINVAL
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@EINVAL = global i32 0
@errno = global i32 0
define weak i32 @_kill(i32 %0, i32 %1) {
%3 = load i32, i32* @EINVAL
store i32 %3, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void extfree(void *ptr) { free((char *)ptr); }


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

x86 assembly (clang, -O2):
<extfree>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @extfree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
int /*<<< orphan*/ IntDisable(int);
int /*<<< orphan*/ IntUnregister(int);
void I2SIntUnregister(unsigned long ulBase) {
  DEBUG_ASSERT(ulBase == 0x40054000);
  IntDisable(68);
  IntUnregister(68);
}


x86 assembly (clang, -O0):
<I2SIntUnregister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x40054000,-0x8(%rbp)
40
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <DEBUG_ASSERT@plt>
mov    $0x44,%edi
call   1030 <IntDisable@plt>
mov    $0x44,%edi
call   1050 <IntUnregister@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2SIntUnregister>:
push   %rax
xor    %eax,%eax
cmp    $0x40054000,%rdi
sete   %al
mov    %eax,%edi
call   1040 <DEBUG_ASSERT@plt>
mov    $0x44,%edi
call   1030 <IntDisable@plt>
mov    $0x44,%edi
pop    %rax
jmp    1050 <IntUnregister@plt>

LLVM IR (-O0):
define void @I2SIntUnregister(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp eq i64 %3, 1074085888
%5 = zext i1 %4 to i32
%6 = call i32 @DEBUG_ASSERT(i32 %5)
%7 = call i32 @IntDisable(i32 68)
%8 = call i32 @IntUnregister(i32 68)
ret void
}

LLVM IR (-O2):
define void @I2SIntUnregister(i64 %0) {
%2 = icmp eq i64 %0, 1074085888
%3 = zext i1 %2 to i32
%4 = tail call i32 @DEBUG_ASSERT(i32 %3)
%5 = tail call i32 @IntDisable(i32 68)
%6 = tail call i32 @IntUnregister(i32 68)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int /*<<< orphan*/);
int /*<<< orphan*/ UARTBaseValid(unsigned long);
unsigned long UARTParityModeGet(unsigned long ulBase) {
  DEBUG_ASSERT(UARTBaseValid(ulBase));
  return ((*((volatile unsigned long *)(ulBase + 0x0000002C))) &
          (0x00000080 | 0x00000004 | 0x00000002));
}


x86 assembly (clang, -O0):
<UARTParityModeGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <UARTBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rax
mov    0x2c(%rax),%rax
and    $0x86,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTParityModeGet>:
push   %rbx
mov    %rdi,%rbx
call   1040 <UARTBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    0x2c(%rbx),%rax
and    $0x86,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @UARTParityModeGet(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @UARTBaseValid(i64 %3)
%5 = call i32 @DEBUG_ASSERT(i32 %4)
%6 = load i64, i64* %2
%7 = add i64 %6, 44
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = and i64 %9, 134
ret i64 %10
}

LLVM IR (-O2):
define i64 @UARTParityModeGet(i64 %0) {
%2 = tail call i32 @UARTBaseValid(i64 %0)
%3 = tail call i32 @DEBUG_ASSERT(i32 %2)
%4 = add i64 %0, 44
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, 134
ret i64 %7
}
/* Variables and functions */
char *date_get_now_date_yyyy_mm_dd(int);
char *date_now_yyyy_mm_dd(int utc_offset) {
  return date_get_now_date_yyyy_mm_dd(utc_offset);
}


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

x86 assembly (clang, -O2):
<date_now_yyyy_mm_dd>:
jmp    1030 <date_get_now_date_yyyy_mm_dd@plt>

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

LLVM IR (-O2):
define i8* @date_now_yyyy_mm_dd(i32 %0) {
%2 = tail call i8* @date_get_now_date_yyyy_mm_dd(i32 %0)
ret i8* %2
}
int log_2(int j) {
  int i;
  for (i = 0; j > 0; i++)
    j >>= 1;
  return i - 1;
}


x86 assembly (clang, -O0):
<log_2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    112f <log_2+0x2f>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <log_2+0xe>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_2>:
mov    $0xffffffff,%eax
test   %edi,%edi
jle    111c <log_2+0x1c>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
shr    %ecx
add    $0x1,%eax
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <log_2+0x10>
ret

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

LLVM IR (-O2):
define i32 @log_2(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i32 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp ult i32 %5, 2
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ -1, %1 ], [ %4, %3 ]
ret i32 %10
}
int jac_chain_nm5_n_out(void) { return 2; }


x86 assembly (clang, -O0):
<jac_chain_nm5_n_out>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @jac_chain_nm5_n_out() {
ret i32 2
}

LLVM IR (-O2):
define i32 @jac_chain_nm5_n_out() {
ret i32 2
}