xunge/DecIR huggingface dataset:
/* Variables and functions */
int *malloc(int);
int main() {
  int *p, *q, *r;
  int havoc;
  p = malloc(sizeof(int));
  r = malloc(sizeof(int));
  if (havoc) {
    q = (int *)&r;
  } else {
    q = malloc(sizeof(int));
  }
  *q = (int)&havoc;
  q = p - q;
  while (havoc) {
    q = q - r;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1152 <main+0x42>
lea    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1160 <main+0x50>
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
lea    -0x24(%rbp),%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     11a1 <main+0x91>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
mov    %rax,-0x18(%rbp)
jmp    117f <main+0x6f>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    $0x4,%edi
call   1030 <malloc@plt>
cs nopw 0x0(%rax,%rax,1)
nop
jmp    1130 <main+0x20>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32* @malloc(i32 4)
store i32* %6, i32** %2
%7 = call i32* @malloc(i32 4)
store i32* %7, i32** %4
%8 = load i32, i32* %5
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = bitcast i32** %4 to i32*
store i32* %11, i32** %3
br label %14
12: ; preds = %0
%13 = call i32* @malloc(i32 4)
store i32* %13, i32** %3
br label %14
14: ; preds = %12, %10
%15 = ptrtoint i32* %5 to i32
%16 = load i32*, i32** %3
store i32 %15, i32* %16
%17 = load i32*, i32** %2
%18 = load i32*, i32** %3
%19 = ptrtoint i32* %17 to i64
%20 = ptrtoint i32* %18 to i64
%21 = sub i64 %19, %20
%22 = sdiv exact i64 %21, 4
%23 = inttoptr i64 %22 to i32*
store i32* %23, i32** %3
br label %24
24: ; preds = %27, %14
%25 = load i32, i32* %5
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %35
27: ; preds = %24
%28 = load i32*, i32** %3
%29 = load i32*, i32** %4
%30 = ptrtoint i32* %28 to i64
%31 = ptrtoint i32* %29 to i64
%32 = sub i64 %30, %31
%33 = sdiv exact i64 %32, 4
%34 = inttoptr i64 %33 to i32*
store i32* %34, i32** %3
br label %24
35: ; preds = %24
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 4)
%2 = tail call i32* @malloc(i32 4)
br label %3
3: ; preds = %3, %0
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ permute(char *, int /*<<< orphan*/, int);
int strlen(char *);
int main() {
  int n;
  char str[] = "ABC";
  n = strlen(str);
  permute(str, 0, n - 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
mov    -0x8(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <permute@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x434241,0xc(%rsp)
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    -0x1(%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <permute@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [4 x i8] c"ABC\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [4 x i8]
store i32 0, i32* %1
%4 = bitcast [4 x i8]* %3 to i8*
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %2
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 1
%10 = call i32 @permute(i8* %7, i32 0, i32 %9)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 4407873, i32* %1
%3 = call i32 @strlen(i8* %2)
%4 = add nsw i32 %3, -1
%5 = call i32 @permute(i8* %2, i32 0, i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ isspace(char);
char *skip_darkspace(char *s) {
  while ((*s != 0) && (!isspace(*s)))
    s++;
  return s;
}


x86 assembly (clang, -O0):
<skip_darkspace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1148 <skip_darkspace+0x38>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1158 <skip_darkspace+0x48>
jmp    1169 <skip_darkspace+0x59>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <skip_darkspace+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_darkspace>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1138 <skip_darkspace+0x28>
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isspace@plt>
test   %eax,%eax
jne    1138 <skip_darkspace+0x28>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <skip_darkspace+0x10>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @skip_darkspace(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %16, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = call i32 @isspace(i8 signext %10)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
br label %14
14: ; preds = %8, %3
%15 = phi i1 [ false, %3 ], [ %13, %8 ]
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %2
br label %3
19: ; preds = %14
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
define i8* @skip_darkspace(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %9
%5 = phi i8 [ %11, %9 ], [ %2, %1 ]
%6 = phi i8* [ %10, %9 ], [ %0, %1 ]
%7 = tail call i32 @isspace(i8 signext %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %9, %1
%14 = phi i8* [ %0, %1 ], [ %10, %9 ], [ %6, %4 ]
ret i8* %14
}
/* Type definitions */
typedef int /*<<< orphan*/ __m256i;
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm256_castsi128_si256(int /*<<< orphan*/);
int /*<<< orphan*/ _mm256_inserti128_si256(int /*<<< orphan*/ const,
                                           int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_loadu_si128(int /*<<< orphan*/ const *);
__m256i mm256_loadu2_si128(const void *lo, const void *hi) {
  const __m256i tmp =
      _mm256_castsi128_si256(_mm_loadu_si128((const __m128i *)lo));
  return _mm256_inserti128_si256(tmp, _mm_loadu_si128((const __m128i *)hi), 1);
}


x86 assembly (clang, -O0):
<mm256_loadu2_si128>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <_mm_loadu_si128@plt>
mov    %eax,%edi
call   1040 <_mm256_castsi128_si256@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <_mm_loadu_si128@plt>
mov    -0x18(%rbp),%edi
mov    %eax,%esi
mov    $0x1,%edx
call   1030 <_mm256_inserti128_si256@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mm256_loadu2_si128>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1050 <_mm_loadu_si128@plt>
mov    %eax,%edi
call   1040 <_mm256_castsi128_si256@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <_mm_loadu_si128@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    $0x1,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <_mm256_inserti128_si256@plt>

LLVM IR (-O0):
define i32 @mm256_loadu2_si128(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 = bitcast i8* %6 to i32*
%8 = call i32 @_mm_loadu_si128(i32* %7)
%9 = call i32 @_mm256_castsi128_si256(i32 %8)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = load i8*, i8** %4
%12 = bitcast i8* %11 to i32*
%13 = call i32 @_mm_loadu_si128(i32* %12)
%14 = call i32 @_mm256_inserti128_si256(i32 %10, i32 %13, i32 1)
ret i32 %14
}

LLVM IR (-O2):
define i32 @mm256_loadu2_si128(i8* %0, i8* %1) {
%3 = bitcast i8* %0 to i32*
%4 = tail call i32 @_mm_loadu_si128(i32* %3)
%5 = tail call i32 @_mm256_castsi128_si256(i32 %4)
%6 = bitcast i8* %1 to i32*
%7 = tail call i32 @_mm_loadu_si128(i32* %6)
%8 = tail call i32 @_mm256_inserti128_si256(i32 %5, i32 %7, i32 1)
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ wint_t;
typedef int /*<<< orphan*/ wchar_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputwc(int /*<<< orphan*/, int /*<<< orphan*/ *);
wint_t putwc(wchar_t wc, FILE *fp) { return fputwc(wc, fp); }


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

x86 assembly (clang, -O2):
<putwc>:
jmp    1030 <fputwc@plt>

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

LLVM IR (-O2):
define i32 @putwc(i32 %0, i32* %1) {
%3 = tail call i32 @fputwc(i32 %0, i32* %1)
ret i32 %3
}
int maxx(int a, int b) {
  if (b > a)
    return b;
  return a;
}


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

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

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

LLVM IR (-O2):
define i32 @maxx(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, %0
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
void fucked_swap(int a, int b) {
  printf("swap received %d (%p) %d (%p)\n", a, &a, b, &b);
  int temp = b;
  b = a;
  a = temp;
  printf("i have swapped %d %d\n", a, b);
}


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

x86 assembly (clang, -O2):
<fucked_swap>:
push   %rax
mov    %esi,%ecx
mov    %edi,%esi
mov    %edi,0x4(%rsp)
mov    %ecx,(%rsp)
lea    0xedd(%rip),%rdi
lea    0x4(%rsp),%rdx
mov    %rsp,%r8
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%edx
mov    %edx,(%rsp)
mov    %esi,0x4(%rsp)
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [31 x i8] c"swap received %d (%p) %d (%p)\0A\00"
@.str.1 = [22 x i8] c"i have swapped %d %d\0A\00"
define void @fucked_swap(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %6, i32* %3, i32 %7, i32* %4)
%9 = load i32, i32* %4
store i32 %9, i32* %5
%10 = load i32, i32* %3
store i32 %10, i32* %4
%11 = load i32, i32* %5
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %13)
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"swap received %d (%p) %d (%p)\0A\00"
@.str.1 = [22 x i8] c"i have swapped %d %d\0A\00"
define void @fucked_swap(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %0, i32* %3, i32 %1, i32* %4)
%6 = load i32, i32* %4
%7 = load i32, i32* %3
store i32 %7, i32* %4
store i32 %6, i32* %3
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %7)
ret void
}
unsigned short foo(unsigned short x) {
  unsigned char i = 0;
  for (i = 0; i < 8; i++) {
    x <<= 1;
    x &= 0x7fff;
  }
  return x;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movb   $0x0,-0x3(%rbp)
movb   $0x0,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
cmp    $0x8,%eax
jge    1145 <foo+0x45>
movzwl -0x2(%rbp),%eax
shl    $0x1,%eax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
and    $0x7fff,%eax
mov    %ax,-0x2(%rbp)
mov    -0x3(%rbp),%al
add    $0x1,%al
mov    %al,-0x3(%rbp)
jmp    1113 <foo+0x13>
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i16 @foo(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i8
store i16 %0, i16* %2
store i8 0, i8* %3
store i8 0, i8* %3
br label %4
4: ; preds = %17, %1
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = icmp slt i32 %6, 8
br i1 %7, label %8, label %20
8: ; preds = %4
%9 = load i16, i16* %2
%10 = zext i16 %9 to i32
%11 = shl i32 %10, 1
%12 = trunc i32 %11 to i16
store i16 %12, i16* %2
%13 = load i16, i16* %2
%14 = zext i16 %13 to i32
%15 = and i32 %14, 32767
%16 = trunc i32 %15 to i16
store i16 %16, i16* %2
br label %17
17: ; preds = %8
%18 = load i8, i8* %3
%19 = add i8 %18, 1
store i8 %19, i8* %3
br label %4
20: ; preds = %4
%21 = load i16, i16* %2
ret i16 %21
}

LLVM IR (-O2):
define zeroext i16 @foo(i16 zeroext %0) {
%2 = shl i16 %0, 8
%3 = and i16 %2, 32512
ret i16 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ usagex();
void errdie(char *s) {
  printf("ERROR: %s\n", s);
  usagex();
}


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

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"ERROR: %s\0A\00"
define void @errdie(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (...) @usagex()
ret void
}
void C_HEAT_Init(void) {}


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

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

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

LLVM IR (-O2):
define void @C_HEAT_Init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ terminal_initialize();
void kernel_early(void) { terminal_initialize(); }


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

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

LLVM IR (-O0):
define void @kernel_early() {
%1 = call i32 (...) @terminal_initialize()
ret void
}

LLVM IR (-O2):
define void @kernel_early() {
%1 = tail call i32 (...) @terminal_initialize()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void prompt(void) {
  printf("*************************************************************\n"
         "The Read Line Program\n"
         "*************************************************************\n"
         "The (command)?> display takes only one argument. All subsequent\n"
         "arguments follow suit. You may use a letter, or a word, to be\n"
         "given as a command. All other options are void. For Example:\n"
         "*************************************************************\n"
         "h[enter] or help[enter] for the Help Display.\n"
         "*************************************************************\n");
}


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

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

LLVM IR (-O0):
@.str = [504 x i8] c"*************************************************************\0AThe Read Line Program\0A*************************************************************\0AThe (command)?> display takes only one argument. All subsequent\0Aarguments follow suit. You may use a letter, or a word, to be\0Agiven as a command. All other options are void. For Example:\0A*************************************************************\0Ah[enter] or help[enter] for the Help Display.\0A*************************************************************\0A\00"
define void @prompt() {
%1 = call i32 @printf(i8* getelementptr inbounds ([504 x i8], [504 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [503 x i8] c"*************************************************************\0AThe Read Line Program\0A*************************************************************\0AThe (command)?> display takes only one argument. All subsequent\0Aarguments follow suit. You may use a letter, or a word, to be\0Agiven as a command. All other options are void. For Example:\0A*************************************************************\0Ah[enter] or help[enter] for the Help Display.\0A*************************************************************\00"
define void @prompt() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([503 x i8], [503 x i8]* @str, i64 0, i64 0))
ret void
}
int max_int(int a, int b) { return a > b ? a : b; }


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

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

LLVM IR (-O0):
define i32 @max_int(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @max_int(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
int bitCount(unsigned X) {
  int b;
  for (b = 0; X != 0; X >>= 1) {
    if (X & 1) {
      b++;
    }
  }
  return b;
}


x86 assembly (clang, -O0):
<bitCount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1143 <bitCount+0x43>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1130 <bitCount+0x30>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1135 <bitCount+0x35>
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <bitCount+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitCount>:
xor    %eax,%eax
test   %edi,%edi
je     1120 <bitCount+0x20>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x1,%edx
add    %edx,%eax
shr    %ecx
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <bitCount+0x10>
ret

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

LLVM IR (-O2):
define i32 @bitCount(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = and i32 %5, 1
%7 = add nuw nsw i32 %4, %6
%8 = lshr i32 %5, 1
%9 = icmp ult i32 %5, 2
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
void ceph_fscache_uncache_page(struct inode *inode, struct page *pages) {}


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

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

LLVM IR (-O0):
%struct.inode = type opaque
%struct.page = type opaque
define void @ceph_fscache_uncache_page(%struct.inode* %0, %struct.page* %1) {
%3 = alloca %struct.inode*
%4 = alloca %struct.page*
store %struct.inode* %0, %struct.inode** %3
store %struct.page* %1, %struct.page** %4
ret void
}

LLVM IR (-O2):
%struct.inode = type opaque
%struct.page = type opaque
define void @ceph_fscache_uncache_page(%struct.inode* nocapture %0, %struct.page* nocapture %1) {
ret void
}
double double_mul(double a, double b) { return a * b; }


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

x86 assembly (clang, -O2):
<double_mul>:
mulsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @double_mul(double %0, double %1) {
%3 = fmul double %0, %1
ret double %3
}
/* Variables and functions */
int syscall(int, char *, int /*<<< orphan*/);
int mkdir(char *name) { return syscall(20, name, 0); }


x86 assembly (clang, -O0):
<mkdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x14,%edi
xor    %edx,%edx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkdir>:
mov    %rdi,%rsi
mov    $0x14,%edi
xor    %edx,%edx
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
define i32 @mkdir(i8* %0) {
%2 = tail call i32 @syscall(i32 20, i8* %0, i32 0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ arm_parith_op();
int /*<<< orphan*/ arm_parith_qsub(int /*<<< orphan*/);
void arm_qsub() { arm_parith_qsub(arm_parith_op()); }


x86 assembly (clang, -O0):
<arm_qsub>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <arm_parith_op@plt>
mov    %eax,%edi
call   1040 <arm_parith_qsub@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<arm_qsub>:
push   %rax
xor    %eax,%eax
call   1030 <arm_parith_op@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <arm_parith_qsub@plt>

LLVM IR (-O0):
define void @arm_qsub() {
%1 = call i32 (...) @arm_parith_op()
%2 = call i32 @arm_parith_qsub(i32 %1)
ret void
}

LLVM IR (-O2):
define void @arm_qsub() {
%1 = tail call i32 (...) @arm_parith_op()
%2 = tail call i32 @arm_parith_qsub(i32 %1)
ret void
}
/* Variables and functions */
bool dummy_prepare_clock(int c) {
  (void)c;
  return true;
}


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

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

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

LLVM IR (-O2):
define i32 @dummy_prepare_clock(i32 %0) {
ret i32 1
}
void do_one_loop(int i, int *n) {
  int j;
  for (j = 0; j < 100000000; j++)
    (*n) = (*n) + i * j;
}


x86 assembly (clang, -O0):
<do_one_loop>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x5f5e100,-0x14(%rbp)
jge    1142 <do_one_loop+0x42>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x4(%rbp),%eax
imul   -0x14(%rbp),%eax
add    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1112 <do_one_loop+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_one_loop>:
imul   $0x34e58f80,%edi,%eax
add    %eax,(%rsi)
ret

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

LLVM IR (-O2):
define void @do_one_loop(i32 %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = mul i32 %0, 887459712
%5 = add i32 %3, %4
store i32 %5, i32* %1
ret void
}
void dump_sess(struct osapsess *s) {}


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

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

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

LLVM IR (-O2):
%struct.osapsess = type opaque
define void @dump_sess(%struct.osapsess* nocapture %0) {
ret void
}
int xmlUCSIsLatinExtendedA(int code) {
  return (((code >= 0x0100) && (code <= 0x017F)));
}


x86 assembly (clang, -O0):
<xmlUCSIsLatinExtendedA>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x100,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1126 <xmlUCSIsLatinExtendedA+0x26>
cmpl   $0x17f,-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):
<xmlUCSIsLatinExtendedA>:
and    $0xffffff80,%edi
xor    %eax,%eax
cmp    $0x100,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @xmlUCSIsLatinExtendedA(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 256
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 383
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 @xmlUCSIsLatinExtendedA(i32 %0) {
%2 = and i32 %0, -128
%3 = icmp eq i32 %2, 256
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
scalar_t__ pthread_mutex_unlock(int /*<<< orphan*/ *);
int unlock_mutex(pthread_mutex_t *mtx) {
  if (pthread_mutex_unlock(mtx) == 0) {
    return 0;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<unlock_mutex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <pthread_mutex_unlock@plt>
cmp    $0x0,%rax
jne    113b <unlock_mutex+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    1142 <unlock_mutex+0x32>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unlock_mutex>:
push   %rax
call   1030 <pthread_mutex_unlock@plt>
neg    %rax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @unlock_mutex(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = call i64 @pthread_mutex_unlock(i32* %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @unlock_mutex(i32* %0) {
%2 = tail call i64 @pthread_mutex_unlock(i32* %0)
%3 = icmp ne i64 %2, 0
%4 = sext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
struct sigvec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int sigvec(int sig, struct sigvec *vec, struct sigvec *ovec) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<sigvec>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2ed2(%rip),%rax
mov    (%rax),%ecx
mov    0x2eb9(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigvec>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.sigvec = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @sigvec(i32 %0, %struct.sigvec* %1, %struct.sigvec* %2) {
%4 = alloca i32
%5 = alloca %struct.sigvec*
%6 = alloca %struct.sigvec*
store i32 %0, i32* %4
store %struct.sigvec* %1, %struct.sigvec** %5
store %struct.sigvec* %2, %struct.sigvec** %6
%7 = load i32, i32* @ENOSYS
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.sigvec = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @sigvec(i32 %0, %struct.sigvec* nocapture readnone %1, %struct.sigvec* nocapture readnone %2) {
%4 = load i32, i32* @ENOSYS
store i32 %4, i32* @errno
ret i32 -1
}
unsigned long asm_bsf(unsigned long x) {
  asm("bsfq %0, %0" : "=r"(x) : "0"(x));
  return x;
}


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

x86 assembly (clang, -O2):
<asm_bsf>:
mov    %rdi,%rax
bsf    %rax,%rax
ret

LLVM IR (-O0):
define i64 @asm_bsf(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 asm "bsfq $0, $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i64 %3)
store i64 %4, i64* %2
%5 = load i64, i64* %2
ret i64 %5
}

LLVM IR (-O2):
define i64 @asm_bsf(i64 %0) {
%2 = tail call i64 asm "bsfq $0, $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret i64 %2
}
int validatey(int y) {
  int tmp, retval = 1;
  while (y) {
    tmp = y % 10;
    if (tmp != 3 && tmp != 5) {
      retval = 0;
      break;
    }
    y /= 10;
  }
  return retval;
}


x86 assembly (clang, -O0):
<validatey>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1159 <validatey+0x59>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1146 <validatey+0x46>
cmpl   $0x5,-0x8(%rbp)
je     1146 <validatey+0x46>
movl   $0x0,-0xc(%rbp)
jmp    1159 <validatey+0x59>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <validatey+0xe>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<validatey>:
mov    $0x1,%eax
test   %edi,%edi
jne    111a <validatey+0x1a>
ret
nopw   0x0(%rax,%rax,1)
add    $0x9,%edi
cmp    $0x12,%edi
mov    %ecx,%edi
jbe    1109 <validatey+0x9>
movslq %edi,%rdx
imul   $0x66666667,%rdx,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rcx
add    %esi,%ecx
lea    (%rcx,%rcx,1),%esi
lea    (%rsi,%rsi,4),%esi
sub    %esi,%edx
cmp    $0x5,%edx
je     1110 <validatey+0x10>
cmp    $0x3,%edx
je     1110 <validatey+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @validatey(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %7
%4 = phi i32 [ %6, %7 ], [ %0, %1 ]
%5 = srem i32 %4, 10
%6 = sdiv i32 %4, 10
switch i32 %5, label %10 [
i32 5, label %7
i32 3, label %7
]
7: ; preds = %3, %3
%8 = add i32 %4, 9
%9 = icmp ult i32 %8, 19
br i1 %9, label %10, label %3
10: ; preds = %7, %3, %1
%11 = phi i32 [ 1, %1 ], [ 0, %3 ], [ 1, %7 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void check(int array[], int a) {
  int *ptr, i, k = 0;
  ptr = &a;
  for (i = 0; i < 6; i++) {
    if (array[i] == *ptr)
      ;
    { k++; }
  }
  printf("%d", k);
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x20(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x6,-0x1c(%rbp)
jge    1172 <check+0x62>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jne    115b <check+0x4b>
jmp    115b <check+0x4b>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1135 <check+0x25>
mov    -0x20(%rbp),%esi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @check(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %7
store i32* %4, i32** %5
store i32 0, i32* %6
br label %8
8: ; preds = %24, %2
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 6
br i1 %10, label %11, label %27
11: ; preds = %8
%12 = load i32*, i32** %3
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = load i32*, i32** %5
%18 = load i32, i32* %17
%19 = icmp eq i32 %16, %18
br i1 %19, label %20, label %21
20: ; preds = %11
br label %21
21: ; preds = %20, %11
%22 = load i32, i32* %7
%23 = add nsw i32 %22, 1
store i32 %23, i32* %7
br label %24
24: ; preds = %21
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %8
27: ; preds = %8
%28 = load i32, i32* %7
%29 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %28)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @check(i32* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 6)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t etna_f32_to_u32(float value) {
  union {
    uint32_t u32;
    float f32;
  } x = {.f32 = value};
  return x.u32;
}


x86 assembly (clang, -O0):
<etna_f32_to_u32>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<etna_f32_to_u32>:
movd   %xmm0,%eax
ret

LLVM IR (-O0):
%union.anon = type { i32 }
define i32 @etna_f32_to_u32(float %0) {
%2 = alloca float
%3 = alloca %union.anon
store float %0, float* %2
%4 = bitcast %union.anon* %3 to float*
%5 = load float, float* %2
store float %5, float* %4
%6 = bitcast %union.anon* %3 to i32*
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @etna_f32_to_u32(float %0) {
%2 = bitcast float %0 to i32
ret i32 %2
}
int test_05(unsigned int a) { return a <= 0x7FFFFFFF ? -5 : 10; }


x86 assembly (clang, -O0):
<test_05>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0xa,%eax
mov    $0xfffffffb,%ecx
cmp    $0x7fffffff,%edx
cmovbe %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_05>:
test   %edi,%edi
mov    $0xfffffffb,%ecx
mov    $0xa,%eax
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_05(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ule i32 %3, 2147483647
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 -5, i32 10
ret i32 %6
}

LLVM IR (-O2):
define i32 @test_05(i32 %0) {
%2 = icmp sgt i32 %0, -1
%3 = select i1 %2, i32 -5, i32 10
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int i;
  for (i = 0; i <= 255; i++) {
    printf("%d - %c\n", i, i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xff,-0x8(%rbp)
jg     1153 <main+0x43>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xee3(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x100,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d - %c\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %10, %0
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 255
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i32, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
br label %10
10: ; preds = %6
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
br label %3
13: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d - %c\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 256
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
/* Variables and functions */
void *malloc(size_t);
void *def_alloc_func(void *opaque, size_t items, size_t size) {
  (void)opaque;
  return malloc(items * size);
}


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

x86 assembly (clang, -O2):
<def_alloc_func>:
mov    %rsi,%rdi
imul   %rdx,%rdi
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @def_alloc_func(i8* nocapture readnone %0, i64 %1, i64 %2) {
%4 = mul i64 %2, %1
%5 = tail call i8* @malloc(i64 %4)
ret i8* %5
}
int sys_msgctl(void) {
  struct {
    int mode;
  } setbuf;
  return setbuf.mode;
}


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

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

LLVM IR (-O0):
%struct.anon = type { i32 }
define i32 @sys_msgctl() {
%1 = alloca %struct.anon
%2 = getelementptr inbounds %struct.anon, %struct.anon* %1, i32 0, i32 0
%3 = load i32, i32* %2
ret i32 %3
}

LLVM IR (-O2):
define i32 @sys_msgctl() {
ret i32 undef
}
int test_imm_41int32_mem(int *val) {
  return ((*val) & (0x41 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_41int32_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
and    $0x41,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

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

/* Variables and functions */
void adts_set_index(uint8_t *p_adts, uint8_t i_index) {
  p_adts[2] &= ~0x3c;
  p_adts[2] |= (i_index & 0xf) << 2;
}


x86 assembly (clang, -O0):
<adts_set_index>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ecx
and    $0xffffffc3,%ecx
mov    %ecx,0x8(%rax)
mov    -0xc(%rbp),%ecx
and    $0xf,%ecx
shl    $0x2,%ecx
mov    -0x8(%rbp),%rax
or     0x8(%rax),%ecx
mov    %ecx,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<adts_set_index>:
mov    0x8(%rdi),%eax
and    $0xffffffc3,%eax
and    $0xf,%esi
lea    (%rax,%rsi,4),%eax
mov    %eax,0x8(%rdi)
ret

LLVM IR (-O0):
define void @adts_set_index(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 = getelementptr inbounds i32, i32* %5, i64 2
%7 = load i32, i32* %6
%8 = and i32 %7, -61
store i32 %8, i32* %6
%9 = load i32, i32* %4
%10 = and i32 %9, 15
%11 = shl i32 %10, 2
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 2
%14 = load i32, i32* %13
%15 = or i32 %14, %11
store i32 %15, i32* %13
ret void
}

LLVM IR (-O2):
define void @adts_set_index(i32* nocapture %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 2
%4 = load i32, i32* %3
%5 = and i32 %4, -61
%6 = shl i32 %1, 2
%7 = and i32 %6, 60
%8 = or i32 %5, %7
store i32 %8, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void string_test() {
  char str1[] = "abc\n";
  char *str2 = "XYZ\n";
  printf(str1);
  printf(str2);
}


x86 assembly (clang, -O0):
<string_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xee2(%rip),%eax
mov    %eax,-0x5(%rbp)
mov    0xedd(%rip),%al
mov    %al,-0x1(%rbp)
lea    0xed4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x5(%rbp),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_test>:
push   %rax
movb   $0x0,0x4(%rsp)
movl   $0xa636261,(%rsp)
mov    %rsp,%rdi
call   1040 <printf@plt>
lea    0xec9(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@__const.string_test.str1 = [5 x i8] c"abc\0A\00"
@.str = [5 x i8] c"XYZ\0A\00"
define void @string_test() {
%1 = alloca [5 x i8]
%2 = alloca i8*
%3 = bitcast [5 x i8]* %1 to i8*
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%5 = call i32 @printf(i8* %4)
%6 = load i8*, i8** %2
%7 = call i32 @printf(i8* %6)
ret void
}

LLVM IR (-O2):
@__const.string_test.str1 = [5 x i8] c"abc\0A\00"
@str = [4 x i8] c"XYZ\00"
define void @string_test() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* %2)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
const char *rev_strnchr(const char *stop, const char *start, const char chr) {
  for (; start > stop; start--) {
    if (*start == chr) {
      return start;
    }
  }
  return NULL;
}


x86 assembly (clang, -O0):
<rev_strnchr>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    1155 <rev_strnchr+0x55>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x19(%rbp),%ecx
cmp    %ecx,%eax
jne    113f <rev_strnchr+0x3f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    115d <rev_strnchr+0x5d>
jmp    1144 <rev_strnchr+0x44>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    1111 <rev_strnchr+0x11>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rev_strnchr>:
cmp    %rdi,%rsi
jbe    111d <rev_strnchr+0x1d>
mov    %rsi,%rax
nopl   0x0(%rax,%rax,1)
cmp    %dl,(%rax)
je     111f <rev_strnchr+0x1f>
add    $0xffffffffffffffff,%rax
cmp    %rdi,%rax
ja     1110 <rev_strnchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @rev_strnchr(i8* readnone %0, i8* %1, i8 signext %2) {
%4 = icmp ugt i8* %1, %0
br i1 %4, label %5, label %12
5: ; preds = %3, %9
%6 = phi i8* [ %10, %9 ], [ %1, %3 ]
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, %2
br i1 %8, label %12, label %9
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %6, i64 -1
%11 = icmp ugt i8* %10, %0
br i1 %11, label %5, label %12
12: ; preds = %5, %9, %3
%13 = phi i8* [ null, %3 ], [ null, %9 ], [ %6, %5 ]
ret i8* %13
}