xunge/DecIR huggingface dataset:
/* Variables and functions */
double cos(double);
char *gettext(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, double *);
double Coseno(double a) {
  printf(gettext("Enter a number: "));
  scanf("%lf", &a);
  return (cos(a));
}


x86 assembly (clang, -O0):
<Coseno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
lea    0xeac(%rip),%rdi
call   1030 <gettext@plt>
mov    %rax,%rdi
call   1040 <printf@plt>
lea    0xea9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movsd  -0x8(%rbp),%xmm0
call   1060 <cos@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Coseno>:
push   %rax
movsd  %xmm0,(%rsp)
lea    0xeb3(%rip),%rdi
call   1030 <gettext@plt>
mov    %rax,%rdi
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
movsd  (%rsp),%xmm0
call   1060 <cos@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [4 x i8] c"%lf\00"
define double @Coseno(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call i8* @gettext(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* %3)
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%6 = load double, double* %2
%7 = call double @cos(double %6)
ret double %7
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [4 x i8] c"%lf\00"
define double @Coseno(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = tail call i8* @gettext(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) %3)
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%6 = load double, double* %2
%7 = call double @cos(double %6)
ret double %7
}
/* Variables and functions */
int getopt(int, char **, char *);
int optind;
int get_verbose(char **argv, int argc) {
  int c;
  int verbose = 0;
  while ((c = getopt(argc, argv, "v")) != -1) {
    switch (c) {
    case 'v':
      verbose = 1;
      break;
    default:
      break;
    }
  }
  optind = 1;
  return verbose;
}


