xunge/DecIR huggingface dataset:
/* Variables and functions */
char *gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  char name[81];
  char *ptr;
  printf("Hi, what's your name?\n");
  ptr = gets(name);
  printf("%s? Ah! %s!\n", name, ptr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1040 <gets@plt>
mov    %rax,-0x68(%rbp)
lea    -0x60(%rbp),%rsi
mov    -0x68(%rbp),%rdx
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
lea    0xead(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Hi, what's your name?\0A\00"
@.str.1 = [13 x i8] c"%s? Ah! %s!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [81 x i8]
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%6 = call i8* @gets(i8* %5)
store i8* %6, i8** %3
%7 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%8 = load i8*, i8** %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %7, i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c"%s? Ah! %s!\0A\00"
@str = [22 x i8] c"Hi, what's your name?\00"
define i32 @main() {
%1 = alloca [81 x i8]
%2 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%4 = call i8* @gets(i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %4)
ret i32 0
}
/* Variables and functions */
float float32_read(unsigned char *);
void bf2f_array(float *buffer, unsigned int count) {
  int k;
  for (k = 0; k < count; k++)
    buffer[k] = float32_read((unsigned char *)(buffer + k));
}


x86 assembly (clang, -O0):
<bf2f_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1161 <bf2f_array+0x51>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <float32_read@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <bf2f_array+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bf2f_array>:
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
je     1136 <bf2f_array+0x26>
mov    %rdi,%rbx
mov    %esi,%r14d
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <float32_read@plt>
movss  %xmm0,(%rbx)
add    $0x4,%rbx
add    $0xffffffffffffffff,%r14
jne    1120 <bf2f_array+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @bf2f_array(float* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds float, float* %0, i64 %7
%9 = bitcast float* %8 to i8*
%10 = tail call float @float32_read(i8* %9)
store float %10, float* %8
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
float fmod(float, float);
float emod(float a, float b) {
  float v = fmod(a, b);
  if ((b < 0) != (v < 0)) {
    v += b;
  }
  return v;
}


x86 assembly (clang, -O0):
<emod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <fmod@plt>
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
xorps  %xmm0,%xmm0
ucomiss -0xc(%rbp),%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
cmp    %ecx,%eax
je     116c <emod+0x5c>
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emod>:
push   %rax
movss  %xmm1,0x4(%rsp)
call   1030 <fmod@plt>
movss  0x4(%rsp),%xmm2
xorps  %xmm1,%xmm1
ucomiss %xmm2,%xmm1
setbe  %al
ucomiss %xmm0,%xmm1
seta   %cl
xor    %al,%cl
je     113d <emod+0x2d>
movss  0xec3(%rip),%xmm2
addss  %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @emod(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = load float, float* %4
%8 = call float @fmod(float %6, float %7)
store float %8, float* %5
%9 = load float, float* %4
%10 = fcmp olt float %9, 0.000000e+00
%11 = zext i1 %10 to i32
%12 = load float, float* %5
%13 = fcmp olt float %12, 0.000000e+00
%14 = zext i1 %13 to i32
%15 = icmp ne i32 %11, %14
br i1 %15, label %16, label %20
16: ; preds = %2
%17 = load float, float* %4
%18 = load float, float* %5
%19 = fadd float %18, %17
store float %19, float* %5
br label %20
20: ; preds = %16, %2
%21 = load float, float* %5
ret float %21
}

LLVM IR (-O2):
define float @emod(float %0, float %1) {
%3 = tail call float @fmod(float %0, float %1)
%4 = fcmp uge float %1, 0.000000e+00
%5 = fcmp olt float %3, 0.000000e+00
%6 = xor i1 %4, %5
%7 = select i1 %6, float -0.000000e+00, float %1
%8 = fadd float %3, %7
ret float %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Prva rechenica.\n");
  printf("Vtora rechenica.\nTreta rechenica.");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str.1 = [34 x i8] c"Vtora rechenica.\0ATreta rechenica.\00"
@str = [16 x i8] c"Prva rechenica.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int ioctl(int, int, int *);
int /*<<< orphan*/ printf(char *, int);
int ioctl_get_msg(int file_desc) {
  int ret_val;
  int seq;
  ret_val = ioctl(file_desc, 2, &seq);
  if (ret_val < 0) {
    printf("ioctl_get_msg failed:%d\n", ret_val);
    exit(-1);
  }
  printf("get_msg message:%d\n", seq);
  return ret_val;
}


x86 assembly (clang, -O0):
<ioctl_get_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
lea    -0xc(%rbp),%rdx
call   1040 <ioctl@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1172 <ioctl_get_msg+0x42>
mov    -0x8(%rbp),%esi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0xc(%rbp),%esi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ioctl_get_msg>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rdx
mov    $0x2,%esi
call   1040 <ioctl@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1162 <ioctl_get_msg+0x32>
mov    0xc(%rsp),%esi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe97(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"ioctl_get_msg failed:%d\0A\00"
@.str.1 = [20 x i8] c"get_msg message:%d\0A\00"
define i32 @ioctl_get_msg(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @ioctl(i32 %5, i32 2, i32* %4)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i32, i32* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @exit(i32 -1)
unreachable
13: ; preds = %1
%14 = load i32, i32* %4
%15 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@.str = [25 x i8] c"ioctl_get_msg failed:%d\0A\00"
@.str.1 = [20 x i8] c"get_msg message:%d\0A\00"
define i32 @ioctl_get_msg(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @ioctl(i32 %0, i32 2, i32* %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %4)
%8 = call i32 @exit(i32 -1)
unreachable
9: ; preds = %1
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void failure() { printf("There was an unexpected error.\n"); }


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"There was an unexpected error.\0A\00"
define void @failure() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [31 x i8] c"There was an unexpected error.\00"
define void @failure() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ genrand_int32();
unsigned int get_rand(unsigned int max, unsigned int mask) {
  unsigned int rand = (unsigned int)genrand_int32() & mask;
  while (rand > max)
    rand = (unsigned int)genrand_int32() & mask;
  return rand;
}


x86 assembly (clang, -O0):
<get_rand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <genrand_int32@plt>
and    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jbe    1149 <get_rand+0x39>
mov    $0x0,%al
call   1030 <genrand_int32@plt>
and    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    112b <get_rand+0x1b>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_rand>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <genrand_int32@plt>
and    %ebx,%eax
cmp    %ebp,%eax
ja     1120 <get_rand+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_rand(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i64 (...) @genrand_int32()
%7 = trunc i64 %6 to i32
%8 = load i32, i32* %4
%9 = and i32 %7, %8
store i32 %9, i32* %5
br label %10
10: ; preds = %14, %2
%11 = load i32, i32* %5
%12 = load i32, i32* %3
%13 = icmp ugt i32 %11, %12
br i1 %13, label %14, label %19
14: ; preds = %10
%15 = call i64 (...) @genrand_int32()
%16 = trunc i64 %15 to i32
%17 = load i32, i32* %4
%18 = and i32 %16, %17
store i32 %18, i32* %5
br label %10
19: ; preds = %10
%20 = load i32, i32* %5
ret i32 %20
}

LLVM IR (-O2):
define i32 @get_rand(i32 %0, i32 %1) {
%3 = tail call i64 (...) @genrand_int32()
%4 = trunc i64 %3 to i32
%5 = and i32 %4, %1
%6 = icmp ugt i32 %5, %0
br i1 %6, label %7, label %12
7: ; preds = %2, %7
%8 = tail call i64 (...) @genrand_int32()
%9 = trunc i64 %8 to i32
%10 = and i32 %9, %1
%11 = icmp ugt i32 %10, %0
br i1 %11, label %7, label %12
12: ; preds = %7, %2
%13 = phi i32 [ %5, %2 ], [ %10, %7 ]
ret i32 %13
}
/* Type definitions */
struct strexParse {
  int dummy;
};
struct strexIn {
  int dummy;
};

/* Variables and functions */
struct strexParse *strexParseConditional(struct strexIn *);
struct strexParse *strexParseExpression(struct strexIn *in) {
  return strexParseConditional(in);
}


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

x86 assembly (clang, -O2):
<strexParseExpression>:
jmp    1030 <strexParseConditional@plt>

LLVM IR (-O0):
%struct.strexParse = type { i32 }
%struct.strexIn = type { i32 }
define %struct.strexParse* @strexParseExpression(%struct.strexIn* %0) {
%2 = alloca %struct.strexIn*
store %struct.strexIn* %0, %struct.strexIn** %2
%3 = load %struct.strexIn*, %struct.strexIn** %2
%4 = call %struct.strexParse* @strexParseConditional(%struct.strexIn* %3)
ret %struct.strexParse* %4
}

LLVM IR (-O2):
%struct.strexParse = type { i32 }
%struct.strexIn = type { i32 }
define %struct.strexParse* @strexParseExpression(%struct.strexIn* %0) {
%2 = tail call %struct.strexParse* @strexParseConditional(%struct.strexIn* %0)
ret %struct.strexParse* %2
}
/* Type definitions */
struct sched_param {
  int dummy;
};
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __sched_setparam(pid_t pid, const struct sched_param *param) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<__sched_setparam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sched_setparam>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sched_param = type { i32 }
@ENOSYS = global i32 0
define i32 @__sched_setparam(i32 %0, %struct.sched_param* %1) {
%3 = alloca i32
%4 = alloca %struct.sched_param*
store i32 %0, i32* %3
store %struct.sched_param* %1, %struct.sched_param** %4
%5 = load i32, i32* @ENOSYS
%6 = call i32 @__set_errno(i32 %5)
ret i32 -1
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
@ENOSYS = global i32 0
define i32 @__sched_setparam(i32 %0, %struct.sched_param* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
%4 = tail call i32 @__set_errno(i32 %3)
ret i32 -1
}
/* Variables and functions */
int number_occurrences_char(int, char *);
int count_characters(int char_to_count, char *source) {
  return number_occurrences_char(char_to_count, source);
}


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

x86 assembly (clang, -O2):
<count_characters>:
jmp    1030 <number_occurrences_char@plt>

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

LLVM IR (-O2):
define i32 @count_characters(i32 %0, i8* %1) {
%3 = tail call i32 @number_occurrences_char(i32 %0, i8* %1)
ret i32 %3
}
int test_imm_A9uint16_mem(unsigned short *val) {
  return ((*val) & (-0xA9 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_A9uint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edx
and    $0xffffff57,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_A9uint16_mem>:
movzwl (%rdi),%eax
test   $0xff57,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_A9uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -169
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
struct sockaddr_un {
  int dummy;
};
struct sockaddr_ipx {
  int dummy;
};
struct sockaddr_in6 {
  int dummy;
};
struct sockaddr_in {
  int dummy;
};
typedef int sa_family_t;

/* Variables and functions */
#define AF_INET 131
#define AF_INET6 130
#define AF_IPX 129
#define AF_LOCAL 128
int __libc_sa_len(sa_family_t af) {
  switch (af) {
  case AF_INET:
    return sizeof(struct sockaddr_in);
  case AF_INET6:
    return sizeof(struct sockaddr_in6);
  case AF_IPX:
    return sizeof(struct sockaddr_ipx);
  case AF_LOCAL:
    return sizeof(struct sockaddr_un);
  }
  return 0;
}


x86 assembly (clang, -O0):
<__libc_sa_len>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     1160 <__libc_sa_len+0x60>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x4,-0x4(%rbp)
jmp    1167 <__libc_sa_len+0x67>
movl   $0x4,-0x4(%rbp)
jmp    1167 <__libc_sa_len+0x67>
movl   $0x4,-0x4(%rbp)
jmp    1167 <__libc_sa_len+0x67>
movl   $0x4,-0x4(%rbp)
jmp    1167 <__libc_sa_len+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__libc_sa_len>:
and    $0xfffffffc,%edi
xor    %eax,%eax
cmp    $0x80,%edi
sete   %al
shl    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @__libc_sa_len(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %9 [
i32 131, label %5
i32 130, label %6
i32 129, label %7
i32 128, label %8
]
5: ; preds = %1
store i32 4, i32* %2
br label %10
6: ; preds = %1
store i32 4, i32* %2
br label %10
7: ; preds = %1
store i32 4, i32* %2
br label %10
8: ; preds = %1
store i32 4, i32* %2
br label %10
9: ; preds = %1
store i32 0, i32* %2
br label %10
10: ; preds = %9, %8, %7, %6, %5
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
define i32 @__libc_sa_len(i32 %0) {
%2 = and i32 %0, -4
%3 = icmp eq i32 %2, 128
%4 = select i1 %3, i32 4, i32 0
ret i32 %4
}
/* Variables and functions */
char *gs_sdel(char *, size_t, int);
char *gs_cdel(char *string, size_t pos) { return gs_sdel(string, pos, 1); }


x86 assembly (clang, -O0):
<gs_cdel>:
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    $0x1,%edx
call   1030 <gs_sdel@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gs_cdel>:
mov    $0x1,%edx
jmp    1030 <gs_sdel@plt>

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

LLVM IR (-O2):
define i8* @gs_cdel(i8* %0, i64 %1) {
%3 = tail call i8* @gs_sdel(i8* %0, i64 %1, i32 1)
ret i8* %3
}
/* Type definitions */
struct iovec {
  int dummy;
};
struct io_uring_sqe {
  int dummy;
};
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ io_uring_prep_rw(int, struct io_uring_sqe *, int,
                                    struct iovec const *, unsigned int,
                                    int /*<<< orphan*/);
void io_uring_prep_readv(struct io_uring_sqe *sqe, int fd,
                         const struct iovec *iovecs, unsigned nr_vecs,
                         off_t offset) {
  io_uring_prep_rw(1, sqe, fd, iovecs, nr_vecs, offset);
}


x86 assembly (clang, -O0):
<io_uring_prep_readv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
mov    $0x1,%edi
call   1030 <io_uring_prep_rw@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_uring_prep_readv>:
mov    %r8d,%r9d
mov    %ecx,%r8d
mov    %rdx,%rcx
mov    %esi,%edx
mov    %rdi,%rsi
mov    $0x1,%edi
jmp    1030 <io_uring_prep_rw@plt>

LLVM IR (-O0):
%struct.io_uring_sqe = type { i32 }
%struct.iovec = type { i32 }
define void @io_uring_prep_readv(%struct.io_uring_sqe* %0, i32 %1, %struct.iovec* %2, i32 %3, i32 %4) {
%6 = alloca %struct.io_uring_sqe*
%7 = alloca i32
%8 = alloca %struct.iovec*
%9 = alloca i32
%10 = alloca i32
store %struct.io_uring_sqe* %0, %struct.io_uring_sqe** %6
store i32 %1, i32* %7
store %struct.iovec* %2, %struct.iovec** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load %struct.io_uring_sqe*, %struct.io_uring_sqe** %6
%12 = load i32, i32* %7
%13 = load %struct.iovec*, %struct.iovec** %8
%14 = load i32, i32* %9
%15 = load i32, i32* %10
%16 = call i32 @io_uring_prep_rw(i32 1, %struct.io_uring_sqe* %11, i32 %12, %struct.iovec* %13, i32 %14, i32 %15)
ret void
}

LLVM IR (-O2):
%struct.io_uring_sqe = type { i32 }
%struct.iovec = type { i32 }
define void @io_uring_prep_readv(%struct.io_uring_sqe* %0, i32 %1, %struct.iovec* %2, i32 %3, i32 %4) {
%6 = tail call i32 @io_uring_prep_rw(i32 1, %struct.io_uring_sqe* %0, i32 %1, %struct.iovec* %2, i32 %3, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mira();
int /*<<< orphan*/ tekprom();
int /*<<< orphan*/ tekvrom();
void M90Restore(int version) {
  tekprom();
  tekvrom();
  mira();
}


x86 assembly (clang, -O0):
<M90Restore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <tekprom@plt>
mov    $0x0,%al
call   1040 <tekvrom@plt>
mov    $0x0,%al
call   1050 <mira@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M90Restore>:
push   %rax
xor    %eax,%eax
call   1030 <tekprom@plt>
xor    %eax,%eax
call   1040 <tekvrom@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <mira@plt>

LLVM IR (-O0):
define void @M90Restore(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @tekprom()
%4 = call i32 (...) @tekvrom()
%5 = call i32 (...) @mira()
ret void
}

LLVM IR (-O2):
define void @M90Restore(i32 %0) {
%2 = tail call i32 (...) @tekprom()
%3 = tail call i32 (...) @tekvrom()
%4 = tail call i32 (...) @mira()
ret void
}
int getBreak(int *context) { return *(context + 8); }


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

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

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

LLVM IR (-O2):
define i32 @getBreak(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 8
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ binderfs_test_privileged();
int /*<<< orphan*/ binderfs_test_unprivileged();
int /*<<< orphan*/ ksft_exit_pass();
int main(int argc, char *argv[]) {
  binderfs_test_privileged();
  binderfs_test_unprivileged();
  ksft_exit_pass();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <binderfs_test_privileged@plt>
mov    $0x0,%al
call   1050 <binderfs_test_unprivileged@plt>
mov    $0x0,%al
call   1040 <ksft_exit_pass@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @binderfs_test_privileged()
%6 = call i32 (...) @binderfs_test_unprivileged()
%7 = call i32 (...) @ksft_exit_pass()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @binderfs_test_privileged()
%4 = tail call i32 (...) @binderfs_test_unprivileged()
%5 = tail call i32 (...) @ksft_exit_pass()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void sigusr1_hdlr(int x) { printf("Got SIGUSR1\n"); }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"Got SIGUSR1\0A\00"
define void @sigusr1_hdlr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [12 x i8] c"Got SIGUSR1\00"
define void @sigusr1_hdlr(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ isdigit(char);
scalar_t__ isxdigit(char);
char tolower(char);
char hex(char v) {
  if (isdigit(v))
    return v - '0';
  else if (isxdigit(v))
    return (tolower(v) - 'a' + 10);
  else
    return 0;
}


x86 assembly (clang, -O0):
<hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1160 <hex+0x30>
movsbl -0x2(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x1(%rbp)
jmp    1191 <hex+0x61>
movsbl -0x2(%rbp),%edi
call   1050 <isxdigit@plt>
cmp    $0x0,%rax
je     118d <hex+0x5d>
movsbl -0x2(%rbp),%edi
call   1040 <tolower@plt>
movsbl %al,%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %al,-0x1(%rbp)
jmp    1191 <hex+0x61>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex>:
push   %rbx
mov    %edi,%ebx
call   1030 <isdigit@plt>
test   %rax,%rax
je     1142 <hex+0x12>
lea    -0x30(%rbx),%eax
pop    %rbx
ret
movsbl %bl,%ebx
mov    %ebx,%edi
call   1050 <isxdigit@plt>
test   %rax,%rax
je     115c <hex+0x2c>
mov    %ebx,%edi
call   1040 <tolower@plt>
add    $0xa9,%al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @hex(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = call i64 @isdigit(i8 signext %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %9, 48
%11 = trunc i32 %10 to i8
store i8 %11, i8* %2
br label %24
12: ; preds = %1
%13 = load i8, i8* %3
%14 = call i64 @isxdigit(i8 signext %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %23
16: ; preds = %12
%17 = load i8, i8* %3
%18 = call signext i8 @tolower(i8 signext %17)
%19 = sext i8 %18 to i32
%20 = sub nsw i32 %19, 97
%21 = add nsw i32 %20, 10
%22 = trunc i32 %21 to i8
store i8 %22, i8* %2
br label %24
23: ; preds = %12
store i8 0, i8* %2
br label %24
24: ; preds = %23, %16, %7
%25 = load i8, i8* %2
ret i8 %25
}

LLVM IR (-O2):
define signext i8 @hex(i8 signext %0) {
%2 = tail call i64 @isdigit(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = add i8 %0, -48
br label %12
6: ; preds = %1
%7 = tail call i64 @isxdigit(i8 signext %0)
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = tail call signext i8 @tolower(i8 signext %0)
%11 = add i8 %10, -87
br label %12
12: ; preds = %6, %9, %4
%13 = phi i8 [ %5, %4 ], [ %11, %9 ], [ 0, %6 ]
ret i8 %13
}
void caller_1_1_2_2_1_2_2() {}


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

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

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

LLVM IR (-O2):
define void @caller_1_1_2_2_1_2_2() {
ret void
}
float CG_OpFuncAND(const float a, const float b) { return (int)a & (int)b; }


x86 assembly (clang, -O0):
<CG_OpFuncAND>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
cvttss2si -0x4(%rbp),%eax
cvttss2si -0x8(%rbp),%ecx
and    %ecx,%eax
cvtsi2ss %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<CG_OpFuncAND>:
cvttss2si %xmm0,%eax
cvttss2si %xmm1,%ecx
and    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2ss %ecx,%xmm0
ret

LLVM IR (-O0):
define float @CG_OpFuncAND(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 = fptosi float %5 to i32
%7 = load float, float* %4
%8 = fptosi float %7 to i32
%9 = and i32 %6, %8
%10 = sitofp i32 %9 to float
ret float %10
}

LLVM IR (-O2):
define float @CG_OpFuncAND(float %0, float %1) {
%3 = fptosi float %0 to i32
%4 = fptosi float %1 to i32
%5 = and i32 %4, %3
%6 = sitofp i32 %5 to float
ret float %6
}
void dma_buf_stats_teardown(struct dma_buf *dmabuf) {}


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

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

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

LLVM IR (-O2):
%struct.dma_buf = type opaque
define void @dma_buf_stats_teardown(%struct.dma_buf* nocapture %0) {
ret void
}
/* Type definitions */
struct tms {
  int tms_utime;
  int tms_stime;
};
typedef int clock_t;

/* Variables and functions */
int CLOCKS_PER_SEC;
int times(struct tms *);
clock_t clock(void) {
  struct tms s;
  clock_t res;
  if ((res = times(&s)) != (clock_t)-1)
    res = (s.tms_utime + s.tms_stime) * (CLOCKS_PER_SEC / 100);
  return res;
}


x86 assembly (clang, -O0):
<clock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1030 <times@plt>
mov    %eax,-0xc(%rbp)
cmp    $0xffffffff,%eax
je     1152 <clock+0x42>
mov    -0x8(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    0x2eab(%rip),%rax
mov    (%rax),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clock>:
push   %rax
mov    %rsp,%rdi
call   1030 <times@plt>
cmp    $0xffffffff,%eax
je     1148 <clock+0x38>
mov    0x4(%rsp),%ecx
add    (%rsp),%ecx
mov    0x2ebc(%rip),%rax
movslq (%rax),%rax
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rax
add    %edx,%eax
imul   %ecx,%eax
pop    %rcx
ret
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.tms = type { i32, i32 }
@CLOCKS_PER_SEC = global i32 0
define i32 @clock() {
%1 = alloca %struct.tms
%2 = alloca i32
%3 = call i32 @times(%struct.tms* %1)
store i32 %3, i32* %2
%4 = icmp ne i32 %3, -1
br i1 %4, label %5, label %14
5: ; preds = %0
%6 = getelementptr inbounds %struct.tms, %struct.tms* %1, i32 0, i32 0
%7 = load i32, i32* %6
%8 = getelementptr inbounds %struct.tms, %struct.tms* %1, i32 0, i32 1
%9 = load i32, i32* %8
%10 = add nsw i32 %7, %9
%11 = load i32, i32* @CLOCKS_PER_SEC
%12 = sdiv i32 %11, 100
%13 = mul nsw i32 %10, %12
store i32 %13, i32* %2
br label %14
14: ; preds = %5, %0
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
%struct.tms = type { i32, i32 }
@CLOCKS_PER_SEC = global i32 0
define i32 @clock() {
%1 = alloca %struct.tms
%2 = bitcast %struct.tms* %1 to i8*
%3 = call i32 @times(%struct.tms* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %14, label %5
5: ; preds = %0
%6 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 1
%9 = load i32, i32* %8
%10 = add nsw i32 %9, %7
%11 = load i32, i32* @CLOCKS_PER_SEC
%12 = sdiv i32 %11, 100
%13 = mul nsw i32 %12, %10
br label %14
14: ; preds = %5, %0
%15 = phi i32 [ %13, %5 ], [ -1, %0 ]
ret i32 %15
}
int add(int a, long b) { return a + b; }


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movslq -0x4(%rbp),%rax
add    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<add>:
lea    (%rsi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @add(i32 %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = add i32 %3, %0
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
int bit_count(uint64_t n) {
  int count;
  for (count = 0; n; count++)
    n &= n - 1;
  return count;
}


x86 assembly (clang, -O0):
<bit_count>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1138 <bit_count+0x38>
mov    -0x8(%rbp),%rax
sub    $0x1,%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <bit_count+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @bit_count(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i64, i64* %2
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i64, i64* %2
%9 = sub nsw i64 %8, 1
%10 = load i64, i64* %2
%11 = and i64 %10, %9
store i64 %11, i64* %2
br label %12
12: ; preds = %7
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @bit_count(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i64 [ %7, %3 ], [ %0, %1 ]
%6 = add nsw i64 %5, -1
%7 = and i64 %6, %5
%8 = add nuw nsw i32 %4, 1
%9 = icmp eq i64 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %11
}
long extract_tbr(unsigned long insn, int *invalid) {
  long ret;
  ret = ((insn >> 16) & 0x1f) | ((insn >> 6) & 0x3e0);
  if (ret == (268))
    ret = 0;
  return ret;
}


x86 assembly (clang, -O0):
<extract_tbr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x10,%rax
and    $0x1f,%rax
mov    -0x8(%rbp),%rcx
shr    $0x6,%rcx
and    $0x3e0,%rcx
or     %rcx,%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x10c,-0x18(%rbp)
jne    1144 <extract_tbr+0x44>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_tbr>:
mov    %edi,%ecx
shr    $0x10,%ecx
and    $0x1f,%ecx
shr    $0x6,%rdi
and    $0x3e0,%edi
or     %rdi,%rcx
xor    %eax,%eax
cmp    $0x10c,%rcx
cmovne %rcx,%rax
ret

LLVM IR (-O0):
define i64 @extract_tbr(i64 %0, i32* %1) {
%3 = alloca i64
%4 = alloca i32*
%5 = alloca i64
store i64 %0, i64* %3
store i32* %1, i32** %4
%6 = load i64, i64* %3
%7 = lshr i64 %6, 16
%8 = and i64 %7, 31
%9 = load i64, i64* %3
%10 = lshr i64 %9, 6
%11 = and i64 %10, 992
%12 = or i64 %8, %11
store i64 %12, i64* %5
%13 = load i64, i64* %5
%14 = icmp eq i64 %13, 268
br i1 %14, label %15, label %16
15: ; preds = %2
store i64 0, i64* %5
br label %16
16: ; preds = %15, %2
%17 = load i64, i64* %5
ret i64 %17
}

LLVM IR (-O2):
define i64 @extract_tbr(i64 %0, i32* nocapture readnone %1) {
%3 = lshr i64 %0, 16
%4 = and i64 %3, 31
%5 = lshr i64 %0, 6
%6 = and i64 %5, 992
%7 = or i64 %4, %6
%8 = icmp eq i64 %7, 268
%9 = select i1 %8, i64 0, i64 %7
ret i64 %9
}
unsigned short htons(unsigned short n) {
  return ((n & 0xFF) << 8) | ((n & 0xFF00) >> 8);
}


x86 assembly (clang, -O0):
<htons>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
and    $0xff,%eax
shl    $0x8,%eax
movzwl -0x2(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<htons>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define zeroext i16 @htons(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, 255
%6 = shl i32 %5, 8
%7 = load i16, i16* %2
%8 = zext i16 %7 to i32
%9 = and i32 %8, 65280
%10 = ashr i32 %9, 8
%11 = or i32 %6, %10
%12 = trunc i32 %11 to i16
ret i16 %12
}

LLVM IR (-O2):
define zeroext i16 @htons(i16 zeroext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int);
main() {
  int I = -3, j = 2, k = 0, m;
  m = ++I && ++j || ++k;
  printf("\n%d %d %d %d", I, j, k, m);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xfffffffd,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     115d <main+0x4d>
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
jne    116f <main+0x5f>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xfffffffe,%esi
mov    $0x3,%edx
xor    %ecx,%ecx
mov    $0x1,%r8d
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"\0A%d %d %d %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 -3, i32* %2
store i32 2, i32* %3
store i32 0, i32* %4
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 1
store i32 %7, i32* %2
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
%12 = icmp ne i32 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %9, %0
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 1
store i32 %15, i32* %4
%16 = icmp ne i32 %15, 0
br label %17
17: ; preds = %13, %9
%18 = phi i1 [ true, %9 ], [ %16, %13 ]
%19 = zext i1 %18 to i32
store i32 %19, i32* %5
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %21, i32 %22, i32 %23)
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [13 x i8] c"\0A%d %d %d %d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 -2, i32 3, i32 0, i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void PINT_mem_aligned_free(void *ptr) {
  free(ptr);
  return;
}


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

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

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

LLVM IR (-O2):
define void @PINT_mem_aligned_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
void *glXGetProcAddress(unsigned char const *);
void *glXGetProcAddressARB(const unsigned char *procname) {
  return glXGetProcAddress(procname);
}


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

x86 assembly (clang, -O2):
<glXGetProcAddressARB>:
jmp    1030 <glXGetProcAddress@plt>

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

LLVM IR (-O2):
define i8* @glXGetProcAddressARB(i8* %0) {
%2 = tail call i8* @glXGetProcAddress(i8* %0)
ret i8* %2
}
/* Variables and functions */
unsigned int get_current_step_key_code();
int is_key_matched_for_current_step(unsigned int code) {
  do {
  } while (0);
  return (code == get_current_step_key_code());
}


x86 assembly (clang, -O0):
<is_key_matched_for_current_step>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
jmp    1120 <is_key_matched_for_current_step+0x10>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <get_current_step_key_code@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_key_matched_for_current_step>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <get_current_step_key_code@plt>
xor    %ecx,%ecx
cmp    %ebx,%eax
sete   %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_key_matched_for_current_step(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %1
br label %4
4: ; preds = %3
%5 = load i32, i32* %2
%6 = call i32 (...) @get_current_step_key_code()
%7 = icmp eq i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @is_key_matched_for_current_step(i32 %0) {
%2 = tail call i32 (...) @get_current_step_key_code()
%3 = icmp eq i32 %2, %0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
unsigned int rand();
unsigned d(unsigned sides) { return (rand() % sides + 1); }


x86 assembly (clang, -O0):
<d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
xor    %edx,%edx
divl   -0x4(%rbp)
mov    %edx,%eax
add    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
xor    %edx,%edx
div    %ebx
lea    0x1(%rdx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @d(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = load i32, i32* %2
%5 = urem i32 %3, %4
%6 = add i32 %5, 1
ret i32 %6
}

LLVM IR (-O2):
define i32 @d(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = urem i32 %2, %0
%4 = add nuw i32 %3, 1
ret i32 %4
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void ux00ddr_disableoptimalrmodw(size_t ahbregaddr) {
  (*(volatile uint32_t *)((21 << 2) + (ahbregaddr))) &= (~(1 << 0));
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x54,%rax
mov    (%rax),%ecx
and    $0xfffffffe,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
andl   $0xfffffffe,0x54(%rdi)
ret

LLVM IR (-O0):
define void @ux00ddr_disableoptimalrmodw(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 84, %3
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = and i32 %6, -2
store volatile i32 %7, i32* %5
ret void
}

LLVM IR (-O2):
define void @ux00ddr_disableoptimalrmodw(i64 %0) {
%2 = add i64 %0, 84
%3 = inttoptr i64 %2 to i32*
%4 = load volatile i32, i32* %3
%5 = and i32 %4, -2
store volatile i32 %5, i32* %3
ret void
}
void slashcharclass2DECDIGIT() {}


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

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

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

LLVM IR (-O2):
define void @slashcharclass2DECDIGIT() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int main(void) {
  int area;
  area = 10 * 5;
  printf("value of area: %d", area);
  printf("%c", '\n');
}


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

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

LLVM IR (-O0):
@.str = [18 x i8] c"value of area: %d\00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
store i32 50, i32* %1
%2 = load i32, i32* %1
%3 = trunc i32 %2 to i8
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8 signext %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"value of area: %d\00"
@.str.1 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8 signext 50)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext 10)
ret i32 0
}