xunge/DecIR huggingface dataset:
char *strcat(char *dest, const char *src) {
  char *str = dest;
  while (*dest)
    dest++;
  while ((*dest++ = *src++))
    ;
  *dest = '\0';
  return str;
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1132 <strcat+0x32>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <strcat+0x14>
jmp    1137 <strcat+0x37>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1166 <strcat+0x66>
jmp    1137 <strcat+0x37>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
mov    %rdi,%rax
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x0,(%rcx)
lea    0x1(%rcx),%rcx
jne    1110 <strcat+0x10>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movzbl (%rsi,%rdx,1),%edi
mov    %dil,-0x1(%rcx,%rdx,1)
add    $0x1,%rdx
test   %dil,%dil
jne    1120 <strcat+0x20>
movb   $0x0,-0x1(%rcx,%rdx,1)
ret

LLVM IR (-O0):
define i8* @strcat(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
store i8* %6, i8** %5
br label %7
7: ; preds = %11, %2
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %3
br label %7
14: ; preds = %7
br label %15
15: ; preds = %22, %14
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %4
%18 = load i8, i8* %16
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %3
store i8 %18, i8* %19
%21 = icmp ne i8 %18, 0
br i1 %21, label %22, label %23
22: ; preds = %15
br label %15
23: ; preds = %15
%24 = load i8*, i8** %3
store i8 0, i8* %24
%25 = load i8*, i8** %5
ret i8* %25
}

LLVM IR (-O2):
define i8* @strcat(i8* returned %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3, %8
%9 = phi i8* [ %11, %8 ], [ %1, %3 ]
%10 = phi i8* [ %13, %8 ], [ %4, %3 ]
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = load i8, i8* %9
%13 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %12, i8* %10
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %8
15: ; preds = %8
store i8 0, i8* %13
ret i8* %0
}
/* Variables and functions */
scalar_t__ lengthOfLongestSubstring(char *);
int /*<<< orphan*/ printf(char const *);
int main() {
  printf((const char *)lengthOfLongestSubstring("abcabcbb"));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <lengthOfLongestSubstring@plt>
mov    %rax,%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   1040 <lengthOfLongestSubstring@plt>
mov    %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"abcabcbb\00"
define i32 @main() {
%1 = tail call i64 @lengthOfLongestSubstring(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) %2)
ret i32 0
}
/* Variables and functions */
double M_PI_2;
double cos(double);
double LSKeyframeAnimationFunctionEaseInSine(double t, double b, double c,
                                             double d) {
  return -c * cos(t / d * (M_PI_2)) + c + b;
}


x86 assembly (clang, -O0):
<LSKeyframeAnimationFunctionEaseInSine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    0x2e8a(%rip),%rax
mulsd  (%rax),%xmm0
call   1030 <cos@plt>
movaps %xmm0,%xmm2
movsd  -0x28(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  -0x10(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LSKeyframeAnimationFunctionEaseInSine>:
sub    $0x18,%rsp
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
divsd  %xmm3,%xmm0
mov    0x2ebd(%rip),%rax
mulsd  (%rax),%xmm0
call   1030 <cos@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
subsd  %xmm0,%xmm1
addsd  0x10(%rsp),%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@M_PI_2 = global double 0.000000e+00
define double @LSKeyframeAnimationFunctionEaseInSine(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %7
%10 = fneg double %9
%11 = load double, double* %5
%12 = load double, double* %8
%13 = fdiv double %11, %12
%14 = load double, double* @M_PI_2
%15 = fmul double %13, %14
%16 = call double @cos(double %15)
%17 = load double, double* %7
%18 = call double @llvm.fmuladd.f64(double %10, double %16, double %17)
%19 = load double, double* %6
%20 = fadd double %18, %19
ret double %20
}

LLVM IR (-O2):
@M_PI_2 = global double 0.000000e+00
define double @LSKeyframeAnimationFunctionEaseInSine(double %0, double %1, double %2, double %3) {
%5 = fneg double %2
%6 = fdiv double %0, %3
%7 = load double, double* @M_PI_2
%8 = fmul double %6, %7
%9 = tail call double @cos(double %8)
%10 = tail call double @llvm.fmuladd.f64(double %5, double %9, double %2)
%11 = fadd double %10, %1
ret double %11
}
indreg0imm1_set(r0, r1, x0, x1, p0, p1) float r0, r1;
float *p0, *p1;
{ (*p0) = 33; }


x86 assembly (clang, -O0):
<indreg0imm1_set>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x30(%rbp)
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movss  0xec3(%rip),%xmm0
movss  %xmm0,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<indreg0imm1_set>:
movl   $0x42040000,(%rdx)
ret

LLVM IR (-O0):
define i32 @indreg0imm1_set(double %0, double %1, i32 %2, i32 %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = fptrunc double %0 to float
%15 = fptrunc double %1 to float
store float %14, float* %8
store float %15, float* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store float* %4, float** %12
store float* %5, float** %13
%16 = load float*, float** %12
store float 3.300000e+01, float* %16
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
define i32 @indreg0imm1_set(double %0, double %1, i32 %2, i32 %3, float* nocapture writeonly %4, float* nocapture readnone %5) {
store float 3.300000e+01, float* %4
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
void fail(int val) {
  printf("fail(%d)\n", val);
  exit(val);
}


x86 assembly (clang, -O0):
<fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fail>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c"fail(%d)\0A\00"
define void @fail(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @exit(i32 %0)
unreachable
}
/* Variables and functions */
long drand48();
long timlib_random(long up_to) { return (long)((drand48() * up_to) + 1); }


x86 assembly (clang, -O0):
<timlib_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <drand48@plt>
imul   -0x8(%rbp),%rax
add    $0x1,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timlib_random>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <drand48@plt>
imul   %rbx,%rax
add    $0x1,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @timlib_random(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i64 (...) @drand48()
%4 = load i64, i64* %2
%5 = mul nsw i64 %3, %4
%6 = add nsw i64 %5, 1
ret i64 %6
}

LLVM IR (-O2):
define i64 @timlib_random(i64 %0) {
%2 = tail call i64 (...) @drand48()
%3 = mul nsw i64 %2, %0
%4 = add nsw i64 %3, 1
ret i64 %4
}
void test62_ArrHostDim_targetInit__I() {}


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

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

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

LLVM IR (-O2):
define void @test62_ArrHostDim_targetInit__I() {
ret void
}
/* Variables and functions */
scalar_t__ strverscmp(char const *, char *);
const char *gsasl_check_version(const char *req_version) {
  if (!req_version || strverscmp(req_version, "1.8.1") <= 0)
    return "1.8.1";
  return NULL;
}


x86 assembly (clang, -O0):
<gsasl_check_version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1141 <gsasl_check_version+0x31>
mov    -0x10(%rbp),%rdi
lea    0xece(%rip),%rsi
call   1030 <strverscmp@plt>
cmp    $0x0,%rax
jg     1151 <gsasl_check_version+0x41>
lea    0xeb8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1159 <gsasl_check_version+0x49>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gsasl_check_version>:
test   %rdi,%rdi
je     1133 <gsasl_check_version+0x23>
push   %rbx
lea    0xee3(%rip),%rbx
mov    %rbx,%rsi
call   1030 <strverscmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
cmovle %rbx,%rax
pop    %rbx
ret
lea    0xec6(%rip),%rax
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"1.8.1\00"
define i8* @gsasl_check_version(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i64 @strverscmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = icmp slt i64 %4, 1
%6 = select i1 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* null
br label %7
7: ; preds = %3, %1
%8 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %1 ], [ %6, %3 ]
ret i8* %8
}
int isendline(char c) {
  if (c == '\f')
    return 1;
  if (c == '\n')
    return 1;
  if (c == '\r')
    return 1;
  if (c == '\v')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isendline>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0xc,%eax
jne    1123 <isendline+0x23>
movl   $0x1,-0x4(%rbp)
jmp    1175 <isendline+0x75>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    113c <isendline+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    1175 <isendline+0x75>
movsbl -0x5(%rbp),%eax
cmp    $0xd,%eax
jne    1155 <isendline+0x55>
movl   $0x1,-0x4(%rbp)
jmp    1175 <isendline+0x75>
movsbl -0x5(%rbp),%eax
cmp    $0xb,%eax
jne    116e <isendline+0x6e>
movl   $0x1,-0x4(%rbp)
jmp    1175 <isendline+0x75>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isendline>:
add    $0xf6,%dil
xor    %eax,%eax
cmp    $0x4,%dil
setb   %al
ret

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

LLVM IR (-O2):
define i32 @isendline(i8 signext %0) {
%2 = add i8 %0, -10
%3 = icmp ult i8 %2, 4
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef union vec3 {
  int dummy;
} vec3;

/* Variables and functions */
union vec3 *vec3_mul(union vec3 *, union vec3 *, float);
union vec3 *vec3_mul_self(union vec3 *vi, float scalar) {
  return vec3_mul(vi, vi, scalar);
}


x86 assembly (clang, -O0):
<vec3_mul_self>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movss  -0xc(%rbp),%xmm0
call   1030 <vec3_mul@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%union.vec3 = type { i32 }
define %union.vec3* @vec3_mul_self(%union.vec3* %0, float %1) {
%3 = alloca %union.vec3*
%4 = alloca float
store %union.vec3* %0, %union.vec3** %3
store float %1, float* %4
%5 = load %union.vec3*, %union.vec3** %3
%6 = load %union.vec3*, %union.vec3** %3
%7 = load float, float* %4
%8 = call %union.vec3* @vec3_mul(%union.vec3* %5, %union.vec3* %6, float %7)
ret %union.vec3* %8
}

LLVM IR (-O2):
%union.vec3 = type { i32 }
define %union.vec3* @vec3_mul_self(%union.vec3* %0, float %1) {
%3 = tail call %union.vec3* @vec3_mul(%union.vec3* %0, %union.vec3* %0, float %1)
ret %union.vec3* %3
}
unsigned long long Cubed(unsigned long long a) { return a * a * a; }


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

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

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

LLVM IR (-O2):
define i64 @Cubed(i64 %0) {
%2 = mul i64 %0, %0
%3 = mul i64 %2, %0
ret i64 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ next_pow2(int /*<<< orphan*/);
uint32_t fbi_test_next_pow2(uint32_t u32) { return next_pow2(u32); }


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

x86 assembly (clang, -O2):
<fbi_test_next_pow2>:
jmp    1030 <next_pow2@plt>

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

LLVM IR (-O2):
define i32 @fbi_test_next_pow2(i32 %0) {
%2 = tail call i32 @next_pow2(i32 %0)
ret i32 %2
}
k_idletask() {
l1:
  goto l1;
}


x86 assembly (clang, -O0):
<k_idletask>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <k_idletask+0x9>
jmp    1109 <k_idletask+0x9>

x86 assembly (clang, -O2):
<k_idletask>:
jmp    1100 <k_idletask>

LLVM IR (-O0):
define i32 @k_idletask() {
br label %1
1: ; preds = %1, %0
br label %1
}

LLVM IR (-O2):
define i32 @k_idletask() {
br label %1
1: ; preds = %1, %0
br label %1
}
int isEven(int a) { return a % 2 == 0; }


x86 assembly (clang, -O0):
<isEven>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isEven>:
mov    %edi,%eax
not    %eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @isEven(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 2
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @isEven(i32 %0) {
%2 = and i32 %0, 1
%3 = xor i32 %2, 1
ret i32 %3
}
/* Variables and functions */
int memcmp(void *, void *, int);
int sha1_cmp(void *v1, void *v2) {
  return memcmp(v1, v2, sizeof(unsigned char) * 20);
}


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

x86 assembly (clang, -O2):
<sha1_cmp>:
mov    $0x14,%edx
jmp    1030 <memcmp@plt>

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

LLVM IR (-O2):
define i32 @sha1_cmp(i8* %0, i8* %1) {
%3 = tail call i32 @memcmp(i8* %0, i8* %1, i32 20)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ rgph_u32_murmur32s_data64(int /*<<< orphan*/ const *, size_t,
                                             uintptr_t);
uint32_t rgph_u32_murmur32s_u64a(const uint64_t *key, size_t len,
                                 uintptr_t seed) {
  return rgph_u32_murmur32s_data64(key, len, seed);
}


x86 assembly (clang, -O0):
<rgph_u32_murmur32s_u64a>:
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),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <rgph_u32_murmur32s_data64@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgph_u32_murmur32s_u64a>:
jmp    1030 <rgph_u32_murmur32s_data64@plt>

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

LLVM IR (-O2):
define i32 @rgph_u32_murmur32s_u64a(i32* %0, i64 %1, i64 %2) {
%4 = tail call i32 @rgph_u32_murmur32s_data64(i32* %0, i64 %1, i64 %2)
ret i32 %4
}
void BCD_TO_ASCII(unsigned char bcd_value, unsigned char *ascii_text) {
  ascii_text[1] = ((unsigned char)bcd_value & 0x0F) + 0x30;
  ascii_text[0] = ((unsigned char)bcd_value >> 4) + 0x30;
}


x86 assembly (clang, -O0):
<BCD_TO_ASCII>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movzbl -0x1(%rbp),%eax
and    $0xf,%eax
add    $0x30,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
movzbl -0x1(%rbp),%eax
sar    $0x4,%eax
add    $0x30,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<BCD_TO_ASCII>:
mov    %edi,%eax
and    $0xf,%al
or     $0x30,%al
mov    %al,0x1(%rsi)
shr    $0x4,%dil
or     $0x30,%dil
mov    %dil,(%rsi)
ret

LLVM IR (-O0):
define void @BCD_TO_ASCII(i8 zeroext %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 = zext i8 %5 to i32
%7 = and i32 %6, 15
%8 = add nsw i32 %7, 48
%9 = trunc i32 %8 to i8
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %9, i8* %11
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = ashr i32 %13, 4
%15 = add nsw i32 %14, 48
%16 = trunc i32 %15 to i8
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 0
store i8 %16, i8* %18
ret void
}

LLVM IR (-O2):
define void @BCD_TO_ASCII(i8 zeroext %0, i8* nocapture writeonly %1) {
%3 = and i8 %0, 15
%4 = or i8 %3, 48
%5 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %4, i8* %5
%6 = lshr i8 %0, 4
%7 = or i8 %6, 48
store i8 %7, i8* %1
ret void
}
void signed_char_shl_signed_char_unsigned_int(signed char *LHS,
                                              unsigned int RHS) {
  (*LHS) <<= RHS;
}


x86 assembly (clang, -O0):
<signed_char_shl_signed_char_unsigned_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
shl    %cl,%edx
mov    %edx,%ecx
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<signed_char_shl_signed_char_unsigned_int>:
mov    %esi,%ecx
movzbl (%rdi),%eax
shl    %cl,%eax
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @signed_char_shl_signed_char_unsigned_int(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = shl i32 %8, %5
%10 = trunc i32 %9 to i8
store i8 %10, i8* %6
ret void
}

LLVM IR (-O2):
define void @signed_char_shl_signed_char_unsigned_int(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = zext i8 %3 to i32
%5 = shl i32 %4, %1
%6 = trunc i32 %5 to i8
store i8 %6, i8* %0
ret void
}
unsigned short fb_repack565(unsigned short pixel) {
  return ((pixel & 0x7c00) << 1) | ((pixel & 0x03e0) << 1) |
         ((pixel & 0x001f) << 0);
}


x86 assembly (clang, -O0):
<fb_repack565>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
and    $0x7c00,%eax
shl    $0x1,%eax
movzwl -0x2(%rbp),%ecx
and    $0x3e0,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
movzwl -0x2(%rbp),%ecx
and    $0x1f,%ecx
shl    $0x0,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fb_repack565>:
mov    %edi,%eax
and    $0xffffffe0,%eax
and    $0x1f,%edi
lea    (%rdi,%rax,2),%eax
ret

LLVM IR (-O0):
define zeroext i16 @fb_repack565(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, 31744
%6 = shl i32 %5, 1
%7 = load i16, i16* %2
%8 = zext i16 %7 to i32
%9 = and i32 %8, 992
%10 = shl i32 %9, 1
%11 = or i32 %6, %10
%12 = load i16, i16* %2
%13 = zext i16 %12 to i32
%14 = and i32 %13, 31
%15 = shl i32 %14, 0
%16 = or i32 %11, %15
%17 = trunc i32 %16 to i16
ret i16 %17
}

LLVM IR (-O2):
define zeroext i16 @fb_repack565(i16 zeroext %0) {
%2 = shl i16 %0, 1
%3 = and i16 %2, -64
%4 = and i16 %0, 31
%5 = or i16 %3, %4
ret i16 %5
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isprint(int);
void t_isprint_0xf5() {
  Assert_real((isprint(245) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isprint.c",
              1230, ("isprint should be 0 for 0xf5"));
}


x86 assembly (clang, -O0):
<t_isprint_0xf5>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf5,%edi
call   1030 <isprint@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x4ce,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isprint_0xf5>:
push   %rax
mov    $0xf5,%edi
call   1030 <isprint@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x4ce,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isprint.c\00"
@.str.1 = [29 x i8] c"isprint should be 0 for 0xf5\00"
define void @t_isprint_0xf5() {
%1 = call i64 @isprint(i32 245)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1230, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isprint.c\00"
@.str.1 = [29 x i8] c"isprint should be 0 for 0xf5\00"
define void @t_isprint_0xf5() {
%1 = tail call i64 @isprint(i32 245)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1230, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
long atoi(char *);
int /*<<< orphan*/ non_short_circuit();
int main(int argc, char *argv[]) {
  long i, n;
  n = atoi(argv[1]);
  for (i = 0; i < n; i++)
    non_short_circuit();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    1175 <main+0x55>
mov    $0x0,%al
call   1030 <non_short_circuit@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    114f <main+0x2f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
test   %rax,%rax
jle    114d <main+0x2d>
mov    %rax,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <non_short_circuit@plt>
add    $0xffffffffffffffff,%rbx
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i64 @atoi(i8* %4)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %2, %7
%8 = phi i64 [ %10, %7 ], [ 0, %2 ]
%9 = tail call i32 (...) @non_short_circuit()
%10 = add nuw nsw i64 %8, 1
%11 = icmp eq i64 %10, %5
br i1 %11, label %12, label %7
12: ; preds = %7, %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void square1(void) {
  int x;
  printf("Please enter an integer > ");
  scanf("%d", &x);
  printf("The square of %d is %d\n", x, x * x);
}


x86 assembly (clang, -O0):
<square1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
imul   -0x4(%rbp),%edx
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<square1>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
mov    %esi,%edx
imul   %esi,%edx
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Please enter an integer > \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"The square of %d is %d\0A\00"
define void @square1() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 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
%5 = load i32, i32* %1
%6 = load i32, i32* %1
%7 = mul nsw i32 %5, %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %4, i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Please enter an integer > \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"The square of %d is %d\0A\00"
define void @square1() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 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
%6 = mul nsw i32 %5, %5
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %6)
ret void
}
/* Type definitions */
struct in6_addr {
  int dummy;
};

/* Variables and functions */
scalar_t__ bce_type(struct in6_addr const *, struct in6_addr const *);
int bce_exists(const struct in6_addr *our_addr,
               const struct in6_addr *peer_addr) {
  return bce_type(our_addr, peer_addr) >= 0;
}


x86 assembly (clang, -O0):
<bce_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <bce_type@plt>
cmp    $0x0,%rax
setge  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bce_exists>:
push   %rax
call   1030 <bce_type@plt>
shr    $0x3f,%rax
xor    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.in6_addr = type { i32 }
define i32 @bce_exists(%struct.in6_addr* %0, %struct.in6_addr* %1) {
%3 = alloca %struct.in6_addr*
%4 = alloca %struct.in6_addr*
store %struct.in6_addr* %0, %struct.in6_addr** %3
store %struct.in6_addr* %1, %struct.in6_addr** %4
%5 = load %struct.in6_addr*, %struct.in6_addr** %3
%6 = load %struct.in6_addr*, %struct.in6_addr** %4
%7 = call i64 @bce_type(%struct.in6_addr* %5, %struct.in6_addr* %6)
%8 = icmp sge i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
%struct.in6_addr = type { i32 }
define i32 @bce_exists(%struct.in6_addr* %0, %struct.in6_addr* %1) {
%3 = tail call i64 @bce_type(%struct.in6_addr* %0, %struct.in6_addr* %1)
%4 = lshr i64 %3, 63
%5 = trunc i64 %4 to i32
%6 = xor i32 %5, 1
ret i32 %6
}
int z(double i) { return i < (i + (-2.0)); }


x86 assembly (clang, -O0):
<z>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  0xeea(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<z>:
movsd  0xef8(%rip),%xmm1
addsd  %xmm0,%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
ret

LLVM IR (-O0):
define i32 @z(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fadd double %4, -2.000000e+00
%6 = fcmp olt double %3, %5
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @z(double %0) {
%2 = fadd double %0, -2.000000e+00
%3 = fcmp ogt double %2, %0
%4 = zext i1 %3 to i32
ret i32 %4
}
int isroot(x, y)
short x;
unsigned int y;
{ return x == 1; }


x86 assembly (clang, -O0):
<isroot>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
movswl -0x2(%rbp),%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isroot>:
xor    %eax,%eax
cmp    $0x1,%di
sete   %al
ret

LLVM IR (-O0):
define i32 @isroot(i32 %0, i32 %1) {
%3 = alloca i16
%4 = alloca i32
%5 = trunc i32 %0 to i16
store i16 %5, i16* %3
store i32 %1, i32* %4
%6 = load i16, i16* %3
%7 = sext i16 %6 to i32
%8 = icmp eq i32 %7, 1
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @isroot(i32 %0, i32 %1) {
%3 = and i32 %0, 65535
%4 = icmp eq i32 %3, 1
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int strlen(char *str) {
  int counter = 0;
  char *pc = str;
  while (*pc != (void *)0) {
    counter++;
    pc++;
  }
  return counter;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbq (%rax),%rax
cmp    $0x0,%rax
je     1143 <strlen+0x43>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <strlen+0x17>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111c <strlen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %8, %4 ], [ %0, %1 ]
%6 = phi i32 [ %7, %4 ], [ 0, %1 ]
%7 = add nuw nsw i32 %6, 1
%8 = getelementptr inbounds i8, i8* %5, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *yamalloc(size_t);
void *yacalloc(size_t nelem, size_t elsize) {
  if (nelem == 0)
    return NULL;
  size_t size = nelem * elsize;
  void *ptr = yamalloc(size);
  if (!ptr)
    return NULL;
  memset(ptr, 0, size);
  return ptr;
}


x86 assembly (clang, -O0):
<yacalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1148 <yacalloc+0x28>
movq   $0x0,-0x8(%rbp)
jmp    1191 <yacalloc+0x71>
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <yamalloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    117a <yacalloc+0x5a>
movq   $0x0,-0x8(%rbp)
jmp    1191 <yacalloc+0x71>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yacalloc>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     114f <yacalloc+0x2f>
mov    %rsi,%rbx
imul   %rdi,%rbx
mov    %rbx,%rdi
call   1040 <yamalloc@plt>
test   %rax,%rax
je     114f <yacalloc+0x2f>
mov    %rax,%r14
mov    %rax,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
jmp    1152 <yacalloc+0x32>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @yacalloc(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = mul i64 %1, %0
%6 = tail call i8* @yamalloc(i64 %5)
%7 = icmp eq i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @memset(i8* %6, i32 0, i64 %5)
br label %10
10: ; preds = %8, %4, %2
%11 = phi i8* [ null, %2 ], [ %6, %8 ], [ null, %4 ]
ret i8* %11
}
void bitmapUnset(char *bitmap, int idx) {
  int bit_mask[8] = {128, 64, 32, 16, 8, 4, 2, 1};
  bitmap[idx / 8] = bitmap[idx / 8] & ~bit_mask[idx % 8];
}


x86 assembly (clang, -O0):
<bitmapUnset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0xeee(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeeb(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xee8(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xee5(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x48(%rbp),%rax
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x40(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x40(%rbp),%eax
movslq %edx,%rcx
mov    -0x30(%rbp,%rcx,4),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %al,-0x39(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x39(%rbp),%dl
mov    %eax,%ecx
mov    -0x38(%rbp),%rax
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitmapUnset>:
lea    0x7(%rsi),%eax
test   %esi,%esi
cmovns %esi,%eax
mov    %eax,%ecx
sar    $0x3,%ecx
movslq %ecx,%rcx
and    $0xfffffff8,%eax
sub    %eax,%esi
movslq %esi,%rax
lea    0xee1(%rip),%rdx
mov    (%rdx,%rax,4),%al
not    %al
and    %al,(%rdi,%rcx,1)
ret

LLVM IR (-O0):
@__const.bitmapUnset.bit_mask = [8 x i32] [i32 128, i32 64, i32 32, i32 16, i32 8, i32 4, i32 2, i32 1]
define void @bitmapUnset(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [8 x i32]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = bitcast [8 x i32]* %5 to i8*
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = sdiv i32 %8, 8
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %7, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = load i32, i32* %4
%15 = srem i32 %14, 8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [8 x i32], [8 x i32]* %5, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = xor i32 %18, -1
%20 = and i32 %13, %19
%21 = trunc i32 %20 to i8
%22 = load i8*, i8** %3
%23 = load i32, i32* %4
%24 = sdiv i32 %23, 8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %22, i64 %25
store i8 %21, i8* %26
ret void
}

LLVM IR (-O2):
@__const.bitmapUnset.bit_mask = [8 x i32] [i32 128, i32 64, i32 32, i32 16, i32 8, i32 4, i32 2, i32 1]
define void @bitmapUnset(i8* nocapture %0, i32 %1) {
%3 = sdiv i32 %1, 8
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = srem i32 %1, 8
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [8 x i32], [8 x i32]* @__const.bitmapUnset.bit_mask, i64 0, i64 %8
%10 = load i32, i32* %9
%11 = trunc i32 %10 to i8
%12 = xor i8 %11, -1
%13 = and i8 %6, %12
store i8 %13, i8* %5
ret void
}
double dabs(double val) { return (val < 0 ? -val : val); }


x86 assembly (clang, -O0):
<dabs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    113d <dabs+0x3d>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1147 <dabs+0x47>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dabs>:
movapd 0xef8(%rip),%xmm2
xorpd  %xmm0,%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @dabs(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp olt double %3, 0.000000e+00
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load double, double* %2
%7 = fneg double %6
br label %10
8: ; preds = %1
%9 = load double, double* %2
br label %10
10: ; preds = %8, %5
%11 = phi double [ %7, %5 ], [ %9, %8 ]
ret double %11
}

LLVM IR (-O2):
define double @dabs(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %3, double %0
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ pthread_self();
int pthread_setname_np(int /*<<< orphan*/, char *);
int main() { return pthread_setname_np(pthread_self(), "abc"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %eax,%edi
lea    0xec1(%rip),%rsi
call   1030 <pthread_setname_np@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <pthread_self@plt>
lea    0xed1(%rip),%rsi
mov    %eax,%edi
pop    %rax
jmp    1030 <pthread_setname_np@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
define i32 @main() {
%1 = tail call i32 (...) @pthread_self()
%2 = tail call i32 @pthread_setname_np(i32 %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
int isupper(int c) { return (((c >= 'A') && (c <= 'Z')) ? (1) : (0)); }


x86 assembly (clang, -O0):
<isupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x41,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <isupper+0x20>
cmpl   $0x5a,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isupper>:
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @isupper(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 65
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 90
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 1, i32 0
ret i32 %11
}

LLVM IR (-O2):
define i32 @isupper(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
int f() {
  int c = 0;
  while (1) {
    if (c > 10)
      return c;
    c++;
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jle    111a <f+0x1a>
mov    -0x4(%rbp),%eax
pop    %rbp
ret
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <f+0xb>

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

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

LLVM IR (-O2):
define i32 @f() {
ret i32 11
}
float percentage(unsigned long long *free, unsigned long long *total) {
  unsigned long long result = (*free) * (unsigned long long)1000 / (*total);
  return result / 10.0;
}


x86 assembly (clang, -O0):
<percentage>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
imul   $0x3e8,%rax,%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rcx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x18(%rbp)
movaps 0xedf(%rip),%xmm1
movq   -0x18(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xede(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xea7(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<percentage>:
imul   $0x3e8,(%rdi),%rax
mov    (%rsi),%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
je     111d <percentage+0x1d>
xor    %edx,%edx
div    %rcx
jmp    1121 <percentage+0x21>
xor    %edx,%edx
div    %ecx
movq   %rax,%xmm0
punpckldq 0xed2(%rip),%xmm0
subpd  0xeda(%rip),%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  0xed6(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @percentage(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca i64
store i64* %0, i64** %3
store i64* %1, i64** %4
%6 = load i64*, i64** %3
%7 = load i64, i64* %6
%8 = mul i64 %7, 1000
%9 = load i64*, i64** %4
%10 = load i64, i64* %9
%11 = udiv i64 %8, %10
store i64 %11, i64* %5
%12 = load i64, i64* %5
%13 = uitofp i64 %12 to double
%14 = fdiv double %13, 1.000000e+01
%15 = fptrunc double %14 to float
ret float %15
}

LLVM IR (-O2):
define float @percentage(i64* nocapture %0, i64* nocapture %1) {
%3 = load i64, i64* %0
%4 = mul i64 %3, 1000
%5 = load i64, i64* %1
%6 = udiv i64 %4, %5
%7 = uitofp i64 %6 to double
%8 = fdiv double %7, 1.000000e+01
%9 = fptrunc double %8 to float
ret float %9
}
/* Type definitions */
typedef int uint32_t;
typedef unsigned short uint16_t;

/* Variables and functions */
void ADI16BitsSet(uint32_t ui32Base, uint32_t ui32Reg, uint16_t ui16Val) {
  uint32_t ui32RegOffset;
  ;
  ;
  ui32RegOffset = 0x00000010;
  (*((volatile unsigned short *)(ui32Base + ui32RegOffset +
                                 (ui32Reg & 0xFE)))) = ui16Val;
}


x86 assembly (clang, -O0):
<ADI16BitsSet>:
push   %rbp
mov    %rsp,%rbp
mov    %dx,%ax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
movl   $0x10,-0x10(%rbp)
mov    -0xa(%rbp),%cx
mov    -0x4(%rbp),%eax
add    -0x10(%rbp),%eax
mov    -0x8(%rbp),%edx
and    $0xfe,%edx
add    %edx,%eax
cltq
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADI16BitsSet>:
movslq %edi,%rax
and    $0xfe,%esi
mov    %dx,0x10(%rax,%rsi,1)
ret

LLVM IR (-O0):
define void @ADI16BitsSet(i32 %0, i32 %1, i16 zeroext %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i16
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i16 %2, i16* %6
store i32 16, i32* %7
%8 = load i16, i16* %6
%9 = load i32, i32* %4
%10 = load i32, i32* %7
%11 = add nsw i32 %9, %10
%12 = load i32, i32* %5
%13 = and i32 %12, 254
%14 = add nsw i32 %11, %13
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i16*
store volatile i16 %8, i16* %16
ret void
}

LLVM IR (-O2):
define void @ADI16BitsSet(i32 %0, i32 %1, i16 zeroext %2) {
%4 = add nsw i32 %0, 16
%5 = and i32 %1, 254
%6 = add nsw i32 %4, %5
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i16*
store volatile i16 %2, i16* %8
ret void
}