x86 assembly (clang, -O0):
<get_verbose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
lea    0xecc(%rip),%rdx
call   1030 <getopt@plt>
mov    %eax,-0x10(%rbp)
cmp    $0xffffffff,%eax
je     116c <get_verbose+0x5c>
mov    -0x10(%rbp),%eax
sub    $0x76,%eax
jne    1162 <get_verbose+0x52>
jmp    1156 <get_verbose+0x46>
movl   $0x1,-0x14(%rbp)
jmp    1167 <get_verbose+0x57>
jmp    1167 <get_verbose+0x57>
jmp    1126 <get_verbose+0x16>
mov    0x2e75(%rip),%rax
movl   $0x1,(%rax)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_verbose>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%rbp
xor    %r14d,%r14d
lea    0xeda(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %r15,%rdx
call   1030 <getopt@plt>
cmp    $0x76,%eax
je     1149 <get_verbose+0x39>
cmp    $0xffffffff,%eax
jne    1130 <get_verbose+0x20>
jmp    1151 <get_verbose+0x41>
mov    $0x1,%r14d
jmp    1130 <get_verbose+0x20>
mov    0x2e90(%rip),%rax
movl   $0x1,(%rax)
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"v\00"
@optind = global i32 0
define i32 @get_verbose(i8** %0, i32 %1) {
br label %3
3: ; preds = %5, %2
%4 = phi i32 [ 0, %2 ], [ 1, %5 ]
br label %5
5: ; preds = %3, %5
%6 = tail call i32 @getopt(i32 %1, i8** %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
switch i32 %6, label %5 [
i32 -1, label %7
i32 118, label %3
]
7: ; preds = %5
store i32 1, i32* @optind
ret i32 %4
}
/* Variables and functions */
int mul(int, int, double);
int difference(int a, int b) { return a - mul(a, b + 1, 3.14); }


x86 assembly (clang, -O0):
<difference>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
movsd  0xecb(%rip),%xmm0
call   1030 <mul@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<difference>:
push   %rbx
mov    %edi,%ebx
add    $0x1,%esi
movsd  0xee2(%rip),%xmm0
call   1030 <mul@plt>
sub    %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @difference(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = add nsw i32 %7, 1
%9 = call i32 @mul(i32 %6, i32 %8, double 3.140000e+00)
%10 = sub nsw i32 %5, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @difference(i32 %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call i32 @mul(i32 %0, i32 %3, double 3.140000e+00)
%5 = sub nsw i32 %0, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int scanf(char *, int *);
int main() {
  int n;
  while (scanf("%d", &n) == 1) {
    if (n == 0)
      break;
    printf("1/2\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    1168 <main+0x48>
cmpl   $0x0,-0x8(%rbp)
jne    1157 <main+0x37>
jmp    1168 <main+0x48>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    117f <main+0x5f>
cmpl   $0x0,0xc(%rsp)
je     117f <main+0x5f>
lea    0xeb6(%rip),%r14
lea    0xeac(%rip),%r15
lea    0xc(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    117f <main+0x5f>
cmpl   $0x0,0xc(%rsp)
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [4 x i8] c"1/2\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = icmp ne i32 %3, 1
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 0
%7 = select i1 %4, i1 true, i1 %6
br i1 %7, label %15, label %8
8: ; preds = %0, %8
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%11 = icmp ne i32 %10, 1
%12 = load i32, i32* %1
%13 = icmp eq i32 %12, 0
%14 = select i1 %11, i1 true, i1 %13
br i1 %14, label %15, label %8
15: ; preds = %8, %0
ret i32 0
}
/* Variables and functions */
double log(double);
double sqrt(double);
double f(double x) { return (sqrt(x) + log(x)) / 3.0; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  0xea6(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
sub    $0x18,%rsp
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jb     113b <f+0x1b>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    1150 <f+0x30>
movapd %xmm1,%xmm0
movsd  %xmm1,0x10(%rsp)
call   1040 <sqrt@plt>
movsd  0x10(%rsp),%xmm1
movsd  %xmm0,0x8(%rsp)
movapd %xmm1,%xmm0
call   1030 <log@plt>
addsd  0x8(%rsp),%xmm0
divsd  0xe93(%rip),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @f(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @sqrt(double %3)
%5 = load double, double* %2
%6 = call double @log(double %5)
%7 = fadd double %4, %6
%8 = fdiv double %7, 3.000000e+00
ret double %8
}

LLVM IR (-O2):
define double @f(double %0) {
%2 = tail call double @sqrt(double %0)
%3 = tail call double @log(double %0)
%4 = fadd double %2, %3
%5 = fdiv double %4, 3.000000e+00
ret double %5
}
void plustospace(char *str) {
  register int x;
  for (x = 0; str[x]; x++)
    if (str[x] == '+')
      str[x] = ' ';
}


x86 assembly (clang, -O0):
<plustospace>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1155 <plustospace+0x55>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2b,%eax
jne    1142 <plustospace+0x42>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
jmp    1147 <plustospace+0x47>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <plustospace+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<plustospace>:
jmp    1117 <plustospace+0x17>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x20,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x2b,%al
je     1110 <plustospace+0x10>
test   %al,%al
jne    1113 <plustospace+0x13>
ret

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

LLVM IR (-O2):
define void @plustospace(i8* nocapture %0) {
br label %2
2: ; preds = %7, %1
%3 = phi i64 [ %8, %7 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
switch i8 %5, label %7 [
i8 0, label %9
i8 43, label %6
]
6: ; preds = %2
store i8 32, i8* %4
br label %7
7: ; preds = %2, %6
%8 = add nuw i64 %3, 1
br label %2
9: ; preds = %2
ret void
}
void delay_ms(unsigned int Time) {
  unsigned int i, j, t;
  t = Time;
  for (i = 0; i < t; i++) {
    for (j = 0; j < 125; j++)
      ;
  }
}


x86 assembly (clang, -O0):
<delay_ms>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    1157 <delay_ms+0x57>
movl   $0x0,-0xc(%rbp)
cmpl   $0x7d,-0xc(%rbp)
jae    1144 <delay_ms+0x44>
jmp    1136 <delay_ms+0x36>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <delay_ms+0x27>
jmp    1149 <delay_ms+0x49>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1114 <delay_ms+0x14>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @delay_ms(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void *malloc(size_t);
int /*<<< orphan*/ printf(char *, size_t);
void *die_malloc(size_t size) {
  void *mem = malloc(size);
  if (mem == NULL) {
    printf("Failed to allocate %lu bytes. Exiting", size);
    exit(1);
  }
  return mem;
}


x86 assembly (clang, -O0):
<die_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116e <die_malloc+0x3e>
mov    -0x8(%rbp),%rsi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<die_malloc>:
push   %rbx
mov    %rdi,%rbx
call   1040 <malloc@plt>
test   %rax,%rax
je     1140 <die_malloc+0x10>
pop    %rbx
ret
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"Failed to allocate %lu bytes. Exiting\00"
define i8* @die_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i64, i64* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i64 %9)
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@.str = [38 x i8] c"Failed to allocate %lu bytes. Exiting\00"
define noalias i8* @die_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i64 %0)
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ usagemessage();
int /*<<< orphan*/ vprintf(char *, int /*<<< orphan*/);
void vcustomerror(char *fmt, va_list vl) {
  vprintf(fmt, vl);
  usagemessage();
  printf("Press key to exit.\n");
  getchar();
  exit(-1);
}


x86 assembly (clang, -O0):
<vcustomerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <vprintf@plt>
mov    $0x0,%al
call   1030 <usagemessage@plt>
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<vcustomerror>:
push   %rax
call   1060 <vprintf@plt>
xor    %eax,%eax
call   1040 <usagemessage@plt>
lea    0xe9c(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Press key to exit.\0A\00"
define void @vcustomerror(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @vprintf(i8* %5, i32 %6)
%8 = call i32 (...) @usagemessage()
%9 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @getchar()
%11 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@str = [19 x i8] c"Press key to exit.\00"
define void @vcustomerror(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @vprintf(i8* %0, i32 %1)
%4 = tail call i32 (...) @usagemessage()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (...) @getchar()
%7 = tail call i32 @exit(i32 -1)
unreachable
}
/* Type definitions */
typedef char *uint64_t;

/* Variables and functions */
uint64_t ROL64_61(uint64_t x) {
  __asm__("rolq $61, %0" : "=r"(x) : "0"(x));
  return x;
}


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

x86 assembly (clang, -O2):
<ROL64_61>:
mov    %rdi,%rax
rol    $0x3d,%rax
ret

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

LLVM IR (-O2):
define i8* @ROL64_61(i8* readnone %0) {
%2 = tail call i8* asm "rolq $$61, $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret i8* %2
}
/* Variables and functions */
int strerror_r(int, char *, size_t);
int sys_xsi_strerror_r(int errnum, char *buf, size_t buflen) {
  return strerror_r(errnum, buf, buflen);
}


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

x86 assembly (clang, -O2):
<sys_xsi_strerror_r>:
jmp    1030 <strerror_r@plt>

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

LLVM IR (-O2):
define i32 @sys_xsi_strerror_r(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 @strerror_r(i32 %0, i8* %1, i64 %2)
ret i32 %4
}
int vde_chain_nm4_n_out(void) { return 3; }


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

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

LLVM IR (-O0):
define i32 @vde_chain_nm4_n_out() {
ret i32 3
}

LLVM IR (-O2):
define i32 @vde_chain_nm4_n_out() {
ret i32 3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void die(char *msg) {
  printf("%s\n", msg);
  exit(-1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @die(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 -1)
unreachable
}
/* Type definitions */
typedef void timer_t;

/* Variables and functions */
void *thread_timer(void *arg) {
  timer_t *time;
  return time;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @thread_timer(i8* nocapture readnone %0) {
ret i8* undef
}
int is_white_space(char c) {
  switch (c) {
  case ' ':
  case '\t':
  case '\r':
  case '\n':
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_white_space>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xfffffff7,%eax
sub    $0x2,%eax
jb     1144 <is_white_space+0x44>
jmp    1122 <is_white_space+0x22>
mov    -0xc(%rbp),%eax
sub    $0xd,%eax
je     1144 <is_white_space+0x44>
jmp    1133 <is_white_space+0x33>
mov    -0xc(%rbp),%eax
sub    $0x20,%eax
jne    1150 <is_white_space+0x50>
jmp    1144 <is_white_space+0x44>
movl   $0x1,-0x4(%rbp)
jmp    1157 <is_white_space+0x57>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_white_space>:
cmp    $0x20,%edi
ja     111d <is_white_space+0x1d>
mov    $0x1,%eax
mov    %edi,%ecx
movabs $0x100002600,%rdx
bt     %rcx,%rdx
jae    111d <is_white_space+0x1d>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @is_white_space(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
switch i32 %5, label %7 [
i32 32, label %6
i32 9, label %6
i32 13, label %6
i32 10, label %6
]
6: ; preds = %1, %1, %1, %1
store i32 1, i32* %2
br label %8
7: ; preds = %1
store i32 0, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @is_white_space(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %3 [
i32 32, label %4
i32 9, label %4
i32 13, label %4
i32 10, label %4
]
3: ; preds = %1
br label %4
4: ; preds = %1, %1, %1, %1, %3
%5 = phi i32 [ 0, %3 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %5
}
void video_exit(void) {}


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

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

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

LLVM IR (-O2):
define void @video_exit() {
ret void
}
/* Variables and functions */
int __raw_readb(int);
int board_is_ts7260(void) { return __raw_readb(0xfebff000) == 0x02; }


x86 assembly (clang, -O0):
<board_is_ts7260>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfebff000,%edi
call   1030 <__raw_readb@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<board_is_ts7260>:
push   %rax
mov    $0xfebff000,%edi
call   1030 <__raw_readb@plt>
xor    %ecx,%ecx
cmp    $0x2,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @board_is_ts7260() {
%1 = call i32 @__raw_readb(i32 -20975616)
%2 = icmp eq i32 %1, 2
%3 = zext i1 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
define i32 @board_is_ts7260() {
%1 = tail call i32 @__raw_readb(i32 -20975616)
%2 = icmp eq i32 %1, 2
%3 = zext i1 %2 to i32
ret i32 %3
}
double yardsToCentimetres(double yards) { return yards * 91.44; }


x86 assembly (clang, -O0):
<yardsToCentimetres>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<yardsToCentimetres>:
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @yardsToCentimetres(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 0x4056DC28F5C28F5C
ret double %4
}

LLVM IR (-O2):
define double @yardsToCentimetres(double %0) {
%2 = fmul double %0, 0x4056DC28F5C28F5C
ret double %2
}
/* Variables and functions */
int yas_kxtf9_read_reg(unsigned char, unsigned char *, int);
int yas_kxtf9_read_reg_byte(unsigned char adr) {
  unsigned char buf;
  int err;
  err = yas_kxtf9_read_reg(adr, &buf, 1);
  if (err == 0) {
    return buf;
  }
  return 0;
}


x86 assembly (clang, -O0):
<yas_kxtf9_read_reg_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
lea    -0x6(%rbp),%rsi
mov    $0x1,%edx
movzbl -0x5(%rbp),%edi
call   1030 <yas_kxtf9_read_reg@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1149 <yas_kxtf9_read_reg_byte+0x39>
movzbl -0x6(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1150 <yas_kxtf9_read_reg_byte+0x40>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yas_kxtf9_read_reg_byte>:
push   %rax
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <yas_kxtf9_read_reg@plt>
xor    %ecx,%ecx
test   %eax,%eax
movzbl 0x7(%rsp),%eax
cmovne %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @yas_kxtf9_read_reg_byte(i8 zeroext %0) {
%2 = alloca i8
%3 = call i32 @yas_kxtf9_read_reg(i8 zeroext %0, i8* %2, i32 1)
%4 = icmp eq i32 %3, 0
%5 = load i8, i8* %2
%6 = zext i8 %5 to i32
%7 = select i1 %4, i32 %6, i32 0
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void recurse(int count) {
  if (count > 5) {
    return;
  }
  printf("Count = %d\n", count);
  recurse(count + 1);
}


x86 assembly (clang, -O0):
<recurse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
jle    113a <recurse+0x1a>
jmp    1154 <recurse+0x34>
mov    -0x4(%rbp),%esi
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1030 <recurse@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recurse>:
push   %r14
push   %rbx
push   %rax
cmp    $0x5,%edi
jg     1142 <recurse+0x32>
mov    %edi,%ebx
lea    0xede(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x6,%ebx
jne    1130 <recurse+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"Count = %d\0A\00"
define void @recurse(i32 %0) {
%2 = icmp sgt i32 %0, 5
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ %0, %1 ]
%5 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = add i32 %4, 1
%7 = icmp eq i32 %6, 6
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
bool errata_66(void) {
  if (*(uint32_t *)0x10000130ul == 0xAul) {
    if (*(uint32_t *)0x10000134ul == 0x0ul) {
      return true;
    }
    if (*(uint32_t *)0x10000134ul == 0x1ul) {
      return true;
    }
  }
  return true;
}


x86 assembly (clang, -O0):
<errata_66>:
push   %rbp
mov    %rsp,%rbp
mov    $0x10000130,%eax
movslq (%rax),%rax
cmp    $0xa,%rax
jne    1157 <errata_66+0x57>
mov    $0x10000134,%eax
movslq (%rax),%rax
cmp    $0x0,%rax
jne    1134 <errata_66+0x34>
movl   $0x1,-0x4(%rbp)
jmp    115e <errata_66+0x5e>
mov    $0x10000134,%eax
movslq (%rax),%rax
cmp    $0x1,%rax
jne    1152 <errata_66+0x52>
movl   $0x1,-0x4(%rbp)
jmp    115e <errata_66+0x5e>
jmp    1157 <errata_66+0x57>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @errata_66() {
%1 = alloca i32
%2 = load i32, i32* inttoptr (i64 268435760 to i32*)
%3 = sext i32 %2 to i64
%4 = icmp eq i64 %3, 10
br i1 %4, label %5, label %16
5: ; preds = %0
%6 = load i32, i32* inttoptr (i64 268435764 to i32*)
%7 = sext i32 %6 to i64
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %5
store i32 1, i32* %1
br label %17
10: ; preds = %5
%11 = load i32, i32* inttoptr (i64 268435764 to i32*)
%12 = sext i32 %11 to i64
%13 = icmp eq i64 %12, 1
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 1, i32* %1
br label %17
15: ; preds = %10
br label %16
16: ; preds = %15, %0
store i32 1, i32* %1
br label %17
17: ; preds = %16, %14, %9
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
define i32 @errata_66() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ IPC_RMID;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int semctl(int, int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ stderr;
void sem_rm(int id) {
  if (semctl(id, 0, IPC_RMID, (int)0) == -1) {
    fprintf(stderr,
            "Error: semaphore (Anforderungen) konnte nicht geloescht werden\n");
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<sem_rm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e93(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
mov    %ecx,%esi
call   1040 <semctl@plt>
cmp    $0xffffffff,%eax
jne    1178 <sem_rm+0x48>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
lea    0xe97(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sem_rm>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1040 <semctl@plt>
cmp    $0xffffffff,%eax
je     114a <sem_rm+0x1a>
pop    %rax
ret
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@IPC_RMID = global i32 0
@stderr = global i32 0
@.str = [64 x i8] c"Error: semaphore (Anforderungen) konnte nicht geloescht werden\0A\00"
define void @sem_rm(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @IPC_RMID
%5 = call i32 @semctl(i32 %3, i32 0, i32 %4, i32 0)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %1
ret void
}

LLVM IR (-O2):
@IPC_RMID = global i32 0
@stderr = global i32 0
@.str = [64 x i8] c"Error: semaphore (Anforderungen) konnte nicht geloescht werden\0A\00"
define void @sem_rm(i32 %0) {
%2 = load i32, i32* @IPC_RMID
%3 = tail call i32 @semctl(i32 %0, i32 0, i32 %2, i32 0)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 -1)
unreachable
9: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void Usage(const char *ProgramName) {
  fprintf(
      stderr,
      "%s:  This program must have exactly one argument, \"C\" to generate\n"
      "C or \"Intel\" to generate GCC i386/x86_64 assembly.\n",
      ProgramName);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<Usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<Usage>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [118 x i8] c"%s: This program must have exactly one argument, \22C\22 to generate\0AC or \22Intel\22 to generate GCC i386/x86_64 assembly.\0A\00"
@EXIT_FAILURE = global i32 0
define void @Usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([118 x i8], [118 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [118 x i8] c"%s: This program must have exactly one argument, \22C\22 to generate\0AC or \22Intel\22 to generate GCC i386/x86_64 assembly.\0A\00"
@EXIT_FAILURE = global i32 0
define void @Usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([118 x i8], [118 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ gfx_point(int, int);
void put_pixel(int x, int y) { gfx_point(x, y); }


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

x86 assembly (clang, -O2):
<put_pixel>:
jmp    1030 <gfx_point@plt>

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

LLVM IR (-O2):
define void @put_pixel(i32 %0, i32 %1) {
%3 = tail call i32 @gfx_point(i32 %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ umount(char *);
int flash_drive_umount(void) {
  umount("/mnt");
  return 1;
}


x86 assembly (clang, -O0):
<flash_drive_umount>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <umount@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flash_drive_umount>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <umount@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"/mnt\00"
define i32 @flash_drive_umount() {
%1 = call i32 @umount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@.str = [5 x i8] c"/mnt\00"
define i32 @flash_drive_umount() {
%1 = tail call i32 @umount(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 1
}
/* Variables and functions */
scalar_t__ Malloc(int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
int strlen(char const *);
char *Copy_String(const char *string) {
  char *new;
  int length;
  length = strlen(string) + 1;
  new = (char *)Malloc(length);
  memcpy(new, string, length);
  return new;
}


x86 assembly (clang, -O0):
<Copy_String>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <Malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <memcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Copy_String>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%ebp
mov    %ebp,%edi
call   1030 <Malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1050 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @Copy_String(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = call i64 @Malloc(i32 %8)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = load i8*, i8** %2
%13 = load i32, i32* %4
%14 = call i32 @memcpy(i8* %11, i8* %12, i32 %13)
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
define i8* @Copy_String(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i64 @Malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @memcpy(i8* %5, i8* %0, i32 %3)
ret i8* %5
}
void rng_frand_seed(struct anon$18 *rngh, unsigned int seed) {
  rng_urand_seed(rngh, seed);
}


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

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

LLVM IR (-O0):
%"struct.anon$18" = type opaque
define void @rng_frand_seed(%"struct.anon$18"* %0, i32 %1) {
%3 = alloca %"struct.anon$18"*
%4 = alloca i32
store %"struct.anon$18"* %0, %"struct.anon$18"** %3
store i32 %1, i32* %4
%5 = load %"struct.anon$18"*, %"struct.anon$18"** %3
%6 = load i32, i32* %4
%7 = call i32 (%"struct.anon$18"*, i32, ...) bitcast (i32 (...)* @rng_urand_seed to i32 (%"struct.anon$18"*, i32, ...)*)(%"struct.anon$18"* %5, i32 %6)
ret void
}

LLVM IR (-O2):
%"struct.anon$18" = type opaque
define void @rng_frand_seed(%"struct.anon$18"* %0, i32 %1) {
%3 = tail call i32 (%"struct.anon$18"*, i32, ...) bitcast (i32 (...)* @rng_urand_seed to i32 (%"struct.anon$18"*, i32, ...)*)(%"struct.anon$18"* %0, i32 %1)
ret void
}
/* Variables and functions */
double RAND_MAX;
double const rand();
double frand() {
  const double RMAX = 1.0 / RAND_MAX;
  return rand() * RMAX;
}


x86 assembly (clang, -O0):
<frand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  0xee0(%rip),%xmm0
mov    0x2ec1(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mulsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<frand>:
push   %rax
mov    0x2ed0(%rip),%rax
movsd  0xee0(%rip),%xmm0
divsd  (%rax),%xmm0
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define double @frand() {
%1 = alloca double
%2 = load double, double* @RAND_MAX
%3 = fdiv double 1.000000e+00, %2
store double %3, double* %1
%4 = call double (...) @rand()
%5 = load double, double* %1
%6 = fmul double %4, %5
ret double %6
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define double @frand() {
%1 = load double, double* @RAND_MAX
%2 = fdiv double 1.000000e+00, %1
%3 = tail call double (...) @rand()
%4 = fmul double %3, %2
ret double %4
}
/* Type definitions */
typedef int u_int64_t;
struct timespec {
  int tv_sec;
  int tv_nsec;
  int /*<<< orphan*/ member_1;
  int /*<<< orphan*/ member_0;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
u_int64_t current_time_ms() {
  struct timespec t = {0, 0};
  clock_gettime(CLOCK_MONOTONIC, &t);
  u_int64_t result = t.tv_sec * 1000 + t.tv_nsec / 1000 / 1000;
  return result;
}


x86 assembly (clang, -O0):
<current_time_ms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
imul   $0x3e8,-0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<current_time_ms>:
sub    $0x18,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <clock_gettime@plt>
imul   $0x3e8,(%rsp),%ecx
movslq 0x4(%rsp),%rax
imul   $0x431bde83,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x32,%rax
add    %edx,%eax
add    %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32, i32, i32 }
@CLOCK_MONOTONIC = global i32 0
define i32 @current_time_ms() {
%1 = alloca %struct.timespec
%2 = alloca i32
%3 = bitcast %struct.timespec* %1 to i8*
%4 = load i32, i32* @CLOCK_MONOTONIC
%5 = call i32 @clock_gettime(i32 %4, %struct.timespec* %1)
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 1000
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%10 = load i32, i32* %9
%11 = sdiv i32 %10, 1000
%12 = sdiv i32 %11, 1000
%13 = add nsw i32 %8, %12
store i32 %13, i32* %2
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32, i32, i32 }
@CLOCK_MONOTONIC = global i32 0
define i32 @current_time_ms() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%6 = load i32, i32* %5
%7 = mul nsw i32 %6, 1000
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%9 = load i32, i32* %8
%10 = sdiv i32 %9, 1000000
%11 = add nsw i32 %10, %7
ret i32 %11
}
/* Variables and functions */
char *calloc(int, int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int strlen(char *);
char *copy_argv(char *argv) {
  char *p;
  int n;
  n = strlen(argv);
  p = calloc(n + 1, sizeof(char));
  memcpy(p, argv, n);
  p[n] = 0;
  return p;
}


x86 assembly (clang, -O0):
<copy_argv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
add    $0x1,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <memcpy@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_argv>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %eax,%r15d
lea    0x1(%r15),%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1050 <memcpy@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @copy_argv(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = add nsw i32 %7, 1
%9 = call i8* @calloc(i32 %8, i32 1)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
%11 = load i8*, i8** %2
%12 = load i32, i32* %4
%13 = call i32 @memcpy(i8* %10, i8* %11, i32 %12)
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
store i8 0, i8* %17
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
define i8* @copy_argv(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @calloc(i32 %3, i32 1)
%5 = tail call i32 @memcpy(i8* %4, i8* %0, i32 %2)
%6 = sext i32 %2 to i64
%7 = getelementptr inbounds i8, i8* %4, i64 %6
store i8 0, i8* %7
ret i8* %4
}
int test_imm_DCuint16_reg(unsigned short val) {
  return ((val) & (-0xDC << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_DCuint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffff24,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_DCuint16_reg>:
test   $0xff24,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_DCuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -220
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
char *malloc(size_t);
char *Allocate(size_t size, size_t align) {
  char *p;
  size_t low;
  p = malloc(size + (align - 1));
  low = (size_t)p % align;
  if (low)
    return p + (align - low);
  else
    return p;
}


x86 assembly (clang, -O0):
<Allocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
sub    $0x1,%rax
add    %rax,%rdi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
mov    %rdx,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     116b <Allocate+0x5b>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    -0x28(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1173 <Allocate+0x63>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Allocate>:
push   %rbx
mov    %rsi,%rbx
add    %rsi,%rdi
add    $0xffffffffffffffff,%rdi
call   1030 <malloc@plt>
mov    %rax,%rcx
or     %rbx,%rax
shr    $0x20,%rax
je     1136 <Allocate+0x26>
mov    %rcx,%rax
xor    %edx,%edx
div    %rbx
jmp    113c <Allocate+0x2c>
mov    %ecx,%eax
xor    %edx,%edx
div    %ebx
sub    %rdx,%rbx
test   %rdx,%rdx
cmove  %rdx,%rbx
add    %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @Allocate(i64 %0, i64 %1) {
%3 = add i64 %0, -1
%4 = add i64 %3, %1
%5 = tail call i8* @malloc(i64 %4)
%6 = ptrtoint i8* %5 to i64
%7 = urem i64 %6, %1
%8 = icmp eq i64 %7, 0
%9 = sub i64 %1, %7
%10 = select i1 %8, i64 0, i64 %9
%11 = getelementptr i8, i8* %5, i64 %10
ret i8* %11
}