xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
int strlen(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char *getlogdate(void) {
  char *tp;
  time_t tm = time(NULL);
  tp = ctime(&tm);
  tp[strlen(tp) - 1] = '\0';
  ;
  return (tp);
}


x86 assembly (clang, -O0):
<getlogdate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <ctime@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getlogdate>:
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <ctime@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i8* @getlogdate() {
%1 = alloca i8*
%2 = alloca i32
%3 = call i32 @time(i32* null)
store i32 %3, i32* %2
%4 = call i8* @ctime(i32* %2)
store i8* %4, i8** %1
%5 = load i8*, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 @strlen(i8* %6)
%8 = sub nsw i32 %7, 1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %5, i64 %9
store i8 0, i8* %10
%11 = load i8*, i8** %1
ret i8* %11
}

LLVM IR (-O2):
define i8* @getlogdate() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call i8* @ctime(i32* %1)
%5 = call i32 @strlen(i8* %4)
%6 = add nsw i32 %5, -1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %4, i64 %7
store i8 0, i8* %8
ret i8* %4
}
unsigned long int collatz(unsigned long long int n) {
  unsigned long int count = 0;
  for (;;) {
    if (n == 1) {
      count++;
      return count;
    } else {
      if (!(n % 2)) {
        count++;
        n = n / 2;
      } else {
        count++;
        n = 3 * n + 1;
      }
    }
  }
}


