xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ CDROMEJECT;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/);
int open(char *, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int fd = open(argv[1], O_RDONLY);
  ioctl(fd, CDROMEJECT);
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e93(%rip),%rax
mov    (%rax),%esi
call   1050 <open@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2e6f(%rip),%rax
mov    (%rax),%esi
call   1030 <ioctl@plt>
mov    -0x14(%rbp),%edi
call   1040 <close@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x8(%rsi),%rdi
mov    0x2eac(%rip),%rax
mov    (%rax),%esi
call   1050 <open@plt>
mov    %eax,%ebx
mov    0x2e8c(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1030 <ioctl@plt>
mov    %ebx,%edi
call   1040 <close@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
@CDROMEJECT = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = load i32, i32* @O_RDONLY
%11 = call i32 @open(i8* %9, i32 %10)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = load i32, i32* @CDROMEJECT
%14 = call i32 @ioctl(i32 %12, i32 %13)
%15 = load i32, i32* %6
%16 = call i32 @close(i32 %15)
ret i32 0
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@CDROMEJECT = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = load i32, i32* @O_RDONLY
%6 = tail call i32 @open(i8* %4, i32 %5)
%7 = load i32, i32* @CDROMEJECT
%8 = tail call i32 @ioctl(i32 %6, i32 %7)
%9 = tail call i32 @close(i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int r;
  srand(time(NULL));
  for (;;) {
    r = rand();
    printf("%04x\r\n", r);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
jmp    1166 <main+0x26>

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xeaa(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <rand@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
jmp    1160 <main+0x20>

LLVM IR (-O0):
@.str = [7 x i8] c"%04x\0D\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @time(i32* null)
%8 = call i32 @srand(i32 %7)
br label %9
9: ; preds = %9, %2
%10 = call i32 (...) @rand()
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %9
}

LLVM IR (-O2):
@.str = [7 x i8] c"%04x\0D\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
br label %5
5: ; preds = %5, %2
%6 = tail call i32 (...) @rand()
%7 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %5
}
/* Type definitions */
struct stat {
  size_t st_size;
};

/* Variables and functions */
int fstat(int, struct stat *);
int /*<<< orphan*/ quit(char *);
size_t file_size(int fd) {
  struct stat s;
  if (fstat(fd, &s) == -1)
    quit("fstat() failed");
  return s.st_size;
}


x86 assembly (clang, -O0):
<file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1040 <fstat@plt>
cmp    $0xffffffff,%eax
jne    114c <file_size+0x2c>
lea    0xeb9(%rip),%rdi
call   1030 <quit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_size>:
push   %rax
mov    %rsp,%rsi
call   1040 <fstat@plt>
cmp    $0xffffffff,%eax
jne    113a <file_size+0x1a>
lea    0xecb(%rip),%rdi
call   1030 <quit@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
@.str = [15 x i8] c"fstat() failed\00"
define i64 @file_size(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.stat
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @fstat(i32 %4, %struct.stat* %3)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @quit(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%11 = load i64, i64* %10
ret i64 %11
}

LLVM IR (-O2):
%struct.stat = type { i64 }
@.str = [15 x i8] c"fstat() failed\00"
define i64 @file_size(i32 %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @fstat(i32 %0, %struct.stat* %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @quit(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%10 = load i64, i64* %9
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ bfwrite(char *);
void cmdMoveRight(int iCount) {
  int z;
  for (z = 0; z < iCount; z++) {
    bfwrite(">>");
  }
}


x86 assembly (clang, -O0):
<cmdMoveRight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1148 <cmdMoveRight+0x38>
lea    0xecb(%rip),%rdi
call   1030 <bfwrite@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <cmdMoveRight+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdMoveRight>:
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    113d <cmdMoveRight+0x2d>
mov    %edi,%ebx
lea    0xedf(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <bfwrite@plt>
add    $0xffffffff,%ebx
jne    1130 <cmdMoveRight+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c">>\00"
define void @cmdMoveRight(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 @bfwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void c_intface_(int *i) { fprintf(stdout, "Add_\n"); }


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

x86 assembly (clang, -O2):
<c_intface_>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [6 x i8] c"Add_\0A\00"
define void @c_intface_(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @stdout
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [6 x i8] c"Add_\0A\00"
define void @c_intface_(i32* nocapture readnone %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_eval(int);
void testReductionToConstant(int a) {
  clang_analyzer_eval((a * 0) == 0);
  clang_analyzer_eval((a & 0) == 0);
  clang_analyzer_eval((a | (~0)) == (~0));
}


x86 assembly (clang, -O0):
<testReductionToConstant>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
imul   $0x0,-0x4(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x4(%rbp),%eax
and    $0x0,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
mov    -0x4(%rbp),%eax
or     $0xffffffff,%eax
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testReductionToConstant>:
push   %rax
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
call   1030 <clang_analyzer_eval@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <clang_analyzer_eval@plt>

LLVM IR (-O0):
define void @testReductionToConstant(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 0
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @clang_analyzer_eval(i32 %6)
%8 = load i32, i32* %2
%9 = and i32 %8, 0
%10 = icmp eq i32 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @clang_analyzer_eval(i32 %11)
%13 = load i32, i32* %2
%14 = or i32 %13, -1
%15 = icmp eq i32 %14, -1
%16 = zext i1 %15 to i32
%17 = call i32 @clang_analyzer_eval(i32 %16)
ret void
}

LLVM IR (-O2):
define void @testReductionToConstant(i32 %0) {
%2 = tail call i32 @clang_analyzer_eval(i32 1)
%3 = tail call i32 @clang_analyzer_eval(i32 1)
%4 = tail call i32 @clang_analyzer_eval(i32 1)
ret void
}
/* Variables and functions */
int snprintf(char *, int, char *, unsigned char);
int STR_FEC_RATE_OUT(char *p, int n, unsigned char fec_out_rate) {
  if (fec_out_rate == 0)
    return 0;
  return snprintf(p, n, "fect_rate_out:%d ", fec_out_rate);
}


x86 assembly (clang, -O0):
<STR_FEC_RATE_OUT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %al,-0x15(%rbp)
movzbl -0x15(%rbp),%eax
cmp    $0x0,%eax
jne    113d <STR_FEC_RATE_OUT+0x2d>
movl   $0x0,-0x4(%rbp)
jmp    1157 <STR_FEC_RATE_OUT+0x47>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    0xeb5(%rip),%rdx
movzbl -0x15(%rbp),%ecx
call   1030 <snprintf@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<STR_FEC_RATE_OUT>:
test   %edx,%edx
je     1123 <STR_FEC_RATE_OUT+0x13>
movzbl %dl,%ecx
lea    0xee2(%rip),%rdx
jmp    1030 <snprintf@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"fect_rate_out:%d \00"
define i32 @STR_FEC_RATE_OUT(i8* %0, i32 %1, i8 zeroext %2) {
%4 = icmp eq i8 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8 zeroext %2)
br label %7
7: ; preds = %3, %5
%8 = phi i32 [ %6, %5 ], [ 0, %3 ]
ret i32 %8
}
/* Variables and functions */
void *malloc(int);
void *realloc(void *, int);
void *SfRealloc(void *pMem, int nNewSize) {
  if (pMem == NULL)
    return malloc(nNewSize);
  else
    return realloc(pMem, nNewSize);
}


x86 assembly (clang, -O0):
<SfRealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114b <SfRealloc+0x2b>
mov    -0x14(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
jmp    115b <SfRealloc+0x3b>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SfRealloc>:
test   %rdi,%rdi
je     112a <SfRealloc+0xa>
jmp    1040 <realloc@plt>
mov    %esi,%edi
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define i8* @SfRealloc(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i8* @malloc(i32 %1)
br label %8
6: ; preds = %2
%7 = tail call i8* @realloc(i8* %0, i32 %1)
br label %8
8: ; preds = %6, %4
%9 = phi i8* [ %5, %4 ], [ %7, %6 ]
ret i8* %9
}
void *test_anti_range_76(unsigned short n) {
  extern void *alloc_anti_range_76(unsigned short)
      __attribute__((alloc_size(1)));
  if (1 <= n && n <= 1)
    n = 1 - 1;
  return alloc_anti_range_76(n);
}


x86 assembly (clang, -O0):
<test_anti_range_76>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
jg     1143 <test_anti_range_76+0x33>
movzwl -0x2(%rbp),%eax
cmp    $0x1,%eax
jg     1143 <test_anti_range_76+0x33>
movw   $0x0,-0x2(%rbp)
movzwl -0x2(%rbp),%edi
call   1030 <alloc_anti_range_76@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_anti_range_76>:
xor    %eax,%eax
cmp    $0x1,%di
cmove  %eax,%edi
jmp    1030 <alloc_anti_range_76@plt>

LLVM IR (-O0):
define i8* @test_anti_range_76(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = icmp sle i32 1, %4
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i16, i16* %2
%8 = zext i16 %7 to i32
%9 = icmp sle i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %6
store i16 0, i16* %2
br label %11
11: ; preds = %10, %6, %1
%12 = load i16, i16* %2
%13 = call i8* @alloc_anti_range_76(i16 zeroext %12)
ret i8* %13
}

LLVM IR (-O2):
define i8* @test_anti_range_76(i16 zeroext %0) {
%2 = icmp eq i16 %0, 1
%3 = select i1 %2, i16 0, i16 %0
%4 = tail call i8* @alloc_anti_range_76(i16 zeroext %3)
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ MC_put1_16(int, int /*<<< orphan*/ *,
                              int /*<<< orphan*/ const *, int);
void MC_put_o_16_3dnow(uint8_t *dest, const uint8_t *ref, int stride,
                       int height) {
  MC_put1_16(height, dest, ref, stride);
}


x86 assembly (clang, -O0):
<MC_put_o_16_3dnow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1030 <MC_put1_16@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MC_put_o_16_3dnow>:
mov    %edx,%eax
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    %ecx,%edi
mov    %eax,%ecx
jmp    1030 <MC_put1_16@plt>

LLVM IR (-O0):
define void @MC_put_o_16_3dnow(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = load i32*, i32** %5
%11 = load i32*, i32** %6
%12 = load i32, i32* %7
%13 = call i32 @MC_put1_16(i32 %9, i32* %10, i32* %11, i32 %12)
ret void
}

LLVM IR (-O2):
define void @MC_put_o_16_3dnow(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = tail call i32 @MC_put1_16(i32 %3, i32* %0, i32* %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void int_print(void *i) { printf("%d", *(int *)i); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @int_print(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
/* Variables and functions */
int monte_carlo_pi(int);
double pi(int n_epochs) {
  return 4 * monte_carlo_pi(n_epochs) / (double)n_epochs;
}


x86 assembly (clang, -O0):
<pi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <monte_carlo_pi@plt>
shl    $0x2,%eax
cvtsi2sd %eax,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pi>:
push   %rbx
mov    %edi,%ebx
call   1030 <monte_carlo_pi@plt>
shl    $0x2,%eax
cvtsi2sd %eax,%xmm0
cvtsi2sd %ebx,%xmm1
divsd  %xmm1,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @pi(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @monte_carlo_pi(i32 %3)
%5 = mul nsw i32 4, %4
%6 = sitofp i32 %5 to double
%7 = load i32, i32* %2
%8 = sitofp i32 %7 to double
%9 = fdiv double %6, %8
ret double %9
}

LLVM IR (-O2):
define double @pi(i32 %0) {
%2 = tail call i32 @monte_carlo_pi(i32 %0)
%3 = shl nsw i32 %2, 2
%4 = sitofp i32 %3 to double
%5 = sitofp i32 %0 to double
%6 = fdiv double %4, %5
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ end();
void begin(void) { end(); }


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

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

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

LLVM IR (-O2):
define void @begin() {
%1 = tail call i32 (...) @end()
ret void
}
/* Variables and functions */
int f359(int *);
int f360(int *p) { return f359(p); }


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

x86 assembly (clang, -O2):
<f360>:
jmp    1030 <f359@plt>

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

LLVM IR (-O2):
define i32 @f360(i32* %0) {
%2 = tail call i32 @f359(i32* %0)
ret i32 %2
}
int pinmux_enable_setting(struct pinctrl_setting const *setting) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.pinctrl_setting = type opaque
define i32 @pinmux_enable_setting(%struct.pinctrl_setting* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int errno;
int /*<<< orphan*/ pline(int, char *);
int main(void) {
  int local_errno;
  errno = 0;
  pline(1, "/etc/passwd");
  local_errno = errno;
  do {
  } while (0);
  return errno;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eba(%rip),%rax
movl   $0x0,(%rax)
mov    $0x1,%edi
lea    0xec8(%rip),%rsi
call   1030 <pline@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
jmp    114e <main+0x3e>
mov    0x2e8b(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ec8(%rip),%rbx
movl   $0x0,(%rbx)
lea    0xedb(%rip),%rsi
mov    $0x1,%edi
call   1030 <pline@plt>
mov    (%rbx),%eax
pop    %rbx
ret

LLVM IR (-O0):
@errno = global i32 0
@.str = [12 x i8] c"/etc/passwd\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* @errno
%3 = call i32 @pline(i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @errno
store i32 %4, i32* %2
br label %5
5: ; preds = %0
br label %6
6: ; preds = %5
%7 = load i32, i32* @errno
ret i32 %7
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [12 x i8] c"/etc/passwd\00"
define i32 @main() {
store i32 0, i32* @errno
%1 = tail call i32 @pline(i32 1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @errno
ret i32 %2
}
/* Variables and functions */
int d(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", d(5));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @d(i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
void mem_put_le24_as_int(void *vmem, int val) {
  unsigned char *mem = (unsigned char *)vmem;
  mem[0] = (unsigned char)((val >> 0) & 0xff);
  mem[1] = (unsigned char)((val >> 8) & 0xff);
  mem[2] = (unsigned char)((val >> 16) & 0xff);
}


x86 assembly (clang, -O0):
<mem_put_le24_as_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x0,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x2(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_put_le24_as_int>:
mov    %esi,%eax
mov    %al,(%rdi)
mov    %ah,0x1(%rdi)
shr    $0x10,%eax
mov    %al,0x2(%rdi)
ret

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

LLVM IR (-O2):
define void @mem_put_le24_as_int(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
store i8 %3, i8* %0
%4 = lshr i32 %1, 8
%5 = trunc i32 %4 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
%7 = lshr i32 %1, 16
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %8, i8* %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ error_report(char const *);
int /*<<< orphan*/ exit(int);
void error_exit(const char *msg) {
  error_report(msg);
  exit(1);
}


x86 assembly (clang, -O0):
<error_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <error_report@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error_exit>:
push   %rax
call   1030 <error_report@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @error_exit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @error_report(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @error_exit(i8* %0) {
%2 = tail call i32 @error_report(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  size_t we_wordc;
};
typedef TYPE_1__ wordexp_t;

/* Variables and functions */
size_t chpl_wordexp_num(const wordexp_t wexp) { return wexp.we_wordc; }


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

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

LLVM IR (-O0):
%struct.TYPE_3__ = type { i64 }
define i64 @chpl_wordexp_num(i64 %0) {
%2 = alloca %struct.TYPE_3__
%3 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 0
store i64 %0, i64* %3
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 0
%5 = load i64, i64* %4
ret i64 %5
}

LLVM IR (-O2):
define i64 @chpl_wordexp_num(i64 returned %0) {
ret i64 %0
}
/* Type definitions */
typedef long long uint64_t;
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
long long ubits(char *, unsigned int, unsigned int);
int64_t sbits(char *buf, unsigned int start, unsigned int width) {
  uint64_t fld = ubits(buf, start, width);
  if (fld & (1LL << (width - 1)))
    fld |= (-1LL << (width - 1));
  return (int64_t)fld;
}


x86 assembly (clang, -O0):
<sbits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <ubits@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
mov    $0x1,%edx
shl    %cl,%rdx
mov    %rdx,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
je     1175 <sbits+0x65>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0xffffffffffffffff,%rax
shl    %cl,%rax
or     -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sbits>:
push   %rbx
mov    %edx,%ebx
call   1030 <ubits@plt>
add    $0xff,%bl
movzbl %bl,%ecx
mov    $0xffffffffffffffff,%rdx
shl    %cl,%rdx
xor    %esi,%esi
bt     %rcx,%rax
cmovae %esi,%edx
or     %edx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @sbits(i8* %0, i32 %1, i32 %2) {
%4 = tail call i64 @ubits(i8* %0, i32 %1, i32 %2)
%5 = add i32 %2, -1
%6 = zext i32 %5 to i64
%7 = shl nuw i64 1, %6
%8 = and i64 %4, %7
%9 = icmp eq i64 %8, 0
%10 = shl nsw i64 -1, %6
%11 = select i1 %9, i64 0, i64 %10
%12 = or i64 %11, %4
%13 = trunc i64 %12 to i32
ret i32 %13
}
void _glfwTerminateThreads(void) {}


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

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

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

LLVM IR (-O2):
define void @_glfwTerminateThreads() {
ret void
}
int ft_abs(int n) {
  if (n < 0)
    return (n * -1);
  else
    return (n);
}


x86 assembly (clang, -O0):
<ft_abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111d <ft_abs+0x1d>
imul   $0xffffffff,-0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1123 <ft_abs+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_abs>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
int topi(int *tops) {
  int k;
  k = *tops;
  return k;
}


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

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

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

LLVM IR (-O2):
define i32 @topi(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}
int FromHexToDecimal(char hex) {
  if ('0' <= hex && hex <= '9') {
    return hex - '0';
  }
  if (hex >= 'A' && hex <= 'Z') {
    return hex - 'A' + 10;
  }
  return hex - 'a' + 10;
}


x86 assembly (clang, -O0):
<FromHexToDecimal>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jg     1137 <FromHexToDecimal+0x37>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1137 <FromHexToDecimal+0x37>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1170 <FromHexToDecimal+0x70>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     1163 <FromHexToDecimal+0x63>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     1163 <FromHexToDecimal+0x63>
movsbl -0x5(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    1170 <FromHexToDecimal+0x70>
movsbl -0x5(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FromHexToDecimal>:
lea    -0x30(%rdi),%eax
lea    -0x41(%rdi),%ecx
xor    %edx,%edx
cmp    $0x1a,%cl
setb   %dl
shl    $0x5,%edx
add    $0xffffffa9,%edx
cmp    $0xa,%al
mov    $0xffffffd0,%eax
cmovae %edx,%eax
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @FromHexToDecimal(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 sle i32 48, %5
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
store i32 %14, i32* %2
br label %33
15: ; preds = %7, %1
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp sge i32 %17, 65
br i1 %18, label %19, label %28
19: ; preds = %15
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = icmp sle i32 %21, 90
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = sub nsw i32 %25, 65
%27 = add nsw i32 %26, 10
store i32 %27, i32* %2
br label %33
28: ; preds = %19, %15
%29 = load i8, i8* %3
%30 = sext i8 %29 to i32
%31 = sub nsw i32 %30, 97
%32 = add nsw i32 %31, 10
store i32 %32, i32* %2
br label %33
33: ; preds = %28, %23, %11
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
define i32 @FromHexToDecimal(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add i8 %0, -48
%4 = icmp ult i8 %3, 10
%5 = add i8 %0, -65
%6 = icmp ult i8 %5, 26
%7 = select i1 %6, i32 -55, i32 -87
%8 = select i1 %4, i32 -48, i32 %7
%9 = add nsw i32 %8, %2
ret i32 %9
}
void g_signal_handler_is_connected() {}


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

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

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

LLVM IR (-O2):
define void @g_signal_handler_is_connected() {
ret void
}
int xmlGetThreadId(void) { return ((int)0); }


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

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

LLVM IR (-O0):
define i32 @xmlGetThreadId() {
ret i32 0
}

LLVM IR (-O2):
define i32 @xmlGetThreadId() {
ret i32 0
}
void fb_hSoftCursor_code_start(void) {}


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

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

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

LLVM IR (-O2):
define void @fb_hSoftCursor_code_start() {
ret void
}
double f(double x) { return (x * x * x - 2 * x * x - 4 * x + 8); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  0xef0(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xeb2(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe9a(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xef0(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm1
mulsd  0xee4(%rip),%xmm0
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
addsd  0xedc(%rip),%xmm0
ret

LLVM IR (-O0):
define double @f(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fmul double %3, %4
%6 = load double, double* %2
%7 = load double, double* %2
%8 = fmul double 2.000000e+00, %7
%9 = load double, double* %2
%10 = fmul double %8, %9
%11 = fneg double %10
%12 = call double @llvm.fmuladd.f64(double %5, double %6, double %11)
%13 = load double, double* %2
%14 = call double @llvm.fmuladd.f64(double -4.000000e+00, double %13, double %12)
%15 = fadd double %14, 8.000000e+00
ret double %15
}

LLVM IR (-O2):
define double @f(double %0) {
%2 = fmul double %0, %0
%3 = fmul double %0, -2.000000e+00
%4 = fmul double %3, %0
%5 = tail call double @llvm.fmuladd.f64(double %2, double %0, double %4)
%6 = tail call double @llvm.fmuladd.f64(double %0, double -4.000000e+00, double %5)
%7 = fadd double %6, 8.000000e+00
ret double %7
}
/* Variables and functions */
long long sum(long long);
long long thirt(long long n) {
  do {
    n = sum(n);
  } while (sum(n) != n);
  return n;
}


x86 assembly (clang, -O0):
<thirt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <sum@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <sum@plt>
cmp    -0x8(%rbp),%rax
jne    111c <thirt+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thirt>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <sum@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <sum@plt>
cmp    %rbx,%rax
jne    1120 <thirt+0x10>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @thirt(i64 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %0, %1 ], [ %4, %2 ]
%4 = tail call i64 @sum(i64 %3)
%5 = tail call i64 @sum(i64 %4)
%6 = icmp eq i64 %5, %4
br i1 %6, label %7, label %2
7: ; preds = %2
ret i64 %4
}
findvar(s, pool) char s[];
char *pool;
{
  register int i;
  for (i = 0; i < 64; i++) {
    if (strcmp(pool + (i * 8), s) == 0)
      return (i);
  }
  return (-1);
}


x86 assembly (clang, -O0):
<findvar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x40,-0x1c(%rbp)
jge    1170 <findvar+0x60>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%eax
shl    $0x3,%eax
cltq
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    115d <findvar+0x4d>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1177 <findvar+0x67>
jmp    1162 <findvar+0x52>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1127 <findvar+0x17>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findvar>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r15
xor    %r14d,%r14d
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1143 <findvar+0x33>
add    $0x1,%r14
add    $0x8,%rbx
cmp    $0x40,%r14
jne    1120 <findvar+0x10>
mov    $0xffffffff,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @findvar(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %2, %9
%4 = phi i64 [ 0, %2 ], [ %10, %9 ]
%5 = shl nuw nsw i64 %4, 3
%6 = getelementptr inbounds i8, i8* %1, i64 %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(1) %0)
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = add nuw nsw i64 %4, 1
%11 = icmp eq i64 %10, 64
br i1 %11, label %14, label %3
12: ; preds = %3
%13 = trunc i64 %4 to i32
br label %14
14: ; preds = %9, %12
%15 = phi i32 [ %13, %12 ], [ -1, %9 ]
ret i32 %15
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int is_fifo_dma_class(uint32_t cls) {
  switch (cls) {
  case 0x0000406e:
  case 0x0000446e:
    return 1;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<is_fifo_dma_class>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
or     $0x400,%eax
sub    $0x446e,%eax
je     111f <is_fifo_dma_class+0x1f>
jmp    112b <is_fifo_dma_class+0x2b>
movl   $0x1,-0x4(%rbp)
jmp    1132 <is_fifo_dma_class+0x32>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_fifo_dma_class>:
and    $0xfffffbff,%edi
xor    %eax,%eax
cmp    $0x406e,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @is_fifo_dma_class(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 16494, label %5
i32 17518, label %5
]
5: ; preds = %1, %1
store i32 1, i32* %2
br label %7
6: ; preds = %1
store i32 0, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @is_fifo_dma_class(i32 %0) {
%2 = and i32 %0, -1025
%3 = icmp eq i32 %2, 16494
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
char *getlogin();
char *strdup(char *);
char *system_get_username() {
  char *res = NULL;
  char *name = NULL;
  if ((name = getlogin())) {
    res = strdup(name);
  }
  return res;
}


x86 assembly (clang, -O0):
<system_get_username>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getlogin@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     115a <system_get_username+0x3a>
mov    -0x10(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<system_get_username>:
push   %rax
xor    %eax,%eax
call   1030 <getlogin@plt>
test   %rax,%rax
je     1136 <system_get_username+0x16>
mov    %rax,%rdi
pop    %rax
jmp    1040 <strdup@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @system_get_username() {
%1 = alloca i8*
%2 = alloca i8*
store i8* null, i8** %1
store i8* null, i8** %2
%3 = call i8* (...) @getlogin()
store i8* %3, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i8*, i8** %2
%7 = call i8* @strdup(i8* %6)
store i8* %7, i8** %1
br label %8
8: ; preds = %5, %0
%9 = load i8*, i8** %1
ret i8* %9
}

LLVM IR (-O2):
define noalias i8* @system_get_username() {
%1 = tail call i8* (...) @getlogin()
%2 = icmp eq i8* %1, null
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i8* @strdup(i8* %1)
br label %5
5: ; preds = %3, %0
%6 = phi i8* [ %4, %3 ], [ null, %0 ]
ret i8* %6
}
int is_prime(int n) {
  int i;
  i = 2;
  while (i < n) {
    if (n % i == 0) {
      return 0;
    }
    i++;
  }
  if (n <= 0) {
    return -1;
  }
  if (n == 1 || n == 0) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1144 <is_prime+0x44>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1136 <is_prime+0x36>
movl   $0x0,-0x4(%rbp)
jmp    1181 <is_prime+0x81>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <is_prime+0xe>
cmpl   $0x0,-0x8(%rbp)
jg     115a <is_prime+0x5a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1181 <is_prime+0x81>
cmpl   $0x1,-0x8(%rbp)
je     116e <is_prime+0x6e>
cmpl   $0x0,-0x8(%rbp)
jne    117a <is_prime+0x7a>
movl   $0x0,-0x4(%rbp)
jmp    1181 <is_prime+0x81>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
cmp    $0x3,%edi
jl     1120 <is_prime+0x20>
mov    $0x2,%ecx
nopw   0x0(%rax,%rax,1)
mov    %edi,%eax
cltd
idiv   %ecx
test   %edx,%edx
je     112d <is_prime+0x2d>
add    $0x1,%ecx
cmp    %ecx,%edi
jne    1110 <is_prime+0x10>
test   %edi,%edi
jle    1130 <is_prime+0x30>
xor    %eax,%eax
cmp    $0x1,%edi
setne  %al
ret
xor    %eax,%eax
ret
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @is_prime(i32 %0) {
%2 = icmp sgt i32 %0, 2
br i1 %2, label %5, label %10
3: ; preds = %5
%4 = icmp eq i32 %9, %0
br i1 %4, label %10, label %5
5: ; preds = %1, %3
%6 = phi i32 [ %9, %3 ], [ 2, %1 ]
%7 = srem i32 %0, %6
%8 = icmp eq i32 %7, 0
%9 = add nuw nsw i32 %6, 1
br i1 %8, label %15, label %3
10: ; preds = %3, %1
%11 = icmp slt i32 %0, 1
br i1 %11, label %15, label %12
12: ; preds = %10
%13 = icmp ne i32 %0, 1
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %5, %12, %10
%16 = phi i32 [ -1, %10 ], [ %14, %12 ], [ 0, %5 ]
ret i32 %16
}
int isdelim(char c) { return (c == ' ' || c == 13 || c == 10); }


x86 assembly (clang, -O0):
<isdelim>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x2(%rbp)
je     113b <isdelim+0x3b>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xd,%ecx
mov    %al,-0x2(%rbp)
je     113b <isdelim+0x3b>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isdelim>:
mov    $0x1,%eax
cmp    $0xd,%dil
je     1111 <isdelim+0x11>
cmp    $0x20,%dil
jne    1112 <isdelim+0x12>
ret
xor    %eax,%eax
cmp    $0xa,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @isdelim(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 32
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 13
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 10
br label %14
14: ; preds = %10, %6, %1
%15 = phi i1 [ true, %6 ], [ true, %1 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @isdelim(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %5
i8 13, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, 10
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ]
ret i32 %6
}