xunge/DecIR huggingface dataset:
/* Variables and functions */
int const random_rand();
int random_int_range(const int min, const int max) {
  return (max - min == 0) ? max : min + (random_rand() % (max - min));
}


x86 assembly (clang, -O0):
<random_int_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
cmp    $0x0,%eax
jne    1138 <random_int_range+0x28>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1156 <random_int_range+0x46>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <random_rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%eax
add    %edx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_int_range>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%eax
mov    %esi,%ebp
sub    %edi,%ebp
je     112b <random_int_range+0x1b>
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <random_rand@plt>
cltd
idiv   %ebp
mov    %edx,%eax
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @random_int_range(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = sub nsw i32 %5, %6
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* %4
br label %19
11: ; preds = %2
%12 = load i32, i32* %3
%13 = call i32 (...) @random_rand()
%14 = load i32, i32* %4
%15 = load i32, i32* %3
%16 = sub nsw i32 %14, %15
%17 = srem i32 %13, %16
%18 = add nsw i32 %12, %17
br label %19
19: ; preds = %11, %9
%20 = phi i32 [ %10, %9 ], [ %18, %11 ]
ret i32 %20
}

LLVM IR (-O2):
define i32 @random_int_range(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i32 (...) @random_rand()
%7 = srem i32 %6, %3
%8 = add nsw i32 %7, %0
br label %9
9: ; preds = %2, %5
%10 = phi i32 [ %8, %5 ], [ %1, %2 ]
ret i32 %10
}
void notifyEvent(const char *ev, int vaddr, int type, const void *sptr) {}


x86 assembly (clang, -O0):
<notifyEvent>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @notifyEvent(i8* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
ret void
}

LLVM IR (-O2):
define void @notifyEvent(i8* nocapture %0, i32 %1, i32 %2, i8* nocapture %3) {
ret void
}
char *utf8_next_char(const char *s) { return (char *)(s + 1); }


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

x86 assembly (clang, -O2):
<utf8_next_char>:
lea    0x1(%rdi),%rax
ret

LLVM IR (-O0):
define i8* @utf8_next_char(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 1
ret i8* %4
}

