xunge/DecIR huggingface dataset:
/* Variables and functions */
int institutDef(int /*<<< orphan*/, int /*<<< orphan*/, char *, char *);
int defineInstitute() {
  int instID = -1;
  instID = institutDef(0, 0, "MYINSTITUTE", "myInstitute");
  return instID;
}


x86 assembly (clang, -O0):
<defineInstitute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffffff,-0x4(%rbp)
xor    %esi,%esi
lea    0xed8(%rip),%rdx
lea    0xedd(%rip),%rcx
mov    %esi,%edi
call   1030 <institutDef@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<defineInstitute>:
lea    0xee9(%rip),%rdx
lea    0xeee(%rip),%rcx
xor    %edi,%edi
xor    %esi,%esi
jmp    1030 <institutDef@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"MYINSTITUTE\00"
@.str.1 = [12 x i8] c"myInstitute\00"
define i32 @defineInstitute() {
%1 = alloca i32
store i32 -1, i32* %1
%2 = call i32 @institutDef(i32 0, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [12 x i8] c"MYINSTITUTE\00"
@.str.1 = [12 x i8] c"myInstitute\00"
define i32 @defineInstitute() {
%1 = tail call i32 @institutDef(i32 0, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
ret i32 %1
}
int test_imm_81uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x81 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_81uint64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x10,%rdx
and    $0x81,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_81uint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 129
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_81uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 8454144
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fail(char *, char const *);
int /*<<< orphan*/ *fopen(char const *, char const *);
FILE *efopen(const char *name, const char *mode) {
  FILE *p;
  p = fopen(name, mode);
  if (p == NULL) {
    fail("Unable to open file %s", name);
  }
  return p;
}


x86 assembly (clang, -O0):
<efopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    115c <efopen+0x3c>
mov    -0x8(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1030 <fail@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<efopen>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <efopen+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1030 <fail@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Unable to open file %s\00"
define i32* @efopen(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32* @fopen(i8* %6, i8* %7)
store i32* %8, i32** %5
%9 = load i32*, i32** %5
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = call i32 @fail(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %11, %2
%15 = load i32*, i32** %5
ret i32* %15
}

LLVM IR (-O2):
@.str = [23 x i8] c"Unable to open file %s\00"
define noalias i32* @efopen(i8* %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* %1)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @fail(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %5, %2
ret i32* %3
}
int strcmp(const char *s1, const char *s2) {
  const unsigned char *c1 = (const unsigned char *)s1;
  const unsigned char *c2 = (const unsigned char *)s2;
  unsigned char ch;
  int d = 0;
  while (1) {
    d = (int)(ch = *c1++) - (int)*c2++;
    if (d || !ch)
      break;
  }
  return d;
}


x86 assembly (clang, -O0):
<strcmp>:
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)
movl   $0x0,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%al
mov    %al,-0x21(%rbp)
movzbl %al,%eax
mov    -0x20(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
movzbl (%rcx),%ecx
sub    %ecx,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jne    1165 <strcmp+0x65>
cmpb   $0x0,-0x21(%rbp)
jne    116a <strcmp+0x6a>
jmp    116f <strcmp+0x6f>
jmp    1123 <strcmp+0x23>
mov    -0x28(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdi,%rcx,1),%edx
movzbl (%rsi,%rcx,1),%r8d
mov    %edx,%eax
sub    %r8d,%eax
jne    1128 <strcmp+0x28>
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcmp+0x10>
ret

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

LLVM IR (-O2):
define i32 @strcmp(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %9, %3 ]
%5 = phi i8* [ %0, %2 ], [ %6, %3 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
%8 = zext i8 %7 to i32
%9 = getelementptr inbounds i8, i8* %4, i64 1
%10 = load i8, i8* %4
%11 = zext i8 %10 to i32
%12 = sub nsw i32 %8, %11
%13 = icmp eq i32 %12, 0
%14 = icmp ne i8 %7, 0
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %3, label %16
16: ; preds = %3
ret i32 %12
}
int flag_delim(char c) {
  if (c == '\n' || c == ' ' || c == '\t' || c == '\0')
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<flag_delim>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     113e <flag_delim+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
je     113e <flag_delim+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
je     113e <flag_delim+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x0,%eax
jne    114a <flag_delim+0x4a>
movl   $0x1,-0x4(%rbp)
jmp    1151 <flag_delim+0x51>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @flag_delim(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %3
i8 10, label %3
i8 9, label %3
i8 0, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
unsigned int isHex(char ch) {
  return (((ch >= '0') && (ch <= '9')) || ((ch >= 'A') && (ch <= 'F'))) ||
         ((ch >= 'a') && (ch <= 'f'));
  __builtin_unreachable();
}


x86 assembly (clang, -O0):
<isHex>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     1129 <isHex+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x39,%ecx
mov    %al,-0x2(%rbp)
jle    116d <isHex+0x6d>
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1148 <isHex+0x48>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x46,%ecx
mov    %al,-0x2(%rbp)
jle    116d <isHex+0x6d>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x61,%ecx
mov    %al,-0x3(%rbp)
jl     1167 <isHex+0x67>
movsbl -0x1(%rbp),%eax
cmp    $0x66,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isHex>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
setb   %al
and    $0xdf,%dil
add    $0xbf,%dil
cmp    $0x6,%dil
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isHex(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, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br i1 %9, label %28, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 65
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 70
br i1 %17, label %28, label %18
18: ; preds = %14, %10
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp sge i32 %20, 97
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp sle i32 %24, 102
br label %26
26: ; preds = %22, %18
%27 = phi i1 [ false, %18 ], [ %25, %22 ]
br label %28
28: ; preds = %26, %14, %6
%29 = phi i1 [ true, %14 ], [ true, %6 ], [ %27, %26 ]
%30 = zext i1 %29 to i32
ret i32 %30
}

LLVM IR (-O2):
define i32 @isHex(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = and i8 %0, -33
%5 = add i8 %4, -65
%6 = icmp ult i8 %5, 6
%7 = or i1 %3, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main() {
  int a, b, c, ppc;
  scanf("%d%d%d", &a, &b, &c);
  ppc = 2 * (a * b) + 2 * (a * c) + 2 * (b * c);
  printf("%d", ppc);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
shl    $0x1,%eax
mov    -0x4(%rbp),%ecx
imul   -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%ecx
imul   -0xc(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1040 <scanf@plt>
mov    0x10(%rsp),%eax
mov    0xc(%rsp),%esi
lea    (%rsi,%rax,1),%ecx
imul   0x14(%rsp),%ecx
imul   %eax,%esi
add    %ecx,%esi
add    %esi,%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d%d%d\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = mul nsw i32 %6, %7
%9 = mul nsw i32 2, %8
%10 = load i32, i32* %1
%11 = load i32, i32* %3
%12 = mul nsw i32 %10, %11
%13 = mul nsw i32 2, %12
%14 = add nsw i32 %9, %13
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = mul nsw i32 %15, %16
%18 = mul nsw i32 2, %17
%19 = add nsw i32 %14, %18
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d%d%d\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%8 = load i32, i32* %1
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = add i32 %10, %9
%12 = mul i32 %11, %8
%13 = mul nsw i32 %10, %9
%14 = add i32 %12, %13
%15 = shl i32 %14, 1
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %15)
ret i32 0
}
long decimal_to_binary(long n) {
  long binary = 0;
  long i = 1;
  while (n != 0) {
    int remainder = n % 2;
    n = n / 2;
    binary = binary + (remainder * i);
    i = i * 10;
  }
  return binary;
}


x86 assembly (clang, -O0):
<decimal_to_binary>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116a <decimal_to_binary+0x6a>
mov    -0x8(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   -0x18(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
imul   $0xa,-0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1118 <decimal_to_binary+0x18>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decimal_to_binary>:
test   %rdi,%rdi
je     1146 <decimal_to_binary+0x46>
mov    $0x1,%ecx
xor    %eax,%eax
nopl   0x0(%rax)
mov    %rdi,%rdx
shr    $0x3f,%rdx
add    %rdi,%rdx
mov    %rdx,%r8
sar    %r8
and    $0xfffffffffffffffe,%rdx
mov    %rdi,%rsi
sub    %rdx,%rsi
imul   %rcx,%rsi
add    %rsi,%rax
add    %rcx,%rcx
lea    (%rcx,%rcx,4),%rcx
add    $0x1,%rdi
cmp    $0x2,%rdi
mov    %r8,%rdi
ja     1110 <decimal_to_binary+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @decimal_to_binary(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %14, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ %0, %1 ]
%5 = phi i64 [ %11, %3 ], [ 1, %1 ]
%6 = phi i64 [ %10, %3 ], [ 0, %1 ]
%7 = srem i64 %4, 2
%8 = sdiv i64 %4, 2
%9 = mul nsw i64 %7, %5
%10 = add nsw i64 %9, %6
%11 = mul nsw i64 %5, 10
%12 = add i64 %4, 1
%13 = icmp ult i64 %12, 3
br i1 %13, label %14, label %3
14: ; preds = %3, %1
%15 = phi i64 [ 0, %1 ], [ %10, %3 ]
ret i64 %15
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ test_case();
int main() {
  int test_cases;
  scanf("%d", &test_cases);
  while (test_cases--)
    test_case();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     115f <main+0x3f>
mov    $0x0,%al
call   1030 <test_case@plt>
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
subl   $0x1,0x4(%rsp)
jb     114e <main+0x2e>
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <test_case@plt>
subl   $0x1,0x4(%rsp)
jae    1140 <main+0x20>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\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)
br label %4
4: ; preds = %8, %0
%5 = load i32, i32* %2
%6 = add nsw i32 %5, -1
store i32 %6, i32* %2
%7 = icmp ne i32 %5, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = call i32 (...) @test_case()
br label %4
10: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\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 = add nsw i32 %4, -1
store i32 %5, i32* %1
%6 = icmp eq i32 %4, 0
br i1 %6, label %12, label %7
7: ; preds = %0, %7
%8 = call i32 (...) @test_case()
%9 = load i32, i32* %1
%10 = add nsw i32 %9, -1
store i32 %10, i32* %1
%11 = icmp eq i32 %9, 0
br i1 %11, label %12, label %7
12: ; preds = %7, %0
ret i32 0
}
unsigned long read_cr4(void) {
  unsigned long cr4;
  asm volatile("movq %%cr4,%0" : "=r"(cr4));
  return cr4;
}


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

x86 assembly (clang, -O2):
<read_cr4>:
mov    %cr4,%rax
ret

LLVM IR (-O0):
define i64 @read_cr4() {
%1 = alloca i64
%2 = call i64 asm sideeffect "movq %cr4,$0", "=r,~{dirflag},~{fpsr},~{flags}"()
store i64 %2, i64* %1
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @read_cr4() {
%1 = tail call i64 asm sideeffect "movq %cr4,$0", "=r,~{dirflag},~{fpsr},~{flags}"()
ret i64 %1
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char const *);
scalar_t__ strlen(char *);
void join(char *to, const char *from, const char *delim) {
  if (strlen(to) > 0)
    strcat(to, delim);
  strcat(to, from);
}


x86 assembly (clang, -O0):
<join>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jle    1154 <join+0x34>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcat@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<join>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %rax,%rax
jle    1143 <join+0x23>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <strcat@plt>

LLVM IR (-O0):
define void @join(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = call i64 @strlen(i8* %7)
%9 = icmp sgt i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = load i8*, i8** %6
%13 = call i32 @strcat(i8* %11, i8* %12)
br label %14
14: ; preds = %10, %3
%15 = load i8*, i8** %4
%16 = load i8*, i8** %5
%17 = call i32 @strcat(i8* %15, i8* %16)
ret void
}

LLVM IR (-O2):
define void @join(i8* %0, i8* %1, i8* %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = icmp sgt i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @strcat(i8* %0, i8* %2)
br label %8
8: ; preds = %6, %3
%9 = tail call i32 @strcat(i8* %0, i8* %1)
ret void
}
/* Type definitions */
typedef void a_struct;

/* Variables and functions */
scalar_t__ malloc(int);
void *make_a_struct(int num, size_t size) {
  return (struct a_struct *)malloc(num * size + 1);
}


x86 assembly (clang, -O0):
<make_a_struct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movslq -0x4(%rbp),%rax
imul   -0x10(%rbp),%rax
add    $0x1,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_a_struct>:
imul   %esi,%edi
add    $0x1,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
%struct.a_struct = type opaque
define i8* @make_a_struct(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%5 = load i32, i32* %3
%6 = sext i32 %5 to i64
%7 = load i64, i64* %4
%8 = mul i64 %6, %7
%9 = add i64 %8, 1
%10 = trunc i64 %9 to i32
%11 = call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to %struct.a_struct*
%13 = bitcast %struct.a_struct* %12 to i8*
ret i8* %13
}

LLVM IR (-O2):
define i8* @make_a_struct(i32 %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = mul i32 %3, %0
%5 = add i32 %4, 1
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i8*
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() { printf("usage: m2x00w-decode <file.prn> <outfile.pbm>\n"); }


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

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

LLVM IR (-O0):
@.str = [47 x i8] c"usage: m2x00w-decode <file.prn> <outfile.pbm>\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [46 x i8] c"usage: m2x00w-decode <file.prn> <outfile.pbm>\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
ret void
}
int main(void) {
  int a[5];
  int i;
  for (i = 0; i < 5; i++)
    a[i] = 0;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    1136 <main+0x36>
movslq -0x24(%rbp),%rax
movl   $0x0,-0x20(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1112 <main+0x12>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 5
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %9
store i32 0, i32* %10
br label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ test_piece_quoted_string();
int main() {
  test_piece_quoted_string();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <test_piece_quoted_string@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_piece_quoted_string@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_piece_quoted_string()
ret i32 0
}
int a_dither(int x, int y) { return ((x ^ y * 237) * 181 & 511) / 2.00; }


x86 assembly (clang, -O0):
<a_dither>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   $0xed,-0x8(%rbp),%ecx
xor    %ecx,%eax
imul   $0xb5,%eax,%eax
and    $0x1ff,%eax
cvtsi2sd %eax,%xmm0
movsd  0xed3(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_dither>:
imul   $0xed,%esi,%eax
xor    %edi,%eax
imul   $0xb5,%eax,%eax
and    $0x1ff,%eax
cvtsi2sd %eax,%xmm0
mulsd  0xee1(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @a_dither(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 = mul nsw i32 %6, 237
%8 = xor i32 %5, %7
%9 = mul nsw i32 %8, 181
%10 = and i32 %9, 511
%11 = sitofp i32 %10 to double
%12 = fdiv double %11, 2.000000e+00
%13 = fptosi double %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @a_dither(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, 237
%4 = xor i32 %3, %0
%5 = mul nsw i32 %4, 181
%6 = and i32 %5, 511
%7 = sitofp i32 %6 to double
%8 = fmul double %7, 5.000000e-01
%9 = fptosi double %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_vector_double(double *v, long nl, long nh) {
  free((char *)(v + nl - 1));
}


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

x86 assembly (clang, -O2):
<free_vector_double>:
lea    (%rdi,%rsi,8),%rdi
add    $0xfffffffffffffff8,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_vector_double(double* %0, i64 %1, i64 %2) {
%4 = alloca double*
%5 = alloca i64
%6 = alloca i64
store double* %0, double** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load double*, double** %4
%8 = load i64, i64* %5
%9 = getelementptr inbounds double, double* %7, i64 %8
%10 = getelementptr inbounds double, double* %9, i64 -1
%11 = bitcast double* %10 to i8*
%12 = call i32 @free(i8* %11)
ret void
}

LLVM IR (-O2):
define void @free_vector_double(double* nocapture %0, i64 %1, i64 %2) {
%4 = getelementptr inbounds double, double* %0, i64 %1
%5 = getelementptr inbounds double, double* %4, i64 -1
%6 = bitcast double* %5 to i8*
%7 = tail call i32 @free(i8* %6)
ret void
}
void mus_bfloat_to_char(unsigned char *j, float x) {
  unsigned char *ox;
  ox = (unsigned char *)&x;
  j[0] = ox[0];
  j[1] = ox[1];
  j[2] = ox[2];
  j[3] = ox[3];
}


x86 assembly (clang, -O0):
<mus_bfloat_to_char>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x18(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x18(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mus_bfloat_to_char>:
movss  %xmm0,(%rdi)
ret

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

LLVM IR (-O2):
define void @mus_bfloat_to_char(i8* nocapture writeonly %0, float %1) {
%3 = bitcast float %1 to i32
%4 = trunc i32 %3 to i8
store i8 %4, i8* %0
%5 = lshr i32 %3, 8
%6 = trunc i32 %5 to i8
%7 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %6, i8* %7
%8 = lshr i32 %3, 16
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %9, i8* %10
%11 = lshr i32 %3, 24
%12 = trunc i32 %11 to i8
%13 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %12, i8* %13
ret void
}
long long modexpo(long long a, long long b, long long n) {
  long long d = 1;
  while (b) {
    if (b % 2)
      d = (d * a) % n;
    b >>= 1;
    a = (a * a) % n;
  }
  return d;
}


x86 assembly (clang, -O0):
<modexpo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x1,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1172 <modexpo+0x72>
mov    -0x10(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
cmp    $0x0,%rdx
je     114e <modexpo+0x4e>
mov    -0x20(%rbp),%rax
imul   -0x8(%rbp),%rax
cqto
idivq  -0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
sar    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x8(%rbp),%rax
cqto
idivq  -0x18(%rbp)
mov    %rdx,-0x8(%rbp)
jmp    1118 <modexpo+0x18>
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<modexpo>:
mov    $0x1,%r8d
test   %rsi,%rsi
je     117a <modexpo+0x7a>
mov    %rdx,%rcx
jmp    1145 <modexpo+0x45>
mov    %r8,%rax
cqto
idiv   %rcx
mov    %rdx,%r8
imul   %rdi,%rdi
mov    %rdi,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     1170 <modexpo+0x70>
mov    %rdi,%rax
cqto
idiv   %rcx
mov    %rdx,%rdi
mov    %rsi,%rax
sar    %rax
cmp    $0x1,%rsi
mov    %rax,%rsi
jbe    117a <modexpo+0x7a>
test   $0x1,%sil
je     111b <modexpo+0x1b>
imul   %rdi,%r8
mov    %r8,%rax
or     %rcx,%rax
shr    $0x20,%rax
jne    1110 <modexpo+0x10>
mov    %r8d,%eax
xor    %edx,%edx
div    %ecx
mov    %edx,%r8d
jmp    111b <modexpo+0x1b>
nopw   0x0(%rax,%rax,1)
mov    %edi,%eax
xor    %edx,%edx
div    %ecx
mov    %edx,%edi
jmp    1136 <modexpo+0x36>
mov    %r8,%rax
ret

LLVM IR (-O0):
define i64 @modexpo(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
store i64 1, i64* %7
br label %8
8: ; preds = %21, %3
%9 = load i64, i64* %5
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %29
11: ; preds = %8
%12 = load i64, i64* %5
%13 = srem i64 %12, 2
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %11
%16 = load i64, i64* %7
%17 = load i64, i64* %4
%18 = mul nsw i64 %16, %17
%19 = load i64, i64* %6
%20 = srem i64 %18, %19
store i64 %20, i64* %7
br label %21
21: ; preds = %15, %11
%22 = load i64, i64* %5
%23 = ashr i64 %22, 1
store i64 %23, i64* %5
%24 = load i64, i64* %4
%25 = load i64, i64* %4
%26 = mul nsw i64 %24, %25
%27 = load i64, i64* %6
%28 = srem i64 %26, %27
store i64 %28, i64* %4
br label %8
29: ; preds = %8
%30 = load i64, i64* %7
ret i64 %30
}

LLVM IR (-O2):
define i64 @modexpo(i64 %0, i64 %1, i64 %2) {
%4 = icmp eq i64 %1, 0
br i1 %4, label %20, label %5
5: ; preds = %3, %14
%6 = phi i64 [ %15, %14 ], [ 1, %3 ]
%7 = phi i64 [ %18, %14 ], [ %0, %3 ]
%8 = phi i64 [ %16, %14 ], [ %1, %3 ]
%9 = and i64 %8, 1
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %5
%12 = mul nsw i64 %6, %7
%13 = srem i64 %12, %2
br label %14
14: ; preds = %11, %5
%15 = phi i64 [ %13, %11 ], [ %6, %5 ]
%16 = ashr i64 %8, 1
%17 = mul nsw i64 %7, %7
%18 = srem i64 %17, %2
%19 = icmp ult i64 %8, 2
br i1 %19, label %20, label %5
20: ; preds = %14, %3
%21 = phi i64 [ 1, %3 ], [ %15, %14 ]
ret i64 %21
}
/* Variables and functions */
scalar_t__ ProcessField();
int main() {
  while (ProcessField()) {
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <ProcessField@plt>
cmp    $0x0,%rax
je     1135 <main+0x25>
jmp    111f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <ProcessField@plt>
test   %rax,%rax
jne    1120 <main+0x10>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %5, %0
%3 = call i64 (...) @ProcessField()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %2
br label %2
6: ; preds = %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i64 (...) @ProcessField()
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %1
4: ; preds = %1
ret i32 0
}
/* Variables and functions */
unsigned char VIM_HIF_GetReg8(int);
unsigned short VIM_JPEG_GetFrameCount(void) {
  unsigned char byByteLow = 0;
  unsigned char byByteHigh = 0;
  byByteLow = VIM_HIF_GetReg8((0x0000 + 0x01A));
  byByteHigh = VIM_HIF_GetReg8((0x0000 + 0x01B));
  return ((unsigned short)byByteHigh << 8) | (unsigned short)byByteLow;
}


x86 assembly (clang, -O0):
<VIM_JPEG_GetFrameCount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x0,-0x1(%rbp)
movb   $0x0,-0x2(%rbp)
mov    $0x1a,%edi
call   1030 <VIM_HIF_GetReg8@plt>
mov    %al,-0x1(%rbp)
mov    $0x1b,%edi
call   1030 <VIM_HIF_GetReg8@plt>
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
movzwl %ax,%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
movzwl %cx,%ecx
or     %ecx,%eax
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VIM_JPEG_GetFrameCount>:
push   %rbx
mov    $0x1a,%edi
call   1030 <VIM_HIF_GetReg8@plt>
mov    %eax,%ebx
mov    $0x1b,%edi
call   1030 <VIM_HIF_GetReg8@plt>
movzbl %al,%ecx
shl    $0x8,%ecx
movzbl %bl,%eax
or     %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i16 @VIM_JPEG_GetFrameCount() {
%1 = alloca i8
%2 = alloca i8
store i8 0, i8* %1
store i8 0, i8* %2
%3 = call zeroext i8 @VIM_HIF_GetReg8(i32 26)
store i8 %3, i8* %1
%4 = call zeroext i8 @VIM_HIF_GetReg8(i32 27)
store i8 %4, i8* %2
%5 = load i8, i8* %2
%6 = zext i8 %5 to i16
%7 = zext i16 %6 to i32
%8 = shl i32 %7, 8
%9 = load i8, i8* %1
%10 = zext i8 %9 to i16
%11 = zext i16 %10 to i32
%12 = or i32 %8, %11
%13 = trunc i32 %12 to i16
ret i16 %13
}

LLVM IR (-O2):
define zeroext i16 @VIM_JPEG_GetFrameCount() {
%1 = tail call zeroext i8 @VIM_HIF_GetReg8(i32 26)
%2 = tail call zeroext i8 @VIM_HIF_GetReg8(i32 27)
%3 = zext i8 %2 to i16
%4 = shl nuw i16 %3, 8
%5 = zext i8 %1 to i16
%6 = or i16 %4, %5
ret i16 %6
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t E(int num) { return (num & 0x1) << 1; }


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

x86 assembly (clang, -O2):
<E>:
lea    (%rdi,%rdi,1),%eax
and    $0x2,%eax
ret

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

LLVM IR (-O2):
define i32 @E(i32 %0) {
%2 = shl i32 %0, 1
%3 = and i32 %2, 2
ret i32 %3
}
int parse_input_file(char *str) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @parse_input_file(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ gethostname(char *, int);
int /*<<< orphan*/ puts(char *);
int main() {
  char hostname[255];
  gethostname(hostname, 255);
  puts(hostname);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    -0x100(%rbp),%rdi
mov    $0xff,%esi
call   1040 <gethostname@plt>
lea    -0x100(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x100,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xff,%esi
call   1040 <gethostname@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%3 = call i32 @gethostname(i8* %2, i32 255)
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%5 = call i32 @puts(i8* %4)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%3 = call i32 @gethostname(i8* %2, i32 255)
%4 = call i32 @puts(i8* %2)
ret i32 0
}
/* Type definitions */
struct ptr_list {
  int dummy;
};
struct basic_block_list {
  int dummy;
};
struct basic_block {
  int dummy;
};

/* Variables and functions */
struct basic_block *first_ptr_list(struct ptr_list *);
struct basic_block *first_basic_block(struct basic_block_list *head) {
  return first_ptr_list((struct ptr_list *)head);
}


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

x86 assembly (clang, -O2):
<first_basic_block>:
jmp    1030 <first_ptr_list@plt>

LLVM IR (-O0):
%struct.basic_block = type { i32 }
%struct.basic_block_list = type { i32 }
%struct.ptr_list = type { i32 }
define %struct.basic_block* @first_basic_block(%struct.basic_block_list* %0) {
%2 = alloca %struct.basic_block_list*
store %struct.basic_block_list* %0, %struct.basic_block_list** %2
%3 = load %struct.basic_block_list*, %struct.basic_block_list** %2
%4 = bitcast %struct.basic_block_list* %3 to %struct.ptr_list*
%5 = call %struct.basic_block* @first_ptr_list(%struct.ptr_list* %4)
ret %struct.basic_block* %5
}

LLVM IR (-O2):
%struct.basic_block = type { i32 }
%struct.basic_block_list = type { i32 }
%struct.ptr_list = type { i32 }
define %struct.basic_block* @first_basic_block(%struct.basic_block_list* %0) {
%2 = bitcast %struct.basic_block_list* %0 to %struct.ptr_list*
%3 = tail call %struct.basic_block* @first_ptr_list(%struct.ptr_list* %2)
ret %struct.basic_block* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_charstring(char *a) {
  char *pos = a;
  while (*pos != '\0') {
    printf("%c", *(pos++));
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_charstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1159 <print_charstring+0x49>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%esi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1124 <print_charstring+0x14>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_charstring>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <print_charstring+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <print_charstring+0x10>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @print_charstring(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = sext i8 %5 to i32
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = tail call i32 @putchar(i32 %7)
%10 = load i8, i8* %8
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
%13 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
void createTypedefForUintFast32_t(void) {
  if (sizeof(unsigned int) == 4)
    printf("typedef unsigned int uint_fast32_t;\n");
  else if (sizeof(unsigned long) == 4)
    printf("typedef unsigned long uint_fast32_t;\n");
  else {
    fprintf(stderr, "Cannot find a 32 bit unsigned integer type!\n");
    exit(1);
  }
}


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

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

LLVM IR (-O0):
@.str = [37 x i8] c"typedef unsigned int uint_fast32_t;\0A\00"
@stderr = global i32 0
define void @createTypedefForUintFast32_t() {
%1 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@str = [36 x i8] c"typedef unsigned int uint_fast32_t;\00"
define void @createTypedefForUintFast32_t() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
ret void
}
int toBCD(int a) { return (((a % 100) / 10) << 4) | (a % 10); }


x86 assembly (clang, -O0):
<toBCD>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
shl    $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%eax
or     %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toBCD>:
movslq %edi,%rax
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
mov    %eax,%edx
sub    %ecx,%edx
movsbl %dl,%ecx
imul   $0x67,%ecx,%ecx
movzwl %cx,%ecx
movswl %cx,%edx
shr    $0xf,%ecx
shr    $0xa,%edx
add    %cl,%dl
movsbl %dl,%ecx
shl    $0x4,%ecx
imul   $0x66666667,%rax,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rdx
add    %esi,%edx
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @toBCD(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 100
%5 = sdiv i32 %4, 10
%6 = shl i32 %5, 4
%7 = load i32, i32* %2
%8 = srem i32 %7, 10
%9 = or i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @toBCD(i32 %0) {
%2 = srem i32 %0, 100
%3 = trunc i32 %2 to i8
%4 = sdiv i8 %3, 10
%5 = sext i8 %4 to i32
%6 = shl nsw i32 %5, 4
%7 = srem i32 %0, 10
%8 = or i32 %6, %7
ret i32 %8
}
void gencache() {}


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

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

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

LLVM IR (-O2):
define void @gencache() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void null(void) { printf("Hello, world!  This is null()\r\n"); }


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"Hello, world! This is null()\0D\0A\00"
define void @null() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [31 x i8] c"Hello, world! This is null()\0D\00"
define void @null() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void WatchdogStallEnable(uint32_t ui32Base) {
  ASSERT((ui32Base == 0x40000000) || (ui32Base == 0x40001000));
  (*((volatile uint32_t *)(ui32Base + 0x00000418))) |= 0x00000100;
}


x86 assembly (clang, -O0):
<WatchdogStallEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x40000000,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     113a <WatchdogStallEnable+0x2a>
cmpl   $0x40001000,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x418,%eax
cltq
mov    (%rax),%ecx
or     $0x100,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WatchdogStallEnable>:
push   %rbx
mov    %edi,%ebx
mov    %edi,%eax
and    $0xffffefff,%eax
xor    %edi,%edi
cmp    $0x40000000,%eax
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rax
orl    $0x100,0x418(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define void @WatchdogStallEnable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1073741824
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 1073745920
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ true, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
%11 = call i32 @ASSERT(i32 %10)
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1048
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
%16 = load volatile i32, i32* %15
%17 = or i32 %16, 256
store volatile i32 %17, i32* %15
ret void
}

LLVM IR (-O2):
define void @WatchdogStallEnable(i32 %0) {
%2 = and i32 %0, -4097
%3 = icmp eq i32 %2, 1073741824
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = add nsw i32 %0, 1048
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = or i32 %9, 256
store volatile i32 %10, i32* %8
ret void
}