xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void htbl_free(void *obj, void *unused) {
  (void)(unused);
  free(obj);
}


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

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

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

LLVM IR (-O2):
define void @htbl_free(i8* nocapture %0, i8* nocapture readnone %1) {
%3 = tail call i32 @free(i8* %0)
ret void
}
void INT_MTU2_1_TGIA1(void) {
  volatile int i = 0;
  volatile int x, y;
  for (i = 0; i < 10; i++)
    y = y + x;
}


x86 assembly (clang, -O0):
<INT_MTU2_1_TGIA1>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    $0xa,%eax
jge    1137 <INT_MTU2_1_TGIA1+0x37>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1112 <INT_MTU2_1_TGIA1+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<INT_MTU2_1_TGIA1>:
movl   $0x0,-0xc(%rsp)
movl   $0x0,-0xc(%rsp)
mov    -0xc(%rsp),%eax
cmp    $0x9,%eax
jg     113a <INT_MTU2_1_TGIA1+0x3a>
nopl   0x0(%rax)
mov    -0x8(%rsp),%eax
add    -0x4(%rsp),%eax
mov    %eax,-0x8(%rsp)
addl   $0x1,-0xc(%rsp)
mov    -0xc(%rsp),%eax
cmp    $0xa,%eax
jl     1120 <INT_MTU2_1_TGIA1+0x20>
ret

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