LLVM IR (-O2):
define i8* @utf8_next_char(i8* readnone %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ itob(int, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char s[1000];
  itob(12, s, 2);
  printf("%s\n", s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
lea    -0x3f0(%rbp),%rsi
mov    $0xc,%edi
mov    $0x2,%edx
call   1040 <itob@plt>
lea    -0x3f0(%rbp),%rsi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x3f0,%rsp
mov    %rsp,%rbx
mov    $0xc,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1040 <itob@plt>
lea    0xebc(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = call i32 @itob(i32 12, i8* %2, i32 2)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cent_1();
int main() {
  cent_1();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @cent_1()
ret i32 0
}
unsigned short read16(short *p) {
  return ((unsigned short)*(unsigned char *)p) << 8 |
         (unsigned short)*((unsigned char *)p + 1);
}


x86 assembly (clang, -O0):
<read16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzwl %ax,%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
movzwl %cx,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read16>:
movzwl (%rdi),%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define zeroext i16 @read16(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = bitcast i16* %3 to i8*
%5 = load i8, i8* %4
%6 = zext i8 %5 to i16
%7 = zext i16 %6 to i32
%8 = shl i32 %7, 8
%9 = load i16*, i16** %2
%10 = bitcast i16* %9 to i8*
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i16
%14 = zext i16 %13 to i32
%15 = or i32 %8, %14
%16 = trunc i32 %15 to i16
ret i16 %16
}

LLVM IR (-O2):
define zeroext i16 @read16(i16* nocapture %0) {
%2 = bitcast i16* %0 to i8*
%3 = load i8, i8* %2
%4 = zext i8 %3 to i16
%5 = shl nuw i16 %4, 8
%6 = getelementptr inbounds i8, i8* %2, i64 1
%7 = load i8, i8* %6
%8 = zext i8 %7 to i16
%9 = or i16 %5, %8
ret i16 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void dump_3d_linear(int length, double *array) {
  int i;
  for (i = 0; i < length; i++) {
    printf("%f ", array[i]);
  }
}


x86 assembly (clang, -O0):
<dump_3d_linear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1159 <dump_3d_linear+0x49>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <dump_3d_linear+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_3d_linear>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1147 <dump_3d_linear+0x37>
mov    %rsi,%r15
mov    %edi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsd  (%r15,%rbx,8),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <dump_3d_linear+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%f \00"
define void @dump_3d_linear(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
store i32 %0, i32* %3
store double* %1, double** %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load double*, double** %4
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double, double* %11, i64 %13
%15 = load double, double* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %15)
br label %17
17: ; preds = %10
%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):
@.str = [4 x i8] c"%f \00"
define void @dump_3d_linear(i32 %0, double* nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds double, double* %1, i64 %7
%9 = load double, double* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
void destructInt(void *i) { free((int *)i); }


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

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

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

LLVM IR (-O2):
define void @destructInt(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @free(i32* %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ c;
typedef int /*<<< orphan*/ b;
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  char a;
  int b;
  double c;
  printf("%d\n", sizeof(a));
  printf("%d\n", sizeof(b));
  printf("%d\n", sizeof(c));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 8)
ret i32 0
}
/* Variables and functions */
char *strdup(char const *);
char *strrchr(char *, char);
char *basename(const char *name) {
  char *base, *last;
  if (name == NULL)
    return NULL;
  if ((base = strdup(name)) == NULL)
    return NULL;
  if ((last = strrchr(base, '.')) != NULL)
    *last = '\0';
  return base;
}


x86 assembly (clang, -O0):
<basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1144 <basename+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1193 <basename+0x73>
mov    -0x10(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1168 <basename+0x48>
movq   $0x0,-0x8(%rbp)
jmp    1193 <basename+0x73>
mov    -0x18(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     118b <basename+0x6b>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basename>:
push   %rbx
test   %rdi,%rdi
je     114a <basename+0x2a>
call   1040 <strdup@plt>
test   %rax,%rax
je     114a <basename+0x2a>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     114c <basename+0x2c>
movb   $0x0,(%rax)
jmp    114c <basename+0x2c>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @basename(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
store i8* null, i8** %2
br label %22
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i8* @strdup(i8* %10)
store i8* %11, i8** %4
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %9
store i8* null, i8** %2
br label %22
14: ; preds = %9
%15 = load i8*, i8** %4
%16 = call i8* @strrchr(i8* %15, i8 signext 46)
store i8* %16, i8** %5
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = load i8*, i8** %5
store i8 0, i8* %19
br label %20
20: ; preds = %18, %14
%21 = load i8*, i8** %4
store i8* %21, i8** %2
br label %22
22: ; preds = %20, %13, %8
%23 = load i8*, i8** %2
ret i8* %23
}

LLVM IR (-O2):
define i8* @basename(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i8* @strdup(i8* %0)
%5 = icmp eq i8* %4, null
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i8* @strrchr(i8* %4, i8 signext 46)
%8 = icmp eq i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %6
store i8 0, i8* %7
br label %10
10: ; preds = %6, %9, %3, %1
%11 = phi i8* [ null, %1 ], [ null, %3 ], [ %4, %9 ], [ %4, %6 ]
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int gotoxy(int x, int y) {
  printf("\033[%d;%df", y, x);
  return 0;
}


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

x86 assembly (clang, -O2):
<gotoxy>:
push   %rax
mov    %edi,%edx
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"\1B[%d;%df\00"
define i32 @gotoxy(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"\1B[%d;%df\00"
define i32 @gotoxy(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %0)
ret i32 0
}
int mod(int i) {
  if (i < 0)
    return (-1 * i);
  return (i);
}


x86 assembly (clang, -O0):
<mod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1120 <mod+0x20>
imul   $0xffffffff,-0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1126 <mod+0x26>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @mod(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 -1, %7
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 @mod(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ memcheck(void *);
void *calloc_chk(size_t num, size_t elementSize) {
  void *tmp = calloc(num, elementSize);
  memcheck(tmp);
  return tmp;
}


x86 assembly (clang, -O0):
<calloc_chk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <memcheck@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calloc_chk>:
push   %rbx
call   1030 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <memcheck@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @calloc_chk(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i8* @calloc(i64 %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = call i32 @memcheck(i8* %9)
%11 = load i8*, i8** %5
ret i8* %11
}

LLVM IR (-O2):
define i8* @calloc_chk(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = tail call i32 @memcheck(i8* %3)
ret i8* %3
}
int swap_enable_nonboot_cpus_unlock(struct cpumask *mask) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.cpumask = type opaque
define i32 @swap_enable_nonboot_cpus_unlock(%struct.cpumask* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void abend(const char *r, int e, const char *s) { abort(); }


x86 assembly (clang, -O0):
<abend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<abend>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @abend(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @abend(i8* nocapture readnone %0, i32 %1, i8* nocapture readnone %2) {
%4 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int wiggle_leds_tir(int /*<<< orphan*/, unsigned char);
bool turn_led_off_tir(unsigned char leds) {
  leds &= 0xf0;
  return wiggle_leds_tir(0, leds);
}


x86 assembly (clang, -O0):
<turn_led_off_tir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0xf0,%eax
mov    %al,-0x1(%rbp)
xor    %edi,%edi
movzbl -0x1(%rbp),%esi
call   1030 <wiggle_leds_tir@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<turn_led_off_tir>:
mov    %edi,%esi
and    $0xfffffff0,%esi
xor    %edi,%edi
jmp    1030 <wiggle_leds_tir@plt>

LLVM IR (-O0):
define i32 @turn_led_off_tir(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 240
%6 = trunc i32 %5 to i8
store i8 %6, i8* %2
%7 = load i8, i8* %2
%8 = call i32 @wiggle_leds_tir(i32 0, i8 zeroext %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @turn_led_off_tir(i8 zeroext %0) {
%2 = and i8 %0, -16
%3 = tail call i32 @wiggle_leds_tir(i32 0, i8 zeroext %2)
ret i32 %3
}
int fun490() { return 490; }


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

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

LLVM IR (-O0):
define i32 @fun490() {
ret i32 490
}

LLVM IR (-O2):
define i32 @fun490() {
ret i32 490
}
/* Variables and functions */
int execlp(char const *, char const *, char const *, void *);
int /*<<< orphan*/ g_mk_socket_path(int /*<<< orphan*/);
int /*<<< orphan*/ g_rm_temp_dir();
int g_execlp3(const char *a1, const char *a2, const char *a3) {
  int rv;
  g_rm_temp_dir();
  rv = execlp(a1, a2, a3, (void *)0);
  g_mk_socket_path(0);
  return rv;
}


x86 assembly (clang, -O0):
<g_execlp3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <g_rm_temp_dir@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1050 <execlp@plt>
mov    %eax,-0x1c(%rbp)
xor    %edi,%edi
call   1040 <g_mk_socket_path@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_execlp3>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <g_rm_temp_dir@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %ecx,%ecx
call   1050 <execlp@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   1040 <g_mk_socket_path@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @g_execlp3(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = call i32 (...) @g_rm_temp_dir()
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = call i32 @execlp(i8* %9, i8* %10, i8* %11, i8* null)
store i32 %12, i32* %7
%13 = call i32 @g_mk_socket_path(i32 0)
%14 = load i32, i32* %7
ret i32 %14
}

LLVM IR (-O2):
define i32 @g_execlp3(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 (...) @g_rm_temp_dir()
%5 = tail call i32 @execlp(i8* %0, i8* %1, i8* %2, i8* null)
%6 = tail call i32 @g_mk_socket_path(i32 0)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ bar(int *);
void foo() {
  int i, j;
#pragma omp parallel for ordered(1)
  for (i = 0; i < 100; ++i) {
#pragma omp ordered depend(sink : i - 1)
    bar(&i);
#pragma omp ordered depend(source)
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jge    1140 <foo+0x30>
lea    -0x4(%rbp),%rdi
call   1030 <bar@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <foo+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <bar@plt>
mov    0xc(%rsp),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
cmp    $0x63,%eax
jl     1130 <foo+0x20>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @foo() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %0, %3
%4 = call i32 @bar(i32* %1)
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 1
store i32 %6, i32* %1
%7 = icmp slt i32 %5, 99
br i1 %7, label %3, label %8
8: ; preds = %3
ret void
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int stat(char const *, struct stat *);
int run_stat(const char *path, struct stat *sp) {
  if (stat(path, sp) == -1) {
    perror("stat");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<run_stat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0xffffffff,%eax
jne    115e <run_stat+0x3e>
lea    0xeb3(%rip),%rdi
call   1040 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1165 <run_stat+0x45>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_stat>:
push   %rax
call   1030 <stat@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
je     1131 <run_stat+0x11>
pop    %rcx
ret
lea    0xec8(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [5 x i8] c"stat\00"
define i32 @run_stat(i8* nocapture %0, %struct.stat* nocapture %1) {
%3 = tail call i32 @stat(i8* %0, %struct.stat* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ 1, %5 ], [ 0, %2 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ Pow(long, int);
int /*<<< orphan*/ printf(char *, long, int, int /*<<< orphan*/);
int main() {
  long int X = 5;
  int N = 4;
  printf("Pow(%ld,%d)=%ld\n", X, N, Pow(X, N));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x5,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <Pow@plt>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    %eax,%ecx
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [17 x i8] c"Pow(%ld,%d)=%ld\0A\00"
define i32 @main() {
%1 = tail call i32 @Pow(i64 5, i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 5, i32 4, i32 %1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fread(char *, int, unsigned int, int /*<<< orphan*/ *);
int stdio_read(void *rctxt, char *dst, unsigned len) {
  return fread(dst, 1, len, (FILE *)rctxt);
}


x86 assembly (clang, -O0):
<stdio_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdio_read>:
mov    %rdi,%rcx
mov    %rsi,%rdi
mov    $0x1,%esi
jmp    1030 <fread@plt>

LLVM IR (-O0):
define i32 @stdio_read(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %5
%8 = load i32, i32* %6
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
%11 = call i32 @fread(i8* %7, i32 1, i32 %8, i32* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @stdio_read(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = bitcast i8* %0 to i32*
%5 = tail call i32 @fread(i8* %1, i32 1, i32 %2, i32* %4)
ret i32 %5
}
void tr5(short array[], int n) {
  int x;
  if (n > 0)
    for (x = 0; x < n; x++)
      array[x] = 0;
}


x86 assembly (clang, -O0):
<tr5>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1149 <tr5+0x49>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1144 <tr5+0x44>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movw   $0x0,(%rax,%rcx,2)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    111c <tr5+0x1c>
jmp    1149 <tr5+0x49>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tr5>:
test   %esi,%esi
jle    1125 <tr5+0x15>
push   %rax
mov    %esi,%edx
add    %rdx,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @tr5(i16* %0, i32 %1) {
%3 = alloca i16*
%4 = alloca i32
%5 = alloca i32
store i16* %0, i16** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %22
8: ; preds = %2
store i32 0, i32* %5
br label %9
9: ; preds = %18, %8
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %21
13: ; preds = %9
%14 = load i16*, i16** %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i16, i16* %14, i64 %16
store i16 0, i16* %17
br label %18
18: ; preds = %13
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %9
21: ; preds = %9
br label %22
22: ; preds = %21, %2
ret void
}

LLVM IR (-O2):
define void @tr5(i16* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = bitcast i16* %0 to i8*
%6 = zext i32 %1 to i64
%7 = shl nuw nsw i64 %6, 1
br label %8
8: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("subthread_create test skipped\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [30 x i8] c"subthread_create test skipped\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef char uint8_t;

/* Variables and functions */
uint8_t Char2Int(char hex) {
  if ('0' <= hex <= '9')
    return hex - '0';
  else if ('A' <= hex <= 'F')
    return hex - 'A' + 10;
  else if ('a' <= hex <= 'f')
    return hex - 'a' + 10;
  else
    return 255;
}


x86 assembly (clang, -O0):
<Char2Int>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x39,%eax
jg     1135 <Char2Int+0x35>
movsbl -0x2(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x1(%rbp)
jmp    1195 <Char2Int+0x95>
movsbl -0x2(%rbp),%ecx
mov    $0x41,%eax
cmp    %ecx,%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x46,%eax
jg     1163 <Char2Int+0x63>
movsbl -0x2(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %al,-0x1(%rbp)
jmp    1195 <Char2Int+0x95>
movsbl -0x2(%rbp),%ecx
mov    $0x61,%eax
cmp    %ecx,%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x66,%eax
jg     1191 <Char2Int+0x91>
movsbl -0x2(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %al,-0x1(%rbp)
jmp    1195 <Char2Int+0x95>
movb   $0xff,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Char2Int>:
lea    -0x30(%rdi),%eax
ret

LLVM IR (-O0):
define signext i8 @Char2Int(i8 signext %0) {
%2 = alloca i8
%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
%7 = zext i1 %6 to i32
%8 = icmp sle i32 %7, 57
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = sub nsw i32 %11, 48
%13 = trunc i32 %12 to i8
store i8 %13, i8* %2
br label %39
14: ; preds = %1
%15 = load i8, i8* %3
%16 = sext i8 %15 to i32
%17 = icmp sle i32 65, %16
%18 = zext i1 %17 to i32
%19 = icmp sle i32 %18, 70
br i1 %19, label %20, label %26
20: ; preds = %14
%21 = load i8, i8* %3
%22 = sext i8 %21 to i32
%23 = sub nsw i32 %22, 65
%24 = add nsw i32 %23, 10
%25 = trunc i32 %24 to i8
store i8 %25, i8* %2
br label %39
26: ; preds = %14
%27 = load i8, i8* %3
%28 = sext i8 %27 to i32
%29 = icmp sle i32 97, %28
%30 = zext i1 %29 to i32
%31 = icmp sle i32 %30, 102
br i1 %31, label %32, label %38
32: ; preds = %26
%33 = load i8, i8* %3
%34 = sext i8 %33 to i32
%35 = sub nsw i32 %34, 97
%36 = add nsw i32 %35, 10
%37 = trunc i32 %36 to i8
store i8 %37, i8* %2
br label %39
38: ; preds = %26
store i8 -1, i8* %2
br label %39
39: ; preds = %38, %32, %20, %9
%40 = load i8, i8* %2
ret i8 %40
}

LLVM IR (-O2):
define signext i8 @Char2Int(i8 signext %0) {
%2 = add i8 %0, -48
ret i8 %2
}
void reverse(char *begin, char *end) {
  char temp;
  while (begin < end) {
    temp = *begin;
    *begin = *end;
    *end = temp;
    begin++;
    end--;
  }
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1155 <reverse+0x55>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <reverse+0xc>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
cmp    %rsi,%rdi
jae    112c <reverse+0x2c>
add    $0xffffffffffffffff,%rsi
nopl   0x0(%rax)
movzbl (%rdi),%eax
movzbl 0x1(%rsi),%ecx
mov    %cl,(%rdi)
mov    %al,0x1(%rsi)
add    $0x1,%rdi
lea    -0x1(%rsi),%rax
cmp    %rsi,%rdi
mov    %rax,%rsi
jb     1110 <reverse+0x10>
ret

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

LLVM IR (-O2):
define void @reverse(i8* %0, i8* %1) {
%3 = icmp ult i8* %0, %1
br i1 %3, label %4, label %12
4: ; preds = %2, %4
%5 = phi i8* [ %9, %4 ], [ %0, %2 ]
%6 = phi i8* [ %10, %4 ], [ %1, %2 ]
%7 = load i8, i8* %5
%8 = load i8, i8* %6
store i8 %8, i8* %5
store i8 %7, i8* %6
%9 = getelementptr inbounds i8, i8* %5, i64 1
%10 = getelementptr inbounds i8, i8* %6, i64 -1
%11 = icmp ult i8* %9, %10
br i1 %11, label %4, label %12
12: ; preds = %4, %2
ret void
}
/* Variables and functions */
int pow(double, int);
int sin(int);
double note(int q, double st) {
  double semi = pow(2, 1.0 / 12.0);
  return 128 * (1 + sin((1 << (q / 12)) * pow(semi, q % 12) * st));
}


x86 assembly (clang, -O0):
<note>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  0xec8(%rip),%xmm0
xor    %edi,%edi
call   1040 <pow@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x1c(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x4(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
add    $0x1,%eax
shl    $0x7,%eax
cvtsi2sd %eax,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<note>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
mov    %edi,%ebx
movsd  0xecb(%rip),%xmm0
xor    %edi,%edi
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movslq %ebx,%rdi
imul   $0x2aaaaaab,%rdi,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x21,%rbx
add    %eax,%ebx
lea    0x0(,%rbx,4),%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edi
call   1040 <pow@plt>
mov    %ebx,%ecx
shl    %cl,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x8(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
shl    $0x7,%eax
sub    $0xffffff80,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @note(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%6 = call i32 @pow(double 2.000000e+00, i32 0)
%7 = sitofp i32 %6 to double
store double %7, double* %5
%8 = load i32, i32* %3
%9 = sdiv i32 %8, 12
%10 = shl i32 1, %9
%11 = load double, double* %5
%12 = load i32, i32* %3
%13 = srem i32 %12, 12
%14 = call i32 @pow(double %11, i32 %13)
%15 = mul nsw i32 %10, %14
%16 = sitofp i32 %15 to double
%17 = load double, double* %4
%18 = fmul double %16, %17
%19 = fptosi double %18 to i32
%20 = call i32 @sin(i32 %19)
%21 = add nsw i32 1, %20
%22 = mul nsw i32 128, %21
%23 = sitofp i32 %22 to double
ret double %23
}

LLVM IR (-O2):
define double @note(i32 %0, double %1) {
%3 = tail call i32 @pow(double 2.000000e+00, i32 0)
%4 = sitofp i32 %3 to double
%5 = sdiv i32 %0, 12
%6 = srem i32 %0, 12
%7 = tail call i32 @pow(double %4, i32 %6)
%8 = shl i32 %7, %5
%9 = sitofp i32 %8 to double
%10 = fmul double %9, %1
%11 = fptosi double %10 to i32
%12 = tail call i32 @sin(i32 %11)
%13 = shl i32 %12, 7
%14 = add i32 %13, 128
%15 = sitofp i32 %14 to double
ret double %15
}
/* Variables and functions */
scalar_t__ atof(char const *);
float crStrToFloat(const char *str) {
  if (!str)
    return 0.0f;
  return (float)atof(str);
}


x86 assembly (clang, -O0):
<crStrToFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <crStrToFloat+0x24>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1147 <crStrToFloat+0x37>
mov    -0x10(%rbp),%rdi
call   1030 <atof@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crStrToFloat>:
test   %rdi,%rdi
je     1125 <crStrToFloat+0x15>
push   %rax
call   1030 <atof@plt>
cvtsi2ss %rax,%xmm0
add    $0x8,%rsp
ret
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @crStrToFloat(i8* %0) {
%2 = alloca float
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
store float 0.000000e+00, float* %2
br label %11
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i64 @atof(i8* %8)
%10 = sitofp i64 %9 to float
store float %10, float* %2
br label %11
11: ; preds = %7, %6
%12 = load float, float* %2
ret float %12
}

LLVM IR (-O2):
define float @crStrToFloat(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i64 @atof(i8* %0)
%5 = sitofp i64 %4 to float
br label %6
6: ; preds = %1, %3
%7 = phi float [ %5, %3 ], [ 0.000000e+00, %1 ]
ret float %7
}
/* Variables and functions */
int main() {
  int *pi;
  int *t;
  int a = *t;
  pi = NULL;
  int c = *pi;
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

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 = load i32*, i32** %3
%7 = load i32, i32* %6
store i32 %7, i32* %4
store i32* null, i32** %2
%8 = load i32*, i32** %2
%9 = load i32, i32* %8
store i32 %9, i32* %5
ret i32 1
}

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
/* Variables and functions */
int EXIT_FAILURE;
int /*<<< orphan*/ printf(char *, char *);
int failure(char *msg) {
  printf("Error : %s\n", msg);
  return (EXIT_FAILURE);
}


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

x86 assembly (clang, -O2):
<failure>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eb9(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"Error : %s\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @failure(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = load i32, i32* @EXIT_FAILURE
ret i32 %3
}
/* Variables and functions */
unsigned long native_save_flags();
unsigned long arch_local_save_flags(void) { return native_save_flags(); }


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

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

LLVM IR (-O0):
define i64 @arch_local_save_flags() {
%1 = call i64 (...) @native_save_flags()
ret i64 %1
}

LLVM IR (-O2):
define i64 @arch_local_save_flags() {
%1 = tail call i64 (...) @native_save_flags()
ret i64 %1
}
/* Variables and functions */
int /*<<< orphan*/ MIPS_CLEAR_BIT(int, int);
void xburst_cgm_lpcr_pd_scpu_up() { MIPS_CLEAR_BIT((0xB0000000 + 0x4), 31); }


x86 assembly (clang, -O0):
<xburst_cgm_lpcr_pd_scpu_up>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb0000004,%edi
mov    $0x1f,%esi
call   1030 <MIPS_CLEAR_BIT@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<xburst_cgm_lpcr_pd_scpu_up>:
mov    $0xb0000004,%edi
mov    $0x1f,%esi
jmp    1030 <MIPS_CLEAR_BIT@plt>

LLVM IR (-O0):
define void @xburst_cgm_lpcr_pd_scpu_up() {
%1 = call i32 @MIPS_CLEAR_BIT(i32 -1342177276, i32 31)
ret void
}

LLVM IR (-O2):
define void @xburst_cgm_lpcr_pd_scpu_up() {
%1 = tail call i32 @MIPS_CLEAR_BIT(i32 -1342177276, i32 31)
ret void
}
void free_page() {}


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

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

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

LLVM IR (-O2):
define void @free_page() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ DisplayColourArea(unsigned char, unsigned char,
                                     int /*<<< orphan*/, int);
void DisplayColour(unsigned char BackgroundColour,
                   unsigned char ForegroundColour) {
  DisplayColourArea(BackgroundColour, ForegroundColour, 0, 2000);
}


x86 assembly (clang, -O0):
<DisplayColour>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    -0x1(%rbp),%al
xor    %edx,%edx
mov    $0x7d0,%ecx
movzbl %al,%edi
movzbl -0x2(%rbp),%esi
call   1030 <DisplayColourArea@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DisplayColour>:
xor    %edx,%edx
mov    $0x7d0,%ecx
jmp    1030 <DisplayColourArea@plt>

LLVM IR (-O0):
define void @DisplayColour(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = load i8, i8* %4
%7 = call i32 @DisplayColourArea(i8 zeroext %5, i8 zeroext %6, i32 0, i32 2000)
ret void
}

LLVM IR (-O2):
define void @DisplayColour(i8 zeroext %0, i8 zeroext %1) {
%3 = tail call i32 @DisplayColourArea(i8 zeroext %0, i8 zeroext %1, i32 0, i32 2000)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char const *);
char *forced_strcpy(char *dst, const char *src) {
  strcpy(dst, src);
  asm volatile("" : : "m"(dst));
  ;
  return dst;
}


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

x86 assembly (clang, -O2):
<forced_strcpy>:
push   %rax
mov    %rdi,(%rsp)
call   1030 <strcpy@plt>
mov    (%rsp),%rax
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @forced_strcpy(i8* %0, i8* %1) {
%3 = alloca i8*
store i8* %0, i8** %3
%4 = tail call i32 @strcpy(i8* %0, i8* %1)
%5 = load i8*, i8** %3
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ a_barrier();
int a_ll(int volatile *);
int /*<<< orphan*/ a_post_llsc();
int /*<<< orphan*/ a_sc(int volatile *, int);
int a_swap(volatile int *p, int v) {
  int old;
  a_barrier();
  do
    old = a_ll(p);
  while (!a_sc(p, v));
  a_post_llsc();
  return old;
}


x86 assembly (clang, -O0):
<a_swap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1040 <a_barrier@plt>
mov    -0x8(%rbp),%rdi
call   1060 <a_ll@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <a_sc@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1156 <a_swap+0x16>
mov    $0x0,%al
call   1030 <a_post_llsc@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_swap>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <a_barrier@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1060 <a_ll@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <a_sc@plt>
test   %eax,%eax
je     1160 <a_swap+0x20>
xor    %eax,%eax
call   1030 <a_post_llsc@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @a_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 = call i32 (...) @a_barrier()
br label %7
7: ; preds = %10, %2
%8 = load i32*, i32** %3
%9 = call i32 @a_ll(i32* %8)
store i32 %9, i32* %5
br label %10
10: ; preds = %7
%11 = load i32*, i32** %3
%12 = load i32, i32* %4
%13 = call i32 @a_sc(i32* %11, i32 %12)
%14 = icmp ne i32 %13, 0
%15 = xor i1 %14, true
br i1 %15, label %7, label %16
16: ; preds = %10
%17 = call i32 (...) @a_post_llsc()
%18 = load i32, i32* %5
ret i32 %18
}

LLVM IR (-O2):
define i32 @a_swap(i32* %0, i32 %1) {
%3 = tail call i32 (...) @a_barrier()
br label %4
4: ; preds = %4, %2
%5 = tail call i32 @a_ll(i32* %0)
%6 = tail call i32 @a_sc(i32* %0, i32 %1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %4, label %8
8: ; preds = %4
%9 = tail call i32 (...) @a_post_llsc()
ret i32 %5
}