xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
char *strrev(char *);
void main() {
  char str[20];
  printf("\n\n Enter string: ");
  gets(str);
  printf("\n\nString is: %s", str);
  printf("\nReverse String is: %s", strrev(str));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <gets@plt>
lea    -0x20(%rbp),%rsi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1050 <strrev@plt>
mov    %rax,%rsi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <gets@plt>
lea    0xebd(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1050 <strrev@plt>
lea    0xeb4(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"\0A\0A Enter string: \00"
@.str.1 = [16 x i8] c"\0A\0AString is: %s\00"
@.str.2 = [23 x i8] c"\0AReverse String is: %s\00"
define void @main() {
%1 = alloca [20 x i8]
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = call i32 @gets(i8* %3)
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%8 = call i8* @strrev(i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %8)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"\0A\0A Enter string: \00"
@.str.1 = [16 x i8] c"\0A\0AString is: %s\00"
@.str.2 = [23 x i8] c"\0AReverse String is: %s\00"
define void @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = call i8* @strrev(i8* %2)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* %6)
ret void
}
void RandomFunc(unsigned long input[1], unsigned long output[1]) {
  unsigned long state[1];
  unsigned long local2;
  unsigned long local1;
  {
    state[0UL] = input[0UL] + 0xffffffffff660b45UL;
    local1 = 0UL;
    while (local1 < 1UL) {
      local2 = 0UL;
      while (local2 < 1UL) {
        state[0UL] += state[0UL];
        local2 += 2UL;
      }
      local1 += 2UL;
    }
    output[0UL] = state[0UL] + 36349851719828416UL;
  }
}


x86 assembly (clang, -O0):
<RandomFunc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
add    $0xffffffffff660b45,%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
cmpq   $0x1,-0x28(%rbp)
jae    1171 <RandomFunc+0x71>
movq   $0x0,-0x20(%rbp)
cmpq   $0x1,-0x20(%rbp)
jae    1160 <RandomFunc+0x60>
mov    -0x18(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x20(%rbp)
jmp    1138 <RandomFunc+0x38>
mov    -0x28(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x28(%rbp)
jmp    1125 <RandomFunc+0x25>
movabs $0x8123ff5f6603c0,%rcx
add    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomFunc>:
mov    (%rdi),%rax
movabs $0x8123ff5e321a4a,%rcx
lea    (%rcx,%rax,2),%rax
mov    %rax,(%rsi)
ret

LLVM IR (-O0):
define void @RandomFunc(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca [1 x i64]
%6 = alloca i64
%7 = alloca i64
store i64* %0, i64** %3
store i64* %1, i64** %4
%8 = load i64*, i64** %3
%9 = getelementptr inbounds i64, i64* %8, i64 0
%10 = load i64, i64* %9
%11 = add i64 %10, -10089659
%12 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
store i64 %11, i64* %12
store i64 0, i64* %7
br label %13
13: ; preds = %28, %2
%14 = load i64, i64* %7
%15 = icmp ult i64 %14, 1
br i1 %15, label %16, label %31
16: ; preds = %13
store i64 0, i64* %6
br label %17
17: ; preds = %20, %16
%18 = load i64, i64* %6
%19 = icmp ult i64 %18, 1
br i1 %19, label %20, label %28
20: ; preds = %17
%21 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
%22 = load i64, i64* %21
%23 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
%24 = load i64, i64* %23
%25 = add i64 %24, %22
store i64 %25, i64* %23
%26 = load i64, i64* %6
%27 = add i64 %26, 2
store i64 %27, i64* %6
br label %17
28: ; preds = %17
%29 = load i64, i64* %7
%30 = add i64 %29, 2
store i64 %30, i64* %7
br label %13
31: ; preds = %13
%32 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
%33 = load i64, i64* %32
%34 = add i64 %33, 36349851719828416
%35 = load i64*, i64** %4
%36 = getelementptr inbounds i64, i64* %35, i64 0
store i64 %34, i64* %36
ret void
}

LLVM IR (-O2):
define void @RandomFunc(i64* nocapture %0, i64* nocapture writeonly %1) {
%3 = load i64, i64* %0
%4 = shl i64 %3, 1
%5 = add i64 %4, 36349851699649098
store i64 %5, i64* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ put8(int);
void mul_reg32(unsigned int reg32) {
  put8(0xF7);
  put8(0xE0 + reg32);
}


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

x86 assembly (clang, -O2):
<mul_reg32>:
push   %rbx
mov    %edi,%ebx
mov    $0xf7,%edi
call   1030 <put8@plt>
add    $0xe0,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <put8@plt>

LLVM IR (-O0):
define void @mul_reg32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @put8(i32 247)
%4 = load i32, i32* %2
%5 = add i32 224, %4
%6 = call i32 @put8(i32 %5)
ret void
}

LLVM IR (-O2):
define void @mul_reg32(i32 %0) {
%2 = tail call i32 @put8(i32 247)
%3 = add i32 %0, 224
%4 = tail call i32 @put8(i32 %3)
ret void
}
void test(char yylval) {
  char *yyvsp;

#pragma GCC diagnostic push

#pragma GCC diagnostic ignored "-Wuninitialized"

#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

  *++yyvsp = yylval;

#pragma GCC diagnostic pop
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define void @test(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8*
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i32 1
store i8* %6, i8** %3
store i8 %4, i8* %6
ret void
}

LLVM IR (-O2):
int xmlUCSIsOpticalCharacterRecognition(int code) {
  return (((code >= 0x2440) && (code <= 0x245F)));
}


x86 assembly (clang, -O0):
<xmlUCSIsOpticalCharacterRecognition>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x2440,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1126 <xmlUCSIsOpticalCharacterRecognition+0x26>
cmpl   $0x245f,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmlUCSIsOpticalCharacterRecognition>:
and    $0xffffffe0,%edi
xor    %eax,%eax
cmp    $0x2440,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @xmlUCSIsOpticalCharacterRecognition(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 9280
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 9311
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @xmlUCSIsOpticalCharacterRecognition(i32 %0) {
%2 = and i32 %0, -32
%3 = icmp eq i32 %2, 9280
%4 = zext i1 %3 to i32
ret i32 %4
}
int detect_cpu() {
  unsigned long ebx, unused;
  __asm__("cpuid"
          : "=a"(unused), "=b"(ebx), "=c"(unused), "=d"(unused)
          : "a"(0));
  ;
  switch (ebx) {
  case 0x756e6547:
    do_intel();
    break;
  case 0x68747541:
    do_amd();
    break;
  default:
    kprint("Unknown x86 CPU Detected\n");
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<detect_cpu>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
cpuid
mov    %rax,-0x18(%rbp)
mov    %rbx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
sub    $0x68747541,%rax
je     1187 <detect_cpu+0x57>
jmp    1166 <detect_cpu+0x36>
mov    -0x20(%rbp),%rax
sub    $0x756e6547,%rax
jne    1193 <detect_cpu+0x63>
jmp    117b <detect_cpu+0x4b>
mov    $0x0,%al
call   1040 <do_intel@plt>
jmp    11a1 <detect_cpu+0x71>
mov    $0x0,%al
call   1030 <do_amd@plt>
jmp    11a1 <detect_cpu+0x71>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1050 <kprint@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<detect_cpu>:
push   %rbx
xor    %eax,%eax
cpuid
cmp    $0x68747541,%rbx
je     1150 <detect_cpu+0x20>
cmp    $0x756e6547,%rbx
jne    1159 <detect_cpu+0x29>
xor    %eax,%eax
call   1040 <do_intel@plt>
jmp    1167 <detect_cpu+0x37>
xor    %eax,%eax
call   1030 <do_amd@plt>
jmp    1167 <detect_cpu+0x37>
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1050 <kprint@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Unknown x86 CPU Detected\0A\00"
define i32 @detect_cpu() {
%1 = alloca i64
%2 = alloca i64
%3 = call { i64, i64, i64, i64 } asm "cpuid", "={ax},={bx},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 0)
%4 = extractvalue { i64, i64, i64, i64 } %3, 0
%5 = extractvalue { i64, i64, i64, i64 } %3, 1
%6 = extractvalue { i64, i64, i64, i64 } %3, 2
%7 = extractvalue { i64, i64, i64, i64 } %3, 3
store i64 %4, i64* %2
store i64 %5, i64* %1
store i64 %6, i64* %2
store i64 %7, i64* %2
%8 = load i64, i64* %1
switch i64 %8, label %13 [
i64 1970169159, label %9
i64 1752462657, label %11
]
9: ; preds = %0
%10 = call i32 (...) @do_intel()
br label %15
11: ; preds = %0
%12 = call i32 (...) @do_amd()
br label %15
13: ; preds = %0
%14 = call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %11, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"Unknown x86 CPU Detected\0A\00"
define i32 @detect_cpu() {
%1 = tail call { i64, i64, i64, i64 } asm "cpuid", "={ax},={bx},={cx},={dx},{ax},~{dirflag},~{fpsr},~{flags}"(i32 0)
%2 = extractvalue { i64, i64, i64, i64 } %1, 1
switch i64 %2, label %7 [
i64 1970169159, label %3
i64 1752462657, label %5
]
3: ; preds = %0
%4 = tail call i32 (...) @do_intel()
br label %9
5: ; preds = %0
%6 = tail call i32 (...) @do_amd()
br label %9
7: ; preds = %0
%8 = tail call i32 (i8*, ...) bitcast (i32 (...)* @kprint to i32 (i8*, ...)*)(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %5, %3
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ mock_get_c_wait(char *, int /*<<< orphan*/);
char mock_get_c() {
  char c = 0;
  mock_get_c_wait(&c, 0);
  return c;
}


x86 assembly (clang, -O0):
<mock_get_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x0,-0x1(%rbp)
lea    -0x1(%rbp),%rdi
xor    %esi,%esi
call   1030 <mock_get_c_wait@plt>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mock_get_c>:
push   %rax
movb   $0x0,0x7(%rsp)
lea    0x7(%rsp),%rdi
xor    %esi,%esi
call   1030 <mock_get_c_wait@plt>
mov    0x7(%rsp),%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @mock_get_c() {
%1 = alloca i8
store i8 0, i8* %1
%2 = call i32 @mock_get_c_wait(i8* %1, i32 0)
%3 = load i8, i8* %1
ret i8 %3
}

LLVM IR (-O2):
define signext i8 @mock_get_c() {
%1 = alloca i8
store i8 0, i8* %1
%2 = call i32 @mock_get_c_wait(i8* %1, i32 0)
%3 = load i8, i8* %1
ret i8 %3
}
OP(ed, d5) { illegal_2(); }


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_2()
ret i32 undef
}
int main() { return 0; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void signed_char_shl_unsigned_char(signed char *LHS, unsigned char RHS) {
  (*LHS) <<= RHS;
}


x86 assembly (clang, -O0):
<signed_char_shl_unsigned_char>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%ecx
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
shl    %cl,%edx
mov    %edx,%ecx
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<signed_char_shl_unsigned_char>:
mov    %esi,%ecx
movzbl (%rdi),%eax
shl    %cl,%eax
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @signed_char_shl_unsigned_char(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* %4
%6 = zext i8 %5 to i32
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = shl i32 %9, %6
%11 = trunc i32 %10 to i8
store i8 %11, i8* %7
ret void
}

LLVM IR (-O2):
define void @signed_char_shl_unsigned_char(i8* nocapture %0, i8 zeroext %1) {
%3 = zext i8 %1 to i32
%4 = load i8, i8* %0
%5 = zext i8 %4 to i32
%6 = shl i32 %5, %3
%7 = trunc i32 %6 to i8
store i8 %7, i8* %0
ret void
}
int diff(const void *a, const void *b) {
  const int *ia = a, *ib = b;
  return *ia - *ib;
}


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

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

LLVM IR (-O0):
define i32 @diff(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %6
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = load i32*, i32** %6
%14 = load i32, i32* %13
%15 = sub nsw i32 %12, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @diff(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %5, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%i", &n);
  return n % 3;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <scanf@plt>
movslq 0x4(%rsp),%rax
imul   $0x55555556,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = srem i32 %4, 3
ret i32 %5
}
double jfabs(double x) {
  *(1 + (int *)&x) &= 0x7fffffff;
  return x;
}


x86 assembly (clang, -O0):
<jfabs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7fffffff,%eax
mov    %eax,-0x4(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<jfabs>:
andps  0xef9(%rip),%xmm0
ret

LLVM IR (-O0):
define double @jfabs(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = bitcast double* %2 to i32*
%4 = getelementptr inbounds i32, i32* %3, i64 1
%5 = load i32, i32* %4
%6 = and i32 %5, 2147483647
store i32 %6, i32* %4
%7 = load double, double* %2
ret double %7
}

LLVM IR (-O2):
define double @jfabs(double %0) {
%2 = bitcast double %0 to i64
%3 = and i64 %2, 9223372036854775807
%4 = bitcast i64 %3 to double
ret double %4
}
void check_hostname(char *s) {
  int i = 0;
  while (*(s + i)) {
    if (*(s + i) == '/')
      *(s + i) = 0x57;
    if (*(s + i) == ':')
      *(s + i) = 0x72;
    i++;
  }
}


x86 assembly (clang, -O0):
<check_hostname>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1171 <check_hostname+0x71>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
jne    1142 <check_hostname+0x42>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x57,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3a,%eax
jne    1163 <check_hostname+0x63>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x72,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <check_hostname+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_hostname>:
jmp    1118 <check_hostname+0x18>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x72,%al
mov    %al,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x2f,%al
je     1130 <check_hostname+0x30>
cmp    $0x3a,%al
je     1110 <check_hostname+0x10>
test   %al,%al
jne    1114 <check_hostname+0x14>
jmp    1134 <check_hostname+0x34>
nopl   0x0(%rax)
mov    $0x57,%al
jmp    1112 <check_hostname+0x12>
ret

LLVM IR (-O0):
define void @check_hostname(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %37, %1
%5 = load i8*, i8** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %40
11: ; preds = %4
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%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, 47
br i1 %18, label %19, label %24
19: ; preds = %11
%20 = load i8*, i8** %2
%21 = load i32, i32* %3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
store i8 87, i8* %23
br label %24
24: ; preds = %19, %11
%25 = load i8*, i8** %2
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 58
br i1 %31, label %32, label %37
32: ; preds = %24
%33 = load i8*, i8** %2
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
store i8 114, i8* %36
br label %37
37: ; preds = %32, %24
%38 = load i32, i32* %3
%39 = add nsw i32 %38, 1
store i32 %39, i32* %3
br label %4
40: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @check_hostname(i8* nocapture %0) {
br label %2
2: ; preds = %9, %1
%3 = phi i64 [ %10, %9 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
switch i8 %5, label %9 [
i8 0, label %11
i8 47, label %7
i8 58, label %6
]
6: ; preds = %2
br label %7
7: ; preds = %2, %6
%8 = phi i8 [ 114, %6 ], [ 87, %2 ]
store i8 %8, i8* %4
br label %9
9: ; preds = %7, %2
%10 = add nuw i64 %3, 1
br label %2
11: ; preds = %2
ret void
}
void exchange(int *array, int x, int y) {
  int temp = array[x];
  array[x] = array[y];
  array[y] = temp;
}


x86 assembly (clang, -O0):
<exchange>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<exchange>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

LLVM IR (-O0):
define void @exchange(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 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = load i32, i32* %11
store i32 %12, i32* %7
%13 = load i32*, i32** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = load i32*, i32** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 %17, i32* %21
%22 = load i32, i32* %7
%23 = load i32*, i32** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 %22, i32* %26
ret void
}

LLVM IR (-O2):
define void @exchange(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
/* Variables and functions */
int execlp(char *, char *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
void main() {
  int result;
  printf("Executing ls\n");
  result = execlp("ls", "ls", "-l", (char *)0);
  printf("This is never seen unless execlp failed: %d\n", result);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rsi
lea    0xecd(%rip),%rdx
xor    %eax,%eax
mov    %eax,%ecx
mov    %rsi,%rdi
call   1040 <execlp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef6(%rip),%rdi
lea    0xeb5(%rip),%rdx
mov    %rdi,%rsi
xor    %ecx,%ecx
call   1050 <execlp@plt>
lea    0xea7(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
pop    %rcx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Executing ls\0A\00"
@.str.1 = [3 x i8] c"ls\00"
@.str.2 = [3 x i8] c"-l\00"
@.str.3 = [45 x i8] c"This is never seen unless execlp failed: %d\0A\00"
define void @main() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @execlp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* null)
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"ls\00"
@.str.2 = [3 x i8] c"-l\00"
@.str.3 = [45 x i8] c"This is never seen unless execlp failed: %d\0A\00"
@str = [13 x i8] c"Executing ls\00"
define void @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @execlp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* null)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i32 %2)
ret void
}
/* Variables and functions */
size_t align(size_t n, size_t s) { return (n + s - 1) & ~(s - 1); }


x86 assembly (clang, -O0):
<align>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
sub    $0x1,%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
xor    $0xffffffffffffffff,%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<align>:
lea    (%rdi,%rsi,1),%rax
add    $0xffffffffffffffff,%rax
neg    %rsi
and    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @align(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = add i64 %5, %6
%8 = sub i64 %7, 1
%9 = load i64, i64* %4
%10 = sub i64 %9, 1
%11 = xor i64 %10, -1
%12 = and i64 %8, %11
ret i64 %12
}

LLVM IR (-O2):
define i64 @align(i64 %0, i64 %1) {
%3 = add i64 %0, -1
%4 = add i64 %3, %1
%5 = sub i64 0, %1
%6 = and i64 %4, %5
ret i64 %6
}
void tegra_mipi_cal_clk_enable(struct tegra_mipi_cal *mipi_cal) {}


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

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

LLVM IR (-O0):
%struct.tegra_mipi_cal = type opaque
define void @tegra_mipi_cal_clk_enable(%struct.tegra_mipi_cal* %0) {
%2 = alloca %struct.tegra_mipi_cal*
store %struct.tegra_mipi_cal* %0, %struct.tegra_mipi_cal** %2
ret void
}

LLVM IR (-O2):
%struct.tegra_mipi_cal = type opaque
define void @tegra_mipi_cal_clk_enable(%struct.tegra_mipi_cal* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void FsmTrace(char *buf, int len) { printf("Lag FSM: %s", buf); }


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"Lag FSM: %s\00"
define void @FsmTrace(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 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Lag FSM: %s\00"
define void @FsmTrace(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int feraiseexcept(int excepts) { return (excepts != 0); }


x86 assembly (clang, -O0):
<feraiseexcept>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<feraiseexcept>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @feraiseexcept(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @feraiseexcept(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
mymspecial(leng, mess) int leng;
char *mess;
{
  prtime();
  printf("SeqSpec");
  prhex(mess, leng);
}


x86 assembly (clang, -O0):
<mymspecial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <prtime@plt>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    $0x0,%al
call   1040 <prhex@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mymspecial>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1050 <prtime@plt>
lea    0xeba(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <prhex@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"SeqSpec\00"
define i32 @mymspecial(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = call i32 (...) @prtime()
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %5
%9 = load i32, i32* %4
%10 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @prhex to i32 (i8*, i32, ...)*)(i8* %8, i32 %9)
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@.str = [8 x i8] c"SeqSpec\00"
define i32 @mymspecial(i32 %0, i8* %1) {
%3 = tail call i32 (...) @prtime()
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @prhex to i32 (i8*, i32, ...)*)(i8* %1, i32 %0)
ret i32 undef
}
void swap(int i, int j, double *arr) {
  double h = arr[i];
  arr[i] = arr[j];
  arr[j] = h;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %edi,%rax
movsd  (%rdx,%rax,8),%xmm0
movslq %esi,%rcx
movsd  (%rdx,%rcx,8),%xmm1
movsd  %xmm1,(%rdx,%rax,8)
movsd  %xmm0,(%rdx,%rcx,8)
ret

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

LLVM IR (-O2):
define void @swap(i32 %0, i32 %1, double* nocapture %2) {
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds double, double* %2, i64 %4
%6 = load double, double* %5
%7 = sext i32 %1 to i64
%8 = getelementptr inbounds double, double* %2, i64 %7
%9 = load double, double* %8
store double %9, double* %5
store double %6, double* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void *thread_func(void *arg) {
  fprintf(stderr, "The thread.\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<thread_func>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [13 x i8] c"The thread.\0A\00"
define noalias i8* @thread_func(i8* nocapture readnone %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ U_WMRCORE_U16_N16_swap(char *, int);
void U_WMRPOLYGON_swap(char *record, int torev) {
  U_WMRCORE_U16_N16_swap(record, torev);
}


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

x86 assembly (clang, -O2):
<U_WMRPOLYGON_swap>:
jmp    1030 <U_WMRCORE_U16_N16_swap@plt>

LLVM IR (-O0):
define void @U_WMRPOLYGON_swap(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 i32 @U_WMRCORE_U16_N16_swap(i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @U_WMRPOLYGON_swap(i8* %0, i32 %1) {
%3 = tail call i32 @U_WMRCORE_U16_N16_swap(i8* %0, i32 %1)
ret void
}
int ReverseNumber(int numb) {
  int reverse = 0;
  while (numb > 0) {
    int remainder = numb % 10;
    numb /= 10;
    reverse += remainder;
    reverse *= 10;
  }
  reverse /= 10;
  return reverse;
}


x86 assembly (clang, -O0):
<ReverseNumber>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1149 <ReverseNumber+0x49>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
imul   $0xa,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    110e <ReverseNumber+0xe>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReverseNumber>:
test   %edi,%edi
jle    1134 <ReverseNumber+0x34>
xor    %edx,%edx
mov    $0xcccccccd,%r8d
nopl   0x0(%rax)
mov    %edi,%esi
imul   %r8,%rsi
shr    $0x23,%rsi
lea    (%rsi,%rsi,1),%eax
lea    (%rax,%rax,4),%ecx
mov    %edi,%eax
sub    %ecx,%eax
add    %edx,%eax
lea    (%rax,%rax,1),%ecx
lea    (%rcx,%rcx,4),%edx
cmp    $0x9,%edi
mov    %esi,%edi
ja     1110 <ReverseNumber+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ReverseNumber(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %11
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = urem i32 %4, 10
%7 = udiv i32 %4, 10
%8 = add nsw i32 %6, %5
%9 = mul nsw i32 %8, 10
%10 = icmp ult i32 %4, 10
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %12
}
/* Type definitions */
struct Var {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pA(char *, char const *, char const *, char const *);
void __func_mul_ptr(struct Var *avar, const char *areg, const char *lreg,
                    const char *rreg) {
  pA("%s = %s * %s;", areg, lreg, rreg);
}


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

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

LLVM IR (-O0):
%struct.Var = type { i32 }
@.str = [14 x i8] c"%s = %s * %s;\00"
define void @__func_mul_ptr(%struct.Var* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca %struct.Var*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store %struct.Var* %0, %struct.Var** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %6
%10 = load i8*, i8** %7
%11 = load i8*, i8** %8
%12 = call i32 @pA(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10, i8* %11)
ret void
}

LLVM IR (-O2):
%struct.Var = type { i32 }
@.str = [14 x i8] c"%s = %s * %s;\00"
define void @__func_mul_ptr(%struct.Var* nocapture readnone %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 @pA(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2, i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ itoa(int, char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  int n = 3447;
  char s[10];
  itoa(n, s);
  printf("%s\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xd77,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x12(%rbp),%rsi
call   1040 <itoa@plt>
lea    -0x12(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x6(%rsp),%rbx
mov    $0xd77,%edi
mov    %rbx,%rsi
call   1040 <itoa@plt>
lea    0xec2(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @itoa(i32 3447, i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
void aaip_encode_byte(unsigned char *result, size_t *result_fill,
                      unsigned char value) {
  result[(*result_fill / 250) * 255 + 5 + (*result_fill % 250)] = value;
  (*result_fill)++;
}


x86 assembly (clang, -O0):
<aaip_encode_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
mov    %al,-0x12(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    $0xfa,%ecx
xor    %edx,%edx
div    %rcx
imul   $0xff,%rax,%rcx
add    $0x5,%rcx
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    $0xfa,%esi
xor    %edx,%edx
div    %rsi
mov    -0x20(%rbp),%rax
mov    %rdx,%rsi
mov    -0x12(%rbp),%dl
add    %rsi,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<aaip_encode_byte>:
mov    %edx,%r8d
mov    (%rsi),%rcx
mov    %rcx,%rax
shr    %rax
movabs $0x20c49ba5e353f7cf,%rdx
9b c4 20
mul    %rdx
shr    $0x4,%rdx
mov    %rdx,%rax
shl    $0x8,%rax
sub    %rdx,%rax
imul   $0xfa,%rdx,%rdx
sub    %rdx,%rcx
add    %rax,%rcx
mov    %r8b,0x5(%rdi,%rcx,1)
addq   $0x1,(%rsi)
ret

LLVM IR (-O0):
define void @aaip_encode_byte(i8* %0, i64* %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i64*
%6 = alloca i8
store i8* %0, i8** %4
store i64* %1, i64** %5
store i8 %2, i8* %6
%7 = load i8, i8* %6
%8 = load i8*, i8** %4
%9 = load i64*, i64** %5
%10 = load i64, i64* %9
%11 = udiv i64 %10, 250
%12 = mul i64 %11, 255
%13 = add i64 %12, 5
%14 = load i64*, i64** %5
%15 = load i64, i64* %14
%16 = urem i64 %15, 250
%17 = add i64 %13, %16
%18 = getelementptr inbounds i8, i8* %8, i64 %17
store i8 %7, i8* %18
%19 = load i64*, i64** %5
%20 = load i64, i64* %19
%21 = add i64 %20, 1
store i64 %21, i64* %19
ret void
}

LLVM IR (-O2):
define void @aaip_encode_byte(i8* nocapture writeonly %0, i64* nocapture %1, i8 zeroext %2) {
%4 = load i64, i64* %1
%5 = udiv i64 %4, 250
%6 = mul i64 %5, 255
%7 = urem i64 %4, 250
%8 = add nuw nsw i64 %7, 5
%9 = add i64 %8, %6
%10 = getelementptr inbounds i8, i8* %0, i64 %9
store i8 %2, i8* %10
%11 = load i64, i64* %1
%12 = add i64 %11, 1
store i64 %12, i64* %1
ret void
}
int sumo_stop_state() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @sumo_stop_state() {
ret i32 1
}
f(int i, ...) {
  __builtin_va_list l;
  __builtin_va_start(l, 5);
  __builtin_va_start(l, i);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
test   %al,%al
je     1136 <f+0x36>
movaps %xmm0,-0xa0(%rbp)
movaps %xmm1,-0x90(%rbp)
movaps %xmm2,-0x80(%rbp)
movaps %xmm3,-0x70(%rbp)
movaps %xmm4,-0x60(%rbp)
movaps %xmm5,-0x50(%rbp)
movaps %xmm6,-0x40(%rbp)
movaps %xmm7,-0x30(%rbp)
mov    %r9,-0xa8(%rbp)
mov    %r8,-0xb0(%rbp)
mov    %rcx,-0xb8(%rbp)
mov    %rdx,-0xc0(%rbp)
mov    %rsi,-0xc8(%rbp)
mov    %edi,-0x8(%rbp)
lea    -0xd0(%rbp),%rcx
mov    %rcx,-0x10(%rbp)
lea    0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x30,-0x1c(%rbp)
movl   $0x8,-0x20(%rbp)
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
movl   $0x30,-0x1c(%rbp)
movl   $0x8,-0x20(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
sub    $0x48,%rsp
mov    %rsi,-0x78(%rsp)
mov    %rdx,-0x70(%rsp)
mov    %rcx,-0x68(%rsp)
mov    %r8,-0x60(%rsp)
mov    %r9,-0x58(%rsp)
test   %al,%al
je     1148 <f+0x48>
movaps %xmm0,-0x50(%rsp)
movaps %xmm1,-0x40(%rsp)
movaps %xmm2,-0x30(%rsp)
movaps %xmm3,-0x20(%rsp)
movaps %xmm4,-0x10(%rsp)
movaps %xmm5,(%rsp)
movaps %xmm6,0x10(%rsp)
movaps %xmm7,0x20(%rsp)
add    $0x48,%rsp
ret

LLVM IR (-O0):
%struct.__va_list_tag = type { i32, i32, i8*, i8* }
define i32 @f(i32 %0, ...) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1 x %struct.__va_list_tag]
store i32 %0, i32* %3
%5 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %4, i64 0, i64 0
%6 = bitcast %struct.__va_list_tag* %5 to i8*
%7 = getelementptr inbounds [1 x %struct.__va_list_tag], [1 x %struct.__va_list_tag]* %4, i64 0, i64 0
%8 = bitcast %struct.__va_list_tag* %7 to i8*
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
%struct.__va_list_tag = type { i32, i32, i8*, i8* }
define i32 @f(i32 %0, ...) {
%2 = alloca [1 x %struct.__va_list_tag]
%3 = bitcast [1 x %struct.__va_list_tag]* %2 to i8*
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ bool_read(int, int /*<<< orphan*/ *, int);
uint8_t read_uint16_little_endian(int fd, uint16_t *integer) {
  return bool_read(fd, integer, sizeof *integer);
}


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

x86 assembly (clang, -O2):
<read_uint16_little_endian>:
mov    $0x4,%edx
jmp    1030 <bool_read@plt>

LLVM IR (-O0):
define i32 @read_uint16_little_endian(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 @bool_read(i32 %5, i32* %6, i32 4)
ret i32 %7
}

LLVM IR (-O2):
define i32 @read_uint16_little_endian(i32 %0, i32* %1) {
%3 = tail call i32 @bool_read(i32 %0, i32* %1, i32 4)
ret i32 %3
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
scalar_t__ S_ISREG(int /*<<< orphan*/);
int get_file_info(char const *, struct stat *);
int file_exists(const char *path) {
  struct stat pathinfo;
  int rv = get_file_info(path, &pathinfo);
  if (rv < 0) {
    return 0;
  }
  if (S_ISREG(pathinfo.st_mode)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<file_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <get_file_info@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1152 <file_exists+0x32>
movl   $0x0,-0x4(%rbp)
jmp    1177 <file_exists+0x57>
mov    -0x18(%rbp),%edi
call   1030 <S_ISREG@plt>
cmp    $0x0,%rax
je     1170 <file_exists+0x50>
movl   $0x1,-0x4(%rbp)
jmp    1177 <file_exists+0x57>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_exists>:
push   %rax
mov    %rsp,%rsi
call   1040 <get_file_info@plt>
test   %eax,%eax
js     1142 <file_exists+0x22>
mov    (%rsp),%edi
call   1030 <S_ISREG@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @file_exists(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @get_file_info(i8* %0, %struct.stat* %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = call i64 @S_ISREG(i32 %8)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %6, %1
%13 = phi i32 [ 0, %1 ], [ %11, %6 ]
ret i32 %13
}