#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fread(unsigned char *, int, int, int /*<<< orphan*/ *);
void readClassData(char *input, unsigned char *dst, int nbSamples) {
  FILE *file = fopen(input, "rb");
  int result = fread(dst, sizeof(unsigned char), nbSamples, file);
  assert(result == nbSamples);
  int i;
  for (i = 0; i < nbSamples; i++)
    dst[i] -= 48;
  fclose(file);
}


x86 assembly (clang, -O0):
<readClassData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1030 <fread@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c5 <readClassData+0x85>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movzbl (%rax,%rcx,1),%edx
sub    $0x30,%edx
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1199 <readClassData+0x59>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readClassData>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%rbx
lea    0xed0(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %ebp,%edx
mov    %rax,%rcx
call   1030 <fread@plt>
xor    %edi,%edi
cmp    %ebp,%eax
sete   %dil
call   1050 <assert@plt>
test   %ebp,%ebp
jle    128d <readClassData+0x14d>
mov    %ebp,%eax
cmp    $0x8,%ebp
jae    118d <readClassData+0x4d>
xor    %ecx,%ecx
jmp    1280 <readClassData+0x140>
cmp    $0x20,%ebp
jae    1199 <readClassData+0x59>
xor    %ecx,%ecx
jmp    124d <readClassData+0x10d>
mov    %eax,%ecx
and    $0xffffffe0,%ecx
lea    -0x20(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x5,%rsi
add    $0x1,%rsi
test   %rdx,%rdx
je     1299 <readClassData+0x159>
mov    %rsi,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
movdqa 0xe39(%rip),%xmm0
nopw   0x0(%rax,%rax,1)
movdqu (%rbx,%rdx,1),%xmm1
movdqu 0x10(%rbx,%rdx,1),%xmm2
movdqu 0x20(%rbx,%rdx,1),%xmm3
movdqu 0x30(%rbx,%rdx,1),%xmm4
paddb  %xmm0,%xmm1
paddb  %xmm0,%xmm2
movdqu %xmm1,(%rbx,%rdx,1)
movdqu %xmm2,0x10(%rbx,%rdx,1)
paddb  %xmm0,%xmm3
paddb  %xmm0,%xmm4
movdqu %xmm3,0x20(%rbx,%rdx,1)
movdqu %xmm4,0x30(%rbx,%rdx,1)
add    $0x40,%rdx
add    $0xfffffffffffffffe,%rdi
jne    11d0 <readClassData+0x90>
test   $0x1,%sil
je     1244 <readClassData+0x104>
movdqu (%rbx,%rdx,1),%xmm0
movdqu 0x10(%rbx,%rdx,1),%xmm1
movdqa 0xdcf(%rip),%xmm2
paddb  %xmm2,%xmm0
paddb  %xmm2,%xmm1
movdqu %xmm0,(%rbx,%rdx,1)
movdqu %xmm1,0x10(%rbx,%rdx,1)
cmp    %rax,%rcx
je     128d <readClassData+0x14d>
test   $0x18,%al
je     1280 <readClassData+0x140>
mov    %rcx,%rdx
mov    %eax,%ecx
and    $0xfffffff8,%ecx
movdqa 0xdb3(%rip),%xmm0
nopl   (%rax)
movq   (%rbx,%rdx,1),%xmm1
paddb  %xmm0,%xmm1
movq   %xmm1,(%rbx,%rdx,1)
add    $0x8,%rdx
cmp    %rdx,%rcx
jne    1260 <readClassData+0x120>
cmp    %rax,%rcx
je     128d <readClassData+0x14d>
nopl   0x0(%rax)
addb   $0xd0,(%rbx,%rcx,1)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1280 <readClassData+0x140>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <fclose@plt>
xor    %edx,%edx
test   $0x1,%sil
jne    121e <readClassData+0xde>
jmp    1244 <readClassData+0x104>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
define void @readClassData(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%10 = load i8*, i8** %4
%11 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %11, i32** %7
%12 = load i8*, i8** %5
%13 = load i32, i32* %6
%14 = load i32*, i32** %7
%15 = call i32 @fread(i8* %12, i32 1, i32 %13, i32* %14)
store i32 %15, i32* %8
%16 = load i32, i32* %8
%17 = load i32, i32* %6
%18 = icmp eq i32 %16, %17
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
store i32 0, i32* %9
br label %21
21: ; preds = %34, %3
%22 = load i32, i32* %9
%23 = load i32, i32* %6
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %37
25: ; preds = %21
%26 = load i8*, i8** %5
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = sub nsw i32 %31, 48
%33 = trunc i32 %32 to i8
store i8 %33, i8* %29
br label %34
34: ; preds = %25
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 1
store i32 %36, i32* %9
br label %21
37: ; preds = %21
%38 = load i32*, i32** %7
%39 = call i32 @fclose(i32* %38)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
define void @readClassData(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @fread(i8* %1, i32 1, i32 %2, i32* %4)
%6 = icmp eq i32 %5, %2
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = icmp sgt i32 %2, 0
br i1 %9, label %10, label %93
10: ; preds = %3
%11 = zext i32 %2 to i64
%12 = icmp ult i32 %2, 8
br i1 %12, label %84, label %13
13: ; preds = %10
%14 = icmp ult i32 %2, 32
br i1 %14, label %70, label %15
15: ; preds = %13
%16 = and i64 %11, 4294967264
%17 = add nsw i64 %16, -32
%18 = lshr exact i64 %17, 5
%19 = add nuw nsw i64 %18, 1
%20 = and i64 %19, 1
%21 = icmp eq i64 %17, 0
br i1 %21, label %51, label %22
22: ; preds = %15
%23 = and i64 %19, 1152921504606846974
br label %24
24: ; preds = %24, %22
%25 = phi i64 [ 0, %22 ], [ %48, %24 ]
%26 = phi i64 [ 0, %22 ], [ %49, %24 ]
%27 = getelementptr inbounds i8, i8* %1, i64 %25
%28 = bitcast i8* %27 to <16 x i8>*
%29 = load <16 x i8>, <16 x i8>* %28
%30 = getelementptr inbounds i8, i8* %27, i64 16
%31 = bitcast i8* %30 to <16 x i8>*
%32 = load <16 x i8>, <16 x i8>* %31
%33 = add <16 x i8> %29, <i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48>
%34 = add <16 x i8> %32, <i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48>
%35 = bitcast i8* %27 to <16 x i8>*
store <16 x i8> %33, <16 x i8>* %35
%36 = bitcast i8* %30 to <16 x i8>*
store <16 x i8> %34, <16 x i8>* %36
%37 = or i64 %25, 32
%38 = getelementptr inbounds i8, i8* %1, i64 %37
%39 = bitcast i8* %38 to <16 x i8>*
%40 = load <16 x i8>, <16 x i8>* %39
%41 = getelementptr inbounds i8, i8* %38, i64 16
%42 = bitcast i8* %41 to <16 x i8>*
%43 = load <16 x i8>, <16 x i8>* %42
%44 = add <16 x i8> %40, <i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48>
%45 = add <16 x i8> %43, <i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48>
%46 = bitcast i8* %38 to <16 x i8>*
store <16 x i8> %44, <16 x i8>* %46
%47 = bitcast i8* %41 to <16 x i8>*
store <16 x i8> %45, <16 x i8>* %47
%48 = add nuw i64 %25, 64
%49 = add i64 %26, 2
%50 = icmp eq i64 %49, %23
br i1 %50, label %51, label %24
51: ; preds = %24, %15
%52 = phi i64 [ 0, %15 ], [ %48, %24 ]
%53 = icmp eq i64 %20, 0
br i1 %53, label %65, label %54
54: ; preds = %51
%55 = getelementptr inbounds i8, i8* %1, i64 %52
%56 = bitcast i8* %55 to <16 x i8>*
%57 = load <16 x i8>, <16 x i8>* %56
%58 = getelementptr inbounds i8, i8* %55, i64 16
%59 = bitcast i8* %58 to <16 x i8>*
%60 = load <16 x i8>, <16 x i8>* %59
%61 = add <16 x i8> %57, <i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48>
%62 = add <16 x i8> %60, <i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48>
%63 = bitcast i8* %55 to <16 x i8>*
store <16 x i8> %61, <16 x i8>* %63
%64 = bitcast i8* %58 to <16 x i8>*
store <16 x i8> %62, <16 x i8>* %64
br label %65
65: ; preds = %51, %54
%66 = icmp eq i64 %16, %11
br i1 %66, label %93, label %67
67: ; preds = %65
%68 = and i64 %11, 24
%69 = icmp eq i64 %68, 0
br i1 %69, label %84, label %70
70: ; preds = %13, %67
%71 = phi i64 [ %16, %67 ], [ 0, %13 ]
%72 = and i64 %11, 4294967288
br label %73
73: ; preds = %73, %70
%74 = phi i64 [ %71, %70 ], [ %80, %73 ]
%75 = getelementptr inbounds i8, i8* %1, i64 %74
%76 = bitcast i8* %75 to <8 x i8>*
%77 = load <8 x i8>, <8 x i8>* %76
%78 = add <8 x i8> %77, <i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48, i8 -48>
%79 = bitcast i8* %75 to <8 x i8>*
store <8 x i8> %78, <8 x i8>* %79
%80 = add nuw i64 %74, 8
%81 = icmp eq i64 %80, %72
br i1 %81, label %82, label %73
82: ; preds = %73
%83 = icmp eq i64 %72, %11
br i1 %83, label %93, label %84
84: ; preds = %10, %67, %82
%85 = phi i64 [ 0, %10 ], [ %16, %67 ], [ %72, %82 ]
br label %86
86: ; preds = %84, %86
%87 = phi i64 [ %91, %86 ], [ %85, %84 ]
%88 = getelementptr inbounds i8, i8* %1, i64 %87
%89 = load i8, i8* %88
%90 = add i8 %89, -48
store i8 %90, i8* %88
%91 = add nuw nsw i64 %87, 1
%92 = icmp eq i64 %91, %11
br i1 %92, label %93, label %86
93: ; preds = %86, %65, %82, %3
%94 = tail call i32 @fclose(i32* %4)
ret void
}