x86 assembly (clang, -O0):
<collatz>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x1,-0x8(%rbp)
jne    112d <collatz+0x2d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret
mov    -0x8(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
jne    115c <collatz+0x5c>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1175 <collatz+0x75>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
imul   $0x3,-0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    117a <collatz+0x7a>
jmp    1110 <collatz+0x10>

x86 assembly (clang, -O2):
<collatz>:
mov    $0x1,%eax
cmp    $0x1,%rdi
je     112d <collatz+0x2d>
mov    $0x1,%eax
mov    %rdi,%rcx
shr    %rcx
test   $0x1,%dil
lea    0x1(%rdi,%rdi,2),%rdi
cmove  %rcx,%rdi
add    $0x1,%rax
cmp    $0x1,%rdi
jne    1110 <collatz+0x10>
ret

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

LLVM IR (-O2):
define i64 @collatz(i64 %0) {
%2 = icmp eq i64 %0, 1
br i1 %2, label %3, label %5
3: ; preds = %5, %1
%4 = phi i64 [ 1, %1 ], [ %14, %5 ]
ret i64 %4
5: ; preds = %1, %5
%6 = phi i64 [ %14, %5 ], [ 1, %1 ]
%7 = phi i64 [ %13, %5 ], [ %0, %1 ]
%8 = and i64 %7, 1
%9 = icmp eq i64 %8, 0
%10 = mul i64 %7, 3
%11 = add i64 %10, 1
%12 = lshr i64 %7, 1
%13 = select i1 %9, i64 %12, i64 %11
%14 = add i64 %6, 1
%15 = icmp eq i64 %13, 1
br i1 %15, label %3, label %5
}
float Min(float v1, float v2) { return v1 < v2 ? v1 : v2; }


x86 assembly (clang, -O0):
<Min>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1130 <Min+0x30>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    113a <Min+0x3a>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Min>:
minss  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @Min(float %0, float %1) {
%3 = fcmp olt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
void __swapc(char *a, char *b) {
  char tmp = *a;
  *a = *b;
  *b = tmp;
}


x86 assembly (clang, -O0):
<__swapc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
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)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__swapc>:
mov    (%rdi),%al
mov    (%rsi),%cl
mov    %cl,(%rdi)
mov    %al,(%rsi)
ret

LLVM IR (-O0):
define void @__swapc(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
store i8 %7, i8* %5
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = load i8*, i8** %3
store i8 %9, i8* %10
%11 = load i8, i8* %5
%12 = load i8*, i8** %4
store i8 %11, i8* %12
ret void
}

LLVM IR (-O2):
define void @__swapc(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
store i8 %4, i8* %0
store i8 %3, i8* %1
ret void
}
/* Variables and functions */
int vprintf(char const *, void **);
int printf(const char *fmt, ...) {
  void **pp = (void **)&fmt;
  return vprintf(fmt, pp + 1);
}


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

x86 assembly (clang, -O2):
<printf>:
push   %rax
mov    %rdi,(%rsp)
lea    0x8(%rsp),%rsi
call   1030 <vprintf@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @printf(i8* %0, ...) {
%2 = alloca i8*
%3 = alloca i8**
store i8* %0, i8** %2
store i8** %2, i8*** %3
%4 = load i8*, i8** %2
%5 = load i8**, i8*** %3
%6 = getelementptr inbounds i8*, i8** %5, i64 1
%7 = call i32 @vprintf(i8* %4, i8** %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @printf(i8* %0, ...) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = getelementptr inbounds i8*, i8** %2, i64 1
%4 = call i32 @vprintf(i8* %0, i8** %3)
ret i32 %4
}
/* Variables and functions */
int fabs(int n) { return (n > 0 ? n : -n); }


x86 assembly (clang, -O0):
<fabs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    111c <fabs+0x1c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <fabs+0x24>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @fabs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
int myround(double n) {
  if (n >= 0)
    return (int)(n + 0.5);
  else
    return (int)(n - 0.5);
}


x86 assembly (clang, -O0):
<myround>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1134 <myround+0x34>
movsd  0xedd(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
jmp    114c <myround+0x4c>
movsd  -0x10(%rbp),%xmm0
movsd  0xebf(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<myround>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
setb   %al
lea    0xeec(%rip),%rcx
addsd  (%rcx,%rax,8),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @myround(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp oge double %4, 0.000000e+00
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load double, double* %3
%8 = fadd double %7, 5.000000e-01
%9 = fptosi double %8 to i32
store i32 %9, i32* %2
br label %14
10: ; preds = %1
%11 = load double, double* %3
%12 = fsub double %11, 5.000000e-01
%13 = fptosi double %12 to i32
store i32 %13, i32* %2
br label %14
14: ; preds = %10, %6
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @myround(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
%3 = select i1 %2, double -5.000000e-01, double 5.000000e-01
%4 = fadd double %3, %0
%5 = fptosi double %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ sendg(char *);
void laseroffFn(char *p1, char *p2, char *p3) { sendg("M42 S0 P12"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"M42 S0 P12\00"
define void @laseroffFn(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = call i32 @sendg(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"M42 S0 P12\00"
define void @laseroffFn(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
%4 = tail call i32 @sendg(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int exact_square(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int sqrt_numb;
  scanf("%d", &sqrt_numb);
  printf("%d", exact_square(sqrt_numb));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
call   1040 <exact_square@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @exact_square(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
int ERANGE;
int scalanaitve_erange() { return ERANGE; }


x86 assembly (clang, -O0):
<scalanaitve_erange>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<scalanaitve_erange>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@ERANGE = global i32 0
define i32 @scalanaitve_erange() {
%1 = load i32, i32* @ERANGE
ret i32 %1
}

LLVM IR (-O2):
@ERANGE = global i32 0
define i32 @scalanaitve_erange() {
%1 = load i32, i32* @ERANGE
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ put_char(char, int, int, int);
int print_char(char ch) {
  put_char(ch, 0X0000, 0X0700, (30 - 2));
  return 1;
}


x86 assembly (clang, -O0):
<print_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
xor    %esi,%esi
mov    $0x700,%edx
mov    $0x1c,%ecx
movsbl -0x1(%rbp),%edi
call   1030 <put_char@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_char>:
push   %rax
xor    %esi,%esi
mov    $0x700,%edx
mov    $0x1c,%ecx
call   1030 <put_char@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @print_char(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @put_char(i8 signext %3, i32 0, i32 1792, i32 28)
ret i32 1
}

LLVM IR (-O2):
define i32 @print_char(i8 signext %0) {
%2 = tail call i32 @put_char(i8 signext %0, i32 0, i32 1792, i32 28)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ myputc(int /*<<< orphan*/);
void myputs(char *s) {
  while (*s)
    myputc(*s++);
}


x86 assembly (clang, -O0):
<myputs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <myputs+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <myputc@plt>
jmp    111c <myputs+0xc>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @myputs(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
%10 = load i8, i8* %8
%11 = sext i8 %10 to i32
%12 = call i32 @myputc(i32 %11)
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @myputs(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @myputc(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() { printf("hello, world\n\c"); }


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"hello, world\0Ac\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"hello, world\0Ac\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
unsigned int string_length(const char *string) {
  int edi;
  register int return_value;
  asm volatile("cld\n"
               "repne\n"
               "scasb\n"
               "notl %0\n"
               "decl %0"
               : "=c"(return_value), "=&D"(edi)
               : "1"(string), "a"(0), "0"(0xFFFFFFFF));
  return return_value;
}


x86 assembly (clang, -O0):
<string_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    $0xffffffff,%ecx
cld
repnz scas %es:(%rdi),%al
not    %ecx
dec    %ecx
mov    %ecx,-0x10(%rbp)
mov    %edi,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_length>:
xor    %eax,%eax
mov    $0xffffffff,%ecx
cld
repnz scas %es:(%rdi),%al
not    %ecx
dec    %ecx
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @string_length(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call { i32, i8* } asm sideeffect "cld\0Arepne\0Ascasb\0Anotl $0\0Adecl $0", "={cx},=&{di},1,{ax},0,~{dirflag},~{fpsr},~{flags}"(i8* %5, i32 0, i32 -1)
%7 = extractvalue { i32, i8* } %6, 0
%8 = extractvalue { i32, i8* } %6, 1
store i32 %7, i32* %4
%9 = ptrtoint i8* %8 to i64
%10 = trunc i64 %9 to i32
store i32 %10, i32* %3
%11 = load i32, i32* %4
ret i32 %11
}

LLVM IR (-O2):
define i32 @string_length(i8* %0) {
%2 = tail call { i32, i8* } asm sideeffect "cld\0Arepne\0Ascasb\0Anotl $0\0Adecl $0", "={cx},=&{di},1,{ax},0,~{dirflag},~{fpsr},~{flags}"(i8* %0, i32 0, i32 -1)
%3 = extractvalue { i32, i8* } %2, 0
ret i32 %3
}
unsigned int round_half_down_mul(unsigned int a, unsigned int b) {
  return ((((b) != 0) ? ((a) + (b / 2) - 1) / (b) : 0) * (b));
}


x86 assembly (clang, -O0):
<round_half_down_mul>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112f <round_half_down_mul+0x2f>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    $0x1,%ecx
add    %ecx,%eax
sub    $0x1,%eax
xor    %edx,%edx
divl   -0x8(%rbp)
mov    %eax,-0xc(%rbp)
jmp    1139 <round_half_down_mul+0x39>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    1139 <round_half_down_mul+0x39>
mov    -0xc(%rbp),%eax
imul   -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_half_down_mul>:
test   %esi,%esi
je     1115 <round_half_down_mul+0x15>
mov    %esi,%eax
shr    %eax
add    %edi,%eax
add    $0xffffffff,%eax
xor    %edx,%edx
div    %esi
imul   %esi,%eax
ret
xor    %eax,%eax
imul   %esi,%eax
ret

LLVM IR (-O0):
define i32 @round_half_down_mul(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 = icmp ne i32 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %2
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = udiv i32 %9, 2
%11 = add i32 %8, %10
%12 = sub i32 %11, 1
%13 = load i32, i32* %4
%14 = udiv i32 %12, %13
br label %16
15: ; preds = %2
br label %16
16: ; preds = %15, %7
%17 = phi i32 [ %14, %7 ], [ 0, %15 ]
%18 = load i32, i32* %4
%19 = mul i32 %17, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @round_half_down_mul(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = lshr i32 %1, 1
%6 = add i32 %0, -1
%7 = add i32 %6, %5
%8 = udiv i32 %7, %1
br label %9
9: ; preds = %2, %4
%10 = phi i32 [ %8, %4 ], [ 0, %2 ]
%11 = mul i32 %10, %1
ret i32 %11
}
unsigned long mod6(unsigned long x, unsigned long y) { return x % y; }


x86 assembly (clang, -O0):
<mod6>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rdx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod6>:
mov    %rdi,%rax
mov    %rdi,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     1118 <mod6+0x18>
xor    %edx,%edx
div    %rsi
mov    %rdx,%rax
ret
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i64 @mod6(i64 %0, i64 %1) {
%3 = urem i64 %0, %1
ret i64 %3
}
/* Type definitions */
struct timespec {
  int dummy;
};
typedef int /*<<< orphan*/ mqd_t;

/* Variables and functions */
int syscall_cp(int, int /*<<< orphan*/, char const *, size_t, unsigned int,
               struct timespec const *);
int mq_timedsend(mqd_t mqd, const char *msg, size_t len, unsigned prio,
                 const struct timespec *at) {
  return syscall_cp(276, mqd, msg, len, prio, at);
}


x86 assembly (clang, -O0):
<mq_timedsend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    -0x28(%rbp),%r9
mov    $0x114,%edi
call   1030 <syscall_cp@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mq_timedsend>:
mov    %r8,%r9
mov    %ecx,%r8d
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0x114,%edi
jmp    1030 <syscall_cp@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
define i32 @mq_timedsend(i32 %0, i8* %1, i64 %2, i32 %3, %struct.timespec* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca %struct.timespec*
store i32 %0, i32* %6
store i8* %1, i8** %7
store i64 %2, i64* %8
store i32 %3, i32* %9
store %struct.timespec* %4, %struct.timespec** %10
%11 = load i32, i32* %6
%12 = load i8*, i8** %7
%13 = load i64, i64* %8
%14 = load i32, i32* %9
%15 = load %struct.timespec*, %struct.timespec** %10
%16 = call i32 @syscall_cp(i32 276, i32 %11, i8* %12, i64 %13, i32 %14, %struct.timespec* %15)
ret i32 %16
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
define i32 @mq_timedsend(i32 %0, i8* %1, i64 %2, i32 %3, %struct.timespec* %4) {
%6 = tail call i32 @syscall_cp(i32 276, i32 %0, i8* %1, i64 %2, i32 %3, %struct.timespec* %4)
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
struct krash_h256 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sha3_256(int /*<<< orphan*/ *, int,
                            int /*<<< orphan*/ const *, size_t const);
void SHA3_256(struct krash_h256 const *ret, uint8_t const *data,
              size_t const size) {
  sha3_256((uint8_t *)ret, 32, data, size);
}


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

x86 assembly (clang, -O2):
<SHA3_256>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    $0x20,%esi
jmp    1030 <sha3_256@plt>

LLVM IR (-O0):
%struct.krash_h256 = type { i32 }
define void @SHA3_256(%struct.krash_h256* %0, i32* %1, i64 %2) {
%4 = alloca %struct.krash_h256*
%5 = alloca i32*
%6 = alloca i64
store %struct.krash_h256* %0, %struct.krash_h256** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
%7 = load %struct.krash_h256*, %struct.krash_h256** %4
%8 = bitcast %struct.krash_h256* %7 to i32*
%9 = load i32*, i32** %5
%10 = load i64, i64* %6
%11 = call i32 @sha3_256(i32* %8, i32 32, i32* %9, i64 %10)
ret void
}

LLVM IR (-O2):
%struct.krash_h256 = type { i32 }
define void @SHA3_256(%struct.krash_h256* %0, i32* %1, i64 %2) {
%4 = getelementptr %struct.krash_h256, %struct.krash_h256* %0, i64 0, i32 0
%5 = tail call i32 @sha3_256(i32* %4, i32 32, i32* %1, i64 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ func1(int);
int main(void) {
  static int static_var = 85;
  static int static_var2;
  int a = 1;
  int b;
  func1(static_var + static_var2 + a + b);
  return a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    0x2efc(%rip),%edi
add    0x2efe(%rip),%edi
add    -0x8(%rbp),%edi
add    -0xc(%rbp),%edi
call   1030 <func1@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <func1@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@main.static_var = internal global i32 85
@main.static_var2 = internal global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%4 = load i32, i32* @main.static_var
%5 = load i32, i32* @main.static_var2
%6 = add nsw i32 %4, %5
%7 = load i32, i32* %2
%8 = add nsw i32 %6, %7
%9 = load i32, i32* %3
%10 = add nsw i32 %8, %9
%11 = call i32 @func1(i32 %10)
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @func1(i32 undef)
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ nums;

/* Variables and functions */
int /*<<< orphan*/ print_int_array(char *, int *, int);
int /*<<< orphan*/ quick_sort(int *, int);
int main(int argc, char *argv[]) {
  int nums[] = {5, 2, 4, 7, 1, 3, 2, 6};
  int n = (sizeof(nums) / sizeof(nums[0]));
  quick_sort(nums, n - 1);
  print_int_array("Sorted nums:  ", nums, n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x8,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
sub    $0x1,%esi
call   1030 <quick_sort@plt>
lea    -0x30(%rbp),%rsi
mov    -0x34(%rbp),%edx
lea    0xea1(%rip),%rdi
call   1040 <print_int_array@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <quick_sort@plt>
lea    0xecd(%rip),%rdi
mov    %rbx,%rsi
mov    $0x8,%edx
call   1040 <print_int_array@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@__const.main.nums = [8 x i32] [i32 5, i32 2, i32 4, i32 7, i32 1, i32 3, i32 2, i32 6]
@.str = [15 x i8] c"Sorted nums: \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [8 x i32]
%4 = bitcast [8 x i32]* %3 to i8*
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%6 = call i32 @quick_sort(i32* %5, i32 7)
%7 = call i32 @print_int_array(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* %5, i32 8)
ret i32 0
}
int parent(int i) { return i / 2; }


x86 assembly (clang, -O0):
<parent>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<parent>:
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
sar    %eax
ret

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

LLVM IR (-O2):
define i32 @parent(i32 %0) {
%2 = sdiv i32 %0, 2
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ ft_putchar(char);
int /*<<< orphan*/ rush(int, int);
int main(void) {
  rush(4, 5);
  ft_putchar('\n');
  rush(1, 6);
  ft_putchar('\n');
  rush(4, 1);
  ft_putchar('\n');
  rush(7, 1);
  ft_putchar('\n');
  rush(13, 14);
  ft_putchar('\n');
  rush(0, 7);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
mov    $0x5,%esi
call   1040 <rush@plt>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
mov    $0x1,%edi
mov    $0x6,%esi
call   1040 <rush@plt>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
mov    $0x4,%edi
mov    $0x1,%esi
call   1040 <rush@plt>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
mov    $0x7,%edi
mov    $0x1,%esi
call   1040 <rush@plt>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
mov    $0xd,%edi
mov    $0xe,%esi
call   1040 <rush@plt>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
xor    %edi,%edi
mov    $0x7,%esi
call   1040 <rush@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
mov    $0x5,%esi
call   1040 <rush@plt>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
mov    $0x1,%edi
mov    $0x6,%esi
call   1040 <rush@plt>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
mov    $0x4,%edi
mov    $0x1,%esi
call   1040 <rush@plt>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
mov    $0x7,%edi
mov    $0x1,%esi
call   1040 <rush@plt>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
mov    $0xd,%edi
mov    $0xe,%esi
call   1040 <rush@plt>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
xor    %edi,%edi
mov    $0x7,%esi
call   1040 <rush@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @rush(i32 4, i32 5)
%3 = call i32 @ft_putchar(i8 signext 10)
%4 = call i32 @rush(i32 1, i32 6)
%5 = call i32 @ft_putchar(i8 signext 10)
%6 = call i32 @rush(i32 4, i32 1)
%7 = call i32 @ft_putchar(i8 signext 10)
%8 = call i32 @rush(i32 7, i32 1)
%9 = call i32 @ft_putchar(i8 signext 10)
%10 = call i32 @rush(i32 13, i32 14)
%11 = call i32 @ft_putchar(i8 signext 10)
%12 = call i32 @rush(i32 0, i32 7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @rush(i32 4, i32 5)
%2 = tail call i32 @ft_putchar(i8 signext 10)
%3 = tail call i32 @rush(i32 1, i32 6)
%4 = tail call i32 @ft_putchar(i8 signext 10)
%5 = tail call i32 @rush(i32 4, i32 1)
%6 = tail call i32 @ft_putchar(i8 signext 10)
%7 = tail call i32 @rush(i32 7, i32 1)
%8 = tail call i32 @ft_putchar(i8 signext 10)
%9 = tail call i32 @rush(i32 13, i32 14)
%10 = tail call i32 @ft_putchar(i8 signext 10)
%11 = tail call i32 @rush(i32 0, i32 7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sendConf(int, int);
void setBlueStill(int sockfd) {
  sendConf(sockfd, (1 << 7) | (1 << 3) | (2 << 1));
}


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

x86 assembly (clang, -O2):
<setBlueStill>:
mov    $0x8c,%esi
jmp    1030 <sendConf@plt>

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

LLVM IR (-O2):
define void @setBlueStill(i32 %0) {
%2 = tail call i32 @sendConf(i32 %0, i32 140)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ WriteInstruction(char *);
void CR_DigDown(void) { WriteInstruction("call digd"); }


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"call digd\00"
define void @CR_DigDown() {
%1 = call i32 @WriteInstruction(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"call digd\00"
define void @CR_DigDown() {
%1 = tail call i32 @WriteInstruction(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ d_s(char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char *s;
  printf("main: before d_s, s = [%s]\n", s);
  d_s(s);
  printf("main: after d_s, s = [%s]\n", s);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [28 x i8] c"main: before d_s, s = [%s]\0A\00"
@.str.1 = [27 x i8] c"main: after d_s, s = [%s]\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* undef)
%2 = tail call i32 @d_s(i8* undef)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* undef)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(
      stderr,
      "usage: rlogin [-46%s]%s[-e char] [-i localname] [-l username] host\n",
      "8DEd", " ");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
lea    0xf09(%rip),%rdx
lea    0xf07(%rip),%rcx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
lea    0xf0c(%rip),%rdx
lea    0xf0a(%rip),%rcx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [68 x i8] c"usage: rlogin [-46%s]%s[-e char] [-i localname] [-l username] host\0A\00"
@.str.1 = [5 x i8] c"8DEd\00"
@.str.2 = [2 x i8] c" \00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [68 x i8] c"usage: rlogin [-46%s]%s[-e char] [-i localname] [-l username] host\0A\00"
@.str.1 = [5 x i8] c"8DEd\00"
@.str.2 = [2 x i8] c" \00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ md5ForFile(char *, unsigned char *);
char *md5ToHex(unsigned char *);
char *md5HexForFile(char *fileName) {
  unsigned char md5[16];
  md5ForFile(fileName, md5);
  return md5ToHex(md5);
}


x86 assembly (clang, -O0):
<md5HexForFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <md5ForFile@plt>
lea    -0x20(%rbp),%rdi
call   1030 <md5ToHex@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<md5HexForFile>:
push   %rbx
sub    $0x10,%rsp
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <md5ForFile@plt>
mov    %rbx,%rdi
call   1030 <md5ToHex@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i8* @md5HexForFile(i8* %0) {
%2 = alloca i8*
%3 = alloca [16 x i8]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%6 = call i32 @md5ForFile(i8* %4, i8* %5)
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%8 = call i8* @md5ToHex(i8* %7)
ret i8* %8
}

LLVM IR (-O2):
define i8* @md5HexForFile(i8* %0) {
%2 = alloca [16 x i8]
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%4 = call i32 @md5ForFile(i8* %0, i8* %3)
%5 = call i8* @md5ToHex(i8* %3)
ret i8* %5
}
int get_timepersec(void) { return 1000000; }


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

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

LLVM IR (-O0):
define i32 @get_timepersec() {
ret i32 1000000
}

LLVM IR (-O2):
define i32 @get_timepersec() {
ret i32 1000000
}
/* Variables and functions */
int /*<<< orphan*/ scrn_print(int, int /*<<< orphan*/, char const *);
void fail(const char *msg) {
  scrn_print(18, 0, msg);
  while (1)
    ;
}


x86 assembly (clang, -O0):
<fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x12,%edi
xor    %esi,%esi
call   1030 <scrn_print@plt>
jmp    112c <fail+0x1c>

x86 assembly (clang, -O2):
<fail>:
push   %rax
mov    %rdi,%rdx
mov    $0x12,%edi
xor    %esi,%esi
call   1030 <scrn_print@plt>
jmp    1120 <fail+0x10>

LLVM IR (-O0):
define void @fail(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @scrn_print(i32 18, i32 0, i8* %3)
br label %5
5: ; preds = %1, %5
br label %5
}

LLVM IR (-O2):
define void @fail(i8* %0) {
%2 = tail call i32 @scrn_print(i32 18, i32 0, i8* %0)
br label %3
3: ; preds = %1, %3
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
void usage() {
  fprintf(stdout, "\x1b[33m"
                  "Usage: "
                  "\x1b[0m");
  fprintf(stdout, "%s [options] input file\n\n", "Program Name");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xed6(%rip),%rsi
lea    0xee9(%rip),%rdx
mov    $0x0,%al
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%edi
lea    0xedf(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xee0(%rip),%rsi
lea    0xef3(%rip),%rdx
xor    %eax,%eax
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [17 x i8] c"\1B[33mUsage: \1B[0m\00"
@.str.1 = [26 x i8] c"%s [options] input file\0A\0A\00"
@.str.2 = [13 x i8] c"Program Name\00"
define void @usage() {
%1 = load i32, i32* @stdout
%2 = call i32 (i32, i8*, ...) @fprintf(i32 %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [17 x i8] c"\1B[33mUsage: \1B[0m\00"
@.str.1 = [26 x i8] c"%s [options] input file\0A\0A\00"
@.str.2 = [13 x i8] c"Program Name\00"
define void @usage() {
%1 = load i32, i32* @stdout
%2 = tail call i32 (i32, i8*, ...) @fprintf(i32 %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
ret void
}
int test_imm_0Duint8_reg(unsigned char val) {
  return ((val) & (0x0D << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_0Duint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xd,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_0Duint8_reg>:
test   $0xd,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_0Duint8_reg(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, 13
%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_0Duint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 13
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int get_user_command() {
  int cmd;
  printf("\nYOUR INPUT : ");
  scanf("%d", &cmd);
  return cmd;
}


x86 assembly (clang, -O0):
<get_user_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_user_command>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"\0AYOUR INPUT : \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @get_user_command() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@.str = [15 x i8] c"\0AYOUR INPUT : \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @get_user_command() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
ret i32 %5
}
/* Variables and functions */
int strcmp(char const *, char const *);
int datacmp(const char **v1, const char **v2) { return strcmp(*v1, *v2); }


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

x86 assembly (clang, -O2):
<datacmp>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @datacmp(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** %5
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %7
%9 = call i32 @strcmp(i8* %6, i8* %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @datacmp(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(1) %4)
ret i32 %5
}
int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.seq_file = type opaque
define i32 @batadv_bla_claim_table_seq_print_text(%struct.seq_file* %0, i8* %1) {
%3 = alloca %struct.seq_file*
%4 = alloca i8*
store %struct.seq_file* %0, %struct.seq_file** %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
%struct.seq_file = type opaque
define i32 @batadv_bla_claim_table_seq_print_text(%struct.seq_file* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
void multi_r() {
  register int out0 = 0;
  register int in1 = 1;
  asm("foo %1,%0" : "=r,r"(out0) : "r,m"(in1));
}


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

LLVM IR (-O0):
LLVM IR (-O2):
define void @multi_r() {
%1 = tail call i32 asm "foo $1,$0", "=r|r,r|m,~{dirflag},~{fpsr},~{flags}"(i32 1)
ret void
}
/* Variables and functions */
unsigned short __tzcnt_u16(unsigned short);
unsigned short __attribute__((__target__("bmi")))
tzcnt_u16_wrap(unsigned short x) {
  return __tzcnt_u16(x);
}


x86 assembly (clang, -O0):
<tzcnt_u16_wrap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edi
call   1030 <__tzcnt_u16@plt>
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tzcnt_u16_wrap>:
jmp    1030 <__tzcnt_u16@plt>

LLVM IR (-O0):
define zeroext i16 @tzcnt_u16_wrap(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = call zeroext i16 @__tzcnt_u16(i16 zeroext %3)
ret i16 %4
}

LLVM IR (-O2):
define zeroext i16 @tzcnt_u16_wrap(i16 zeroext %0) {
%2 = tail call zeroext i16 @__tzcnt_u16(i16 zeroext %0)
ret i16 %2
}
void slang_set_raw_mode(void) {}


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

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

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

LLVM IR (-O2):
define void @slang_set_raw_mode() {
ret void
}
void arg_ulonglong3(unsigned long long x, unsigned long long y,
                    unsigned long long z) {}


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

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

LLVM IR (-O0):
define void @arg_ulonglong3(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
ret void
}

LLVM IR (-O2):
define void @arg_ulonglong3(i64 %0, i64 %1, i64 %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_thread_id(char *);
void SignalHandler(const int iSignal) {
  print_thread_id("Signal was delivered to ");
}


x86 assembly (clang, -O0):
<SignalHandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <print_thread_id@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [25 x i8] c"Signal was delivered to \00"
define void @SignalHandler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @print_thread_id(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Signal was delivered to \00"
define void @SignalHandler(i32 %0) {
%2 = tail call i32 @print_thread_id(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}