LLVM IR (-O2):
define void @INT_MTU2_1_TGIA1() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store volatile i32 0, i32* %1
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
store volatile i32 0, i32* %1
%7 = load volatile i32, i32* %1
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %17
9: ; preds = %0, %9
%10 = load volatile i32, i32* %3
%11 = load volatile i32, i32* %2
%12 = add nsw i32 %11, %10
store volatile i32 %12, i32* %3
%13 = load volatile i32, i32* %1
%14 = add nsw i32 %13, 1
store volatile i32 %14, i32* %1
%15 = load volatile i32, i32* %1
%16 = icmp slt i32 %15, 10
br i1 %16, label %9, label %17
17: ; preds = %9, %0
ret void
}
int ft_islower(int c) {
  if (c >= 'a' && c <= 'z')
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<ft_islower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x61,-0x8(%rbp)
jl     1127 <ft_islower+0x27>
cmpl   $0x7a,-0x8(%rbp)
jg     1127 <ft_islower+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <ft_islower+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @ft_islower(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 97
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 122
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %11
10: ; preds = %6, %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @ft_islower(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
void DCSMSecureZone2(void) {
  (*((volatile unsigned long *)(0x400FB400 + 0x00000084))) |= 0x00008000;
}


x86 assembly (clang, -O0):
<DCSMSecureZone2>:
push   %rbp
mov    %rsp,%rbp
mov    $0x400fb484,%eax
mov    (%rax),%rcx
or     $0x8000,%rcx
mov    $0x400fb484,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<DCSMSecureZone2>:
orq    $0x8000,0x400fb484
ret

LLVM IR (-O0):
define void @DCSMSecureZone2() {
%1 = load volatile i64, i64* inttoptr (i64 1074771076 to i64*)
%2 = or i64 %1, 32768
store volatile i64 %2, i64* inttoptr (i64 1074771076 to i64*)
ret void
}

LLVM IR (-O2):
define void @DCSMSecureZone2() {
%1 = load volatile i64, i64* inttoptr (i64 1074771076 to i64*)
%2 = or i64 %1, 32768
store volatile i64 %2, i64* inttoptr (i64 1074771076 to i64*)
ret void
}
int security_socket_getsockname(struct socket *sock) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.socket = type opaque
define i32 @security_socket_getsockname(%struct.socket* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ strncpy(char *, char const *, int);
char *str_dupl_left(const char *text, int size) {
  char *new_text = malloc(size + 1);
  strncpy(new_text, text, size);
  new_text[size] = 0;
  return new_text;
}


x86 assembly (clang, -O0):
<str_dupl_left>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i8* @str_dupl_left(i8* %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 @strncpy(i8* %4, i8* %0, i32 %1)
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i8, i8* %4, i64 %6
store i8 0, i8* %7
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ ft_putchar(char);
int main(int argc, char **argv) {
  argc--;
  while (*argv[0])
    ft_putchar(*argv[0]++);
  ft_putchar('\n');
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
cmpb   $0x0,(%rax)
je     115d <main+0x4d>
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
movsbl (%rax),%edi
call   1030 <ft_putchar@plt>
jmp    112f <main+0x1f>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    (%rsi),%rax
cmpb   $0x0,(%rax)
je     1137 <main+0x27>
mov    %rsi,%rbx
nopl   0x0(%rax)
lea    0x1(%rax),%rcx
mov    %rcx,(%rbx)
movsbl (%rax),%edi
call   1030 <ft_putchar@plt>
mov    (%rbx),%rax
cmpb   $0x0,(%rax)
jne    1120 <main+0x10>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
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**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = add nsw i32 %6, -1
store i32 %7, i32* %4
br label %8
8: ; preds = %14, %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %21
14: ; preds = %8
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %16
%19 = load i8, i8* %17
%20 = call i32 @ft_putchar(i8 signext %19)
br label %8
21: ; preds = %8
%22 = call i32 @ft_putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %2, %6
%7 = phi i8* [ %11, %6 ], [ %3, %2 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8* %8, i8** %1
%9 = load i8, i8* %7
%10 = tail call i32 @ft_putchar(i8 signext %9)
%11 = load i8*, i8** %1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %6
14: ; preds = %6, %2
%15 = tail call i32 @ft_putchar(i8 signext 10)
ret i32 0
}
/* Variables and functions */
scalar_t__ ceil(double);
int _Ceiling(double in1) { return (int)ceil(in1); }


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

x86 assembly (clang, -O2):
<_Ceiling>:
jmp    1030 <ceil@plt>

LLVM IR (-O0):
define i32 @_Ceiling(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @ceil(double %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @_Ceiling(double %0) {
%2 = tail call i64 @ceil(double %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
double stdlib_strided_dmeankbn2(int, double *, int);
int main() {
  double x[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
  int64_t N = 4;
  int64_t stride = 2;
  double v = stdlib_strided_dmeankbn2(N, x, stride);
  printf("mean: %lf\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x40(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x40,%edx
call   1050 <memcpy@plt>
movl   $0x4,-0x44(%rbp)
movl   $0x2,-0x48(%rbp)
mov    -0x44(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%edx
call   1040 <stdlib_strided_dmeankbn2@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
movaps 0xf05(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x4,%edi
mov    $0x2,%edx
call   1040 <stdlib_strided_dmeankbn2@plt>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [8 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00]
@.str = [11 x i8] c"mean: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
%5 = bitcast [8 x double]* %1 to i8*
store i32 4, i32* %2
store i32 2, i32* %3
%6 = load i32, i32* %2
%7 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call double @stdlib_strided_dmeankbn2(i32 %6, double* %7, i32 %8)
store double %9, double* %4
%10 = load double, double* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [8 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00]
@.str = [11 x i8] c"mean: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = bitcast [8 x double]* %1 to i8*
%3 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%4 = call double @stdlib_strided_dmeankbn2(i32 4, double* %3, i32 2)
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %4)
ret i32 0
}
decode_i_s1(int a, int b) {
  b = (b >> 5) & 31;
  return a | 1 << (b + 4);
}


x86 assembly (clang, -O0):
<decode_i_s1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x5,%eax
and    $0x1f,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x4,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_i_s1>:
mov    %esi,%ecx
shr    $0x5,%ecx
mov    $0x10,%eax
shl    %cl,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @decode_i_s1(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = ashr i32 %5, 5
%7 = and i32 %6, 31
store i32 %7, i32* %4
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = add nsw i32 %9, 4
%11 = shl i32 1, %10
%12 = or i32 %8, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @decode_i_s1(i32 %0, i32 %1) {
%3 = lshr i32 %1, 5
%4 = and i32 %3, 31
%5 = shl i32 16, %4
%6 = or i32 %5, %0
ret i32 %6
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t prng_get(void) {
  static uint8_t seed = 0xAA;
  static uint8_t a = 0;
  seed ^= seed << 3;
  seed ^= seed >> 5;
  seed ^= a++ >> 2;
  return seed;
}


x86 assembly (clang, -O0):
<prng_get>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f16(%rip),%eax
shl    $0x3,%eax
xor    0x2f0d(%rip),%eax
mov    %eax,0x2f07(%rip)
mov    0x2f01(%rip),%eax
sar    $0x5,%eax
xor    0x2ef8(%rip),%eax
mov    %eax,0x2ef2(%rip)
mov    0x2ef4(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2ee9(%rip)
sar    $0x2,%eax
xor    0x2ed8(%rip),%eax
mov    %eax,0x2ed2(%rip)
mov    0x2ecc(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<prng_get>:
mov    0x2f1a(%rip),%eax
lea    0x0(,%rax,8),%ecx
xor    %eax,%ecx
mov    0x2f13(%rip),%eax
lea    0x1(%rax),%edx
sar    $0x2,%eax
xor    %ecx,%eax
sar    $0x5,%ecx
mov    %edx,0x2f02(%rip)
xor    %ecx,%eax
mov    %eax,0x2ef2(%rip)
ret

LLVM IR (-O0):
@prng_get.seed = internal global i32 170
@prng_get.a = internal global i32 0
define i32 @prng_get() {
%1 = load i32, i32* @prng_get.seed
%2 = shl i32 %1, 3
%3 = load i32, i32* @prng_get.seed
%4 = xor i32 %3, %2
store i32 %4, i32* @prng_get.seed
%5 = load i32, i32* @prng_get.seed
%6 = ashr i32 %5, 5
%7 = load i32, i32* @prng_get.seed
%8 = xor i32 %7, %6
store i32 %8, i32* @prng_get.seed
%9 = load i32, i32* @prng_get.a
%10 = add nsw i32 %9, 1
store i32 %10, i32* @prng_get.a
%11 = ashr i32 %9, 2
%12 = load i32, i32* @prng_get.seed
%13 = xor i32 %12, %11
store i32 %13, i32* @prng_get.seed
%14 = load i32, i32* @prng_get.seed
ret i32 %14
}

LLVM IR (-O2):
@prng_get.seed = internal unnamed_addr global i32 170
@prng_get.a = internal unnamed_addr global i32 0
define i32 @prng_get() {
%1 = load i32, i32* @prng_get.seed
%2 = shl i32 %1, 3
%3 = xor i32 %2, %1
%4 = ashr i32 %3, 5
%5 = xor i32 %4, %3
%6 = load i32, i32* @prng_get.a
%7 = add nsw i32 %6, 1
store i32 %7, i32* @prng_get.a
%8 = ashr i32 %6, 2
%9 = xor i32 %5, %8
store i32 %9, i32* @prng_get.seed
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void keyboard(unsigned char key, int x, int y) {
  if (key == 'q' || key == 'Q' || key == 27) {
    exit(0);
  }
}


x86 assembly (clang, -O0):
<keyboard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x71,%eax
je     114b <keyboard+0x3b>
movzbl -0x1(%rbp),%eax
cmp    $0x51,%eax
je     114b <keyboard+0x3b>
movzbl -0x1(%rbp),%eax
cmp    $0x1b,%eax
jne    1152 <keyboard+0x42>
xor    %edi,%edi
call   1030 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keyboard>:
cmp    $0x1b,%dil
je     1123 <keyboard+0x13>
cmp    $0x71,%dil
je     1123 <keyboard+0x13>
cmp    $0x51,%dil
je     1123 <keyboard+0x13>
ret
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @keyboard(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = icmp eq i32 %8, 113
br i1 %9, label %18, label %10
10: ; preds = %3
%11 = load i8, i8* %4
%12 = zext i8 %11 to i32
%13 = icmp eq i32 %12, 81
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = load i8, i8* %4
%16 = zext i8 %15 to i32
%17 = icmp eq i32 %16, 27
br i1 %17, label %18, label %20
18: ; preds = %14, %10, %3
%19 = call i32 @exit(i32 0)
unreachable
20: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @keyboard(i8 zeroext %0, i32 %1, i32 %2) {
switch i8 %0, label %6 [
i8 113, label %4
i8 81, label %4
i8 27, label %4
]
4: ; preds = %3, %3, %3
%5 = tail call i32 @exit(i32 0)
unreachable
6: ; preds = %3
ret void
}
/* Type definitions */
struct game_state {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void quit(struct game_state *gs) {
  endwin();
  exit(0);
}


x86 assembly (clang, -O0):
<quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <endwin@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<quit>:
push   %rax
xor    %eax,%eax
call   1030 <endwin@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
%struct.game_state = type { i32 }
define void @quit(%struct.game_state* %0) {
%2 = alloca %struct.game_state*
store %struct.game_state* %0, %struct.game_state** %2
%3 = call i32 (...) @endwin()
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.game_state = type { i32 }
define void @quit(%struct.game_state* nocapture readnone %0) {
%2 = tail call i32 (...) @endwin()
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ iscntrl(int);
void t_iscntrl_0xf2() {
  Assert_real((iscntrl(242) == 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_iscntrl.c",
              1215, ("iscntrl should be 0 for 0xf2"));
}


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

x86 assembly (clang, -O2):
<t_iscntrl_0xf2>:
push   %rax
mov    $0xf2,%edi
call   1030 <iscntrl@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x4bf,%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_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 0 for 0xf2\00"
define void @t_iscntrl_0xf2() {
%1 = call i64 @iscntrl(i32 242)
%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 1215, 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_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 0 for 0xf2\00"
define void @t_iscntrl_0xf2() {
%1 = tail call i64 @iscntrl(i32 242)
%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 1215, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int rand();
double franf() {
  double t;
  t = rand() & 077777;
  return (t / 32767.0);
}


x86 assembly (clang, -O0):
<franf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
and    $0x7fff,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xec6(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<franf>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
and    $0x7fff,%eax
cvtsi2sd %eax,%xmm0
divsd  0xed7(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @franf() {
%1 = alloca double
%2 = call i32 (...) @rand()
%3 = and i32 %2, 32767
%4 = sitofp i32 %3 to double
store double %4, double* %1
%5 = load double, double* %1
%6 = fdiv double %5, 3.276700e+04
ret double %6
}

LLVM IR (-O2):
define double @franf() {
%1 = tail call i32 (...) @rand()
%2 = and i32 %1, 32767
%3 = sitofp i32 %2 to double
%4 = fdiv double %3, 3.276700e+04
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ rt_init();
__attribute__((__constructor__)) void dinit(void) { rt_init(); }


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

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

LLVM IR (-O0):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @dinit, i8* null }]
define void @dinit() {
%1 = call i32 (...) @rt_init()
ret void
}

LLVM IR (-O2):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @dinit, i8* null }]
define void @dinit() {
%1 = tail call i32 (...) @rt_init()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
scalar_t__ hweight(int /*<<< orphan*/);
unsigned int cpu_weight(uint64_t *cpu_mask, unsigned int cpus) {
  unsigned int weight = 0;
  int idx;
  for (idx = 0; idx < (cpus >> 6) + 1; idx++)
    weight += hweight(*(cpu_mask + idx));
  return weight;
}


x86 assembly (clang, -O0):
<cpu_weight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
shr    $0x6,%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jae    116b <cpu_weight+0x5b>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <hweight@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%eax
add    %rcx,%rax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <cpu_weight+0x1d>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_weight>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%r14
shr    $0x6,%r15d
add    $0x1,%r15d
xor    %ebx,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    (%r14,%rbx,4),%edi
call   1030 <hweight@plt>
add    %eax,%ebp
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <cpu_weight+0x20>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @cpu_weight(i32* nocapture %0, i32 %1) {
%3 = lshr i32 %1, 6
%4 = add nuw nsw i32 %3, 1
%5 = zext i32 %4 to i64
br label %6
6: ; preds = %2, %6
%7 = phi i64 [ 0, %2 ], [ %14, %6 ]
%8 = phi i32 [ 0, %2 ], [ %13, %6 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %7
%10 = load i32, i32* %9
%11 = tail call i64 @hweight(i32 %10)
%12 = trunc i64 %11 to i32
%13 = add i32 %8, %12
%14 = add nuw nsw i64 %7, 1
%15 = icmp eq i64 %14, %5
br i1 %15, label %16, label %6
16: ; preds = %6
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ helper_double_8_recursive(double *, int);
void helper_double_8(double *buf) { helper_double_8_recursive(buf, 8); }


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

x86 assembly (clang, -O2):
<helper_double_8>:
mov    $0x8,%esi
jmp    1030 <helper_double_8_recursive@plt>

LLVM IR (-O0):
define void @helper_double_8(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = call i32 @helper_double_8_recursive(double* %3, i32 8)
ret void
}

LLVM IR (-O2):
define void @helper_double_8(double* %0) {
%2 = tail call i32 @helper_double_8_recursive(double* %0, i32 8)
ret void
}
/* Variables and functions */
int read_proc_file_integer(int const, char *, int *);
int get_oom_score_adj(const int pid, int *out) {
  return read_proc_file_integer(pid, "oom_score_adj", out);
}


x86 assembly (clang, -O0):
<get_oom_score_adj>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xed3(%rip),%rsi
call   1030 <read_proc_file_integer@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_oom_score_adj>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <read_proc_file_integer@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"oom_score_adj\00"
define i32 @get_oom_score_adj(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32, i32* %3
%6 = load i32*, i32** %4
%7 = call i32 @read_proc_file_integer(i32 %5, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32* %6)
ret i32 %7
}

LLVM IR (-O2):
@.str = [14 x i8] c"oom_score_adj\00"
define i32 @get_oom_score_adj(i32 %0, i32* %1) {
%3 = tail call i32 @read_proc_file_integer(i32 %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32* %1)
ret i32 %3
}
void __attribute__((destructor)) finalize() {
  printf(__func__);
  printf("\n");
}


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

x86 assembly (clang, -O2):
<finalize>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@__func__.finalize = [9 x i8] c"finalize\00"
@.str = [2 x i8] c"\0A\00"
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @finalize, i8* null }]
define void @finalize() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__func__.finalize, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.finalize = [9 x i8] c"finalize\00"
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @finalize, i8* null }]
define void @finalize() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @__func__.finalize, i64 0, i64 0))
%2 = tail call i32 @putchar(i32 10)
ret void
}
utimes() {}


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

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

LLVM IR (-O0):
define i32 @utimes() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @utimes() {
ret i32 undef
}
/* Variables and functions */
int INT32_MAX;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ stderr;
void print_usage(char **argv) {
  fprintf(stderr,
          "usage: %s [read|write] [num]\n"
          "\n"
          "    read  - read [num] 4-byte ints and verify they're sequential\n"
          "    write - write [num] sequential 4-byte ints, starting from 0\n"
          "    num   - how many to read/write, between 1 & %d\n",
          argv[0], INT32_MAX);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
mov    0x2ea5(%rip),%rax
mov    (%rax),%ecx
lea    0xec4(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%eax
mov    (%rdi),%rdx
mov    0x2eb5(%rip),%rcx
mov    (%rcx),%ecx
lea    0xed4(%rip),%rsi
mov    %eax,%edi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [211 x i8] c"usage: %s [read|write] [num]\0A\0A read - read [num] 4-byte ints and verify they're sequential\0A write - write [num] sequential 4-byte ints, starting from 0\0A num - how many to read/write, between 1 & %d\0A\00"
@INT32_MAX = global i32 0
define void @print_usage(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i32, i32* @stderr
%4 = load i8**, i8*** %2
%5 = getelementptr inbounds i8*, i8** %4, i64 0
%6 = load i8*, i8** %5
%7 = load i32, i32* @INT32_MAX
%8 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([211 x i8], [211 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %7)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [211 x i8] c"usage: %s [read|write] [num]\0A\0A read - read [num] 4-byte ints and verify they're sequential\0A write - write [num] sequential 4-byte ints, starting from 0\0A num - how many to read/write, between 1 & %d\0A\00"
@INT32_MAX = global i32 0
define void @print_usage(i8** nocapture %0) {
%2 = load i32, i32* @stderr
%3 = load i8*, i8** %0
%4 = load i32, i32* @INT32_MAX
%5 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([211 x i8], [211 x i8]* @.str, i64 0, i64 0), i8* %3, i32 %4)
ret void
}
void swap(char ***a, int i, int j) {
  char **t = *(a + i);
  *(a + i) = *(a + j);
  *(a + j) = t;
}


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

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
mov    (%rdi,%rax,8),%rcx
movslq %edx,%rdx
mov    (%rdi,%rdx,8),%rsi
mov    %rsi,(%rdi,%rax,8)
mov    %rcx,(%rdi,%rdx,8)
ret

LLVM IR (-O0):
define void @swap(i8*** %0, i32 %1, i32 %2) {
%4 = alloca i8***
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8**
store i8*** %0, i8**** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8***, i8**** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8**, i8*** %8, i64 %10
%12 = load i8**, i8*** %11
store i8** %12, i8*** %7
%13 = load i8***, i8**** %4
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8**, i8*** %13, i64 %15
%17 = load i8**, i8*** %16
%18 = load i8***, i8**** %4
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8**, i8*** %18, i64 %20
store i8** %17, i8*** %21
%22 = load i8**, i8*** %7
%23 = load i8***, i8**** %4
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8**, i8*** %23, i64 %25
store i8** %22, i8*** %26
ret void
}

LLVM IR (-O2):
define void @swap(i8*** nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8**, i8*** %0, i64 %4
%6 = load i8**, i8*** %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8**, i8*** %0, i64 %7
%9 = load i8**, i8*** %8
store i8** %9, i8*** %5
store i8** %6, i8*** %8
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int override_redirect;
};
typedef TYPE_1__ XReparentEvent;

/* Variables and functions */
void set_XReparentEvent_override_redirect(void *_p, int _v) {
  ((XReparentEvent *)_p)->override_redirect = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XReparentEvent_override_redirect>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XReparentEvent_override_redirect(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 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XReparentEvent_override_redirect(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
int sting_attack_checked(int attack_history, int attack_type) {
  return (attack_history & (attack_type << 8));
}


x86 assembly (clang, -O0):
<sting_attack_checked>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x8,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sting_attack_checked>:
mov    %esi,%eax
shl    $0x8,%eax
and    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @sting_attack_checked(i32 %0, i32 %1) {
%3 = shl i32 %1, 8
%4 = and i32 %3, %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int, int);
void print_date(int y, int m, int d) {
  char *months[] = {"March", "April", "May"};
  printf("%-5s %2d %d\t", months[m - 3], d, y);
}


x86 assembly (clang, -O0):
<print_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    0x2cd8(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cd5(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cd2(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
cltq
mov    -0x30(%rbp,%rax,8),%rsi
mov    -0xc(%rbp),%edx
mov    -0x4(%rbp),%ecx
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_date>:
mov    %edi,%ecx
movslq %esi,%rax
lea    0xf04(%rip),%rdi
movslq -0xc(%rdi,%rax,4),%rsi
add    %rdi,%rsi
lea    0xee5(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"March\00"
@.str.1 = [6 x i8] c"April\00"
@.str.2 = [4 x i8] c"May\00"
@__const.print_date.months = [3 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [13 x i8] c"%-5s %2d %d\09\00"
define void @print_date(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [3 x i8*]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = bitcast [3 x i8*]* %7 to i8*
%9 = load i32, i32* %5
%10 = sub nsw i32 %9, 3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [3 x i8*], [3 x i8*]* %7, i64 0, i64 %11
%13 = load i8*, i8** %12
%14 = load i32, i32* %6
%15 = load i32, i32* %4
%16 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %13, i32 %14, i32 %15)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"March\00"
@.str.1 = [6 x i8] c"April\00"
@.str.2 = [4 x i8] c"May\00"
@reltable.print_date = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str to i64), i64 ptrtoint ([3 x i32]* @reltable.print_date to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.1 to i64), i64 ptrtoint ([3 x i32]* @reltable.print_date to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([3 x i32]* @reltable.print_date to i64)) to i32)]
@.str.3 = [13 x i8] c"%-5s %2d %d\09\00"
define void @print_date(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, -3
%5 = sext i32 %4 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.print_date to i8*), i64 %6)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %7, i32 %2, i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ HandleInterrupt(int);
void INT_P2(void) { HandleInterrupt(2); }


x86 assembly (clang, -O0):
<INT_P2>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <HandleInterrupt@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<INT_P2>:
mov    $0x2,%edi
jmp    1030 <HandleInterrupt@plt>

LLVM IR (-O0):
define void @INT_P2() {
%1 = call i32 @HandleInterrupt(i32 2)
ret void
}

LLVM IR (-O2):
define void @INT_P2() {
%1 = tail call i32 @HandleInterrupt(i32 2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gen(char *);
void cgldinc(void) { gen("movl\t%eax,%edx"); }


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"movl\09%eax,%edx\00"
define void @cgldinc() {
%1 = call i32 @gen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"movl\09%eax,%edx\00"
define void @cgldinc() {
%1 = tail call i32 @gen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SysCtlDelay(int);
void EEPROMClearSectorMask(void) {
  SysCtlDelay(10);
  (*((volatile unsigned long *)(0x400FD0FC))) = 3;
  SysCtlDelay(10);
  (*((volatile unsigned long *)(0x400AE2C0))) = 0;
  SysCtlDelay(10);
  (*((volatile unsigned long *)(0x400FD0FC))) = 0;
  SysCtlDelay(10);
}


x86 assembly (clang, -O0):
<EEPROMClearSectorMask>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa,%edi
call   1030 <SysCtlDelay@plt>
mov    $0x400fd0fc,%eax
movq   $0x3,(%rax)
mov    $0xa,%edi
call   1030 <SysCtlDelay@plt>
mov    $0x400ae2c0,%eax
movq   $0x0,(%rax)
mov    $0xa,%edi
call   1030 <SysCtlDelay@plt>
mov    $0x400fd0fc,%eax
movq   $0x0,(%rax)
mov    $0xa,%edi
call   1030 <SysCtlDelay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<EEPROMClearSectorMask>:
push   %rax
mov    $0xa,%edi
call   1030 <SysCtlDelay@plt>
movq   $0x3,0x400fd0fc
mov    $0xa,%edi
call   1030 <SysCtlDelay@plt>
movq   $0x0,0x400ae2c0
mov    $0xa,%edi
call   1030 <SysCtlDelay@plt>
movq   $0x0,0x400fd0fc
mov    $0xa,%edi
pop    %rax
jmp    1030 <SysCtlDelay@plt>

LLVM IR (-O0):
define void @EEPROMClearSectorMask() {
%1 = call i32 @SysCtlDelay(i32 10)
store volatile i64 3, i64* inttoptr (i64 1074778364 to i64*)
%2 = call i32 @SysCtlDelay(i32 10)
store volatile i64 0, i64* inttoptr (i64 1074455232 to i64*)
%3 = call i32 @SysCtlDelay(i32 10)
store volatile i64 0, i64* inttoptr (i64 1074778364 to i64*)
%4 = call i32 @SysCtlDelay(i32 10)
ret void
}

LLVM IR (-O2):
define void @EEPROMClearSectorMask() {
%1 = tail call i32 @SysCtlDelay(i32 10)
store volatile i64 3, i64* inttoptr (i64 1074778364 to i64*)
%2 = tail call i32 @SysCtlDelay(i32 10)
store volatile i64 0, i64* inttoptr (i64 1074455232 to i64*)
%3 = tail call i32 @SysCtlDelay(i32 10)
store volatile i64 0, i64* inttoptr (i64 1074778364 to i64*)
%4 = tail call i32 @SysCtlDelay(i32 10)
ret void
}
int gx_tohex(int nib) {
  if (nib < 10)
    return '0' + nib;
  else
    return 'a' + nib - 10;
}


x86 assembly (clang, -O0):
<gx_tohex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    111f <gx_tohex+0x1f>
mov    -0x8(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    112b <gx_tohex+0x2b>
mov    -0x8(%rbp),%eax
add    $0x61,%eax
sub    $0xa,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gx_tohex>:
lea    0x57(%rdi),%ecx
lea    0x30(%rdi),%eax
cmp    $0xa,%edi
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @gx_tohex(i32 %0) {
%2 = icmp slt i32 %0, 10
%3 = select i1 %2, i32 48, i32 87
%4 = add nsw i32 %3, %0
ret i32 %4
}
unsigned short hashids_div_ceil_unsigned_short(unsigned short x,
                                               unsigned short y) {
  return x / y + !!(x % y);
}


x86 assembly (clang, -O0):
<hashids_div_ceil_unsigned_short>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movzwl -0x2(%rbp),%eax
movzwl -0x4(%rbp),%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
movzwl -0x2(%rbp),%eax
movzwl -0x4(%rbp),%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%eax
cmp    $0x0,%edx
setne  %cl
xor    $0xff,%cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
add    %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashids_div_ceil_unsigned_short>:
mov    %edi,%eax
xor    %edx,%edx
div    %si
cmp    $0x1,%dx
sbb    $0xffff,%ax
ret

LLVM IR (-O0):
define zeroext i16 @hashids_div_ceil_unsigned_short(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = load i16, i16* %4
%8 = zext i16 %7 to i32
%9 = sdiv i32 %6, %8
%10 = load i16, i16* %3
%11 = zext i16 %10 to i32
%12 = load i16, i16* %4
%13 = zext i16 %12 to i32
%14 = srem i32 %11, %13
%15 = icmp ne i32 %14, 0
%16 = xor i1 %15, true
%17 = xor i1 %16, true
%18 = zext i1 %17 to i32
%19 = add nsw i32 %9, %18
%20 = trunc i32 %19 to i16
ret i16 %20
}

LLVM IR (-O2):
define zeroext i16 @hashids_div_ceil_unsigned_short(i16 zeroext %0, i16 zeroext %1) {
%3 = udiv i16 %0, %1
%4 = urem i16 %0, %1
%5 = icmp ne i16 %4, 0
%6 = zext i1 %5 to i16
%7 = add i16 %3, %6
ret i16 %7
}
/* Type definitions */
struct mm_config {
  int dummy;
};

/* Variables and functions */
void *mmp_create(void *, struct mm_config *);
void *__mmp_create_agent(void *addr, struct mm_config *cfg) {
  return mmp_create(addr, cfg);
}


x86 assembly (clang, -O0):
<__mmp_create_agent>:
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 <mmp_create@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__mmp_create_agent>:
jmp    1030 <mmp_create@plt>

LLVM IR (-O0):
%struct.mm_config = type { i32 }
define i8* @__mmp_create_agent(i8* %0, %struct.mm_config* %1) {
%3 = alloca i8*
%4 = alloca %struct.mm_config*
store i8* %0, i8** %3
store %struct.mm_config* %1, %struct.mm_config** %4
%5 = load i8*, i8** %3
%6 = load %struct.mm_config*, %struct.mm_config** %4
%7 = call i8* @mmp_create(i8* %5, %struct.mm_config* %6)
ret i8* %7
}

LLVM IR (-O2):
%struct.mm_config = type { i32 }
define i8* @__mmp_create_agent(i8* %0, %struct.mm_config* %1) {
%3 = tail call i8* @mmp_create(i8* %0, %struct.mm_config* %1)
ret i8* %3
}
unsigned int __atomic_exchange_4(volatile void *atom, unsigned int value,
                                 int memorder) {
  unsigned int xchg;
  unsigned int cmp;
  __atomic_load((unsigned int *)atom, (unsigned int *)&cmp, 0);
  do {
    xchg = (value);
  } while (
      !__atomic_compare_exchange((unsigned int *)atom, &cmp, &xchg, 1, 5, 5));
  return cmp;
}


x86 assembly (clang, -O0):
<__atomic_exchange_4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%edx
lock cmpxchg %edx,(%rcx)
mov    %eax,%ecx
sete   %al
mov    %al,-0x21(%rbp)
mov    %ecx,-0x20(%rbp)
test   $0x1,%al
jne    1144 <__atomic_exchange_4+0x44>
mov    -0x20(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
xor    $0xff,%al
test   $0x1,%al
jne    1117 <__atomic_exchange_4+0x17>
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__atomic_exchange_4>:
mov    (%rdi),%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%ecx
lock cmpxchg %esi,(%rdi)
jne    1110 <__atomic_exchange_4+0x10>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @__atomic_exchange_4(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i32*
%12 = load atomic i32, i32* %11 monotonic
store i32 %12, i32* %8
br label %13
13: ; preds = %24, %3
%14 = load i32, i32* %5
store i32 %14, i32* %7
br label %15
15: ; preds = %13
%16 = load i8*, i8** %4
%17 = bitcast i8* %16 to i32*
%18 = load i32, i32* %8
%19 = load i32, i32* %7
%20 = cmpxchg weak i32* %17, i32 %18, i32 %19 seq_cst seq_cst
%21 = extractvalue { i32, i1 } %20, 0
%22 = extractvalue { i32, i1 } %20, 1
br i1 %22, label %24, label %23
23: ; preds = %15
store i32 %21, i32* %8
br label %24
24: ; preds = %23, %15
%25 = zext i1 %22 to i8
store i8 %25, i8* %9
%26 = load i8, i8* %9
%27 = trunc i8 %26 to i1
%28 = xor i1 %27, true
br i1 %28, label %13, label %29
29: ; preds = %24
%30 = load i32, i32* %8
ret i32 %30
}

LLVM IR (-O2):
define i32 @__atomic_exchange_4(i8* nocapture %0, i32 %1, i32 %2) {
%4 = bitcast i8* %0 to i32*
%5 = load atomic i32, i32* %4 monotonic
br label %6
6: ; preds = %6, %3
%7 = phi i32 [ %5, %3 ], [ %10, %6 ]
%8 = cmpxchg weak i32* %4, i32 %7, i32 %1 seq_cst seq_cst
%9 = extractvalue { i32, i1 } %8, 1
%10 = extractvalue { i32, i1 } %8, 0
br i1 %9, label %11, label %6
11: ; preds = %6
ret i32 %7
}