#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*/ uint8_t;
typedef int uint16_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  uint8_t data[11];
  FILE *file = fopen("random.data", "r");
  char chars[32] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ012345";
  int k;
  for (k = 0; k < 300829; k++) {
    printf("\"");
    fread(data, 1, 10, file);
    int cB, cc = 0, cb = 0;
    for (cB = 0; cB < 16; cB++) {
      uint8_t w[2] = {data[cc + 1], data[cc]};
      uint16_t x = *(uint16_t *)w;
      x <<= cb;
      x >>= 11;
      printf("%c", chars[x]);
      cb += 5;
      if (cb > 7) {
        cb -= 8;
        cc++;
      }
    }
    printf("\", 0, NULL\n");
  }
  fclose(file);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    0xeac(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x38(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xead(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x64(%rbp)
cmpl   $0x4971d,-0x64(%rbp)
jge    128c <main+0x14c>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rcx
mov    $0x1,%esi
mov    $0xa,%edx
call   1030 <fread@plt>
movl   $0x0,-0x6c(%rbp)
movl   $0x0,-0x70(%rbp)
movl   $0x0,-0x68(%rbp)
cmpl   $0x10,-0x68(%rbp)
jge    1270 <main+0x130>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x78(%rbp)
movslq -0x6c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x74(%rbp)
mov    -0x78(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x70(%rbp),%ecx
mov    -0x7c(%rbp),%eax
shl    %cl,%eax
mov    %eax,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
sar    $0xb,%eax
mov    %eax,-0x7c(%rbp)
movslq -0x7c(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%esi
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x70(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x70(%rbp)
cmpl   $0x7,-0x70(%rbp)
jle    125d <main+0x11d>
mov    -0x70(%rbp),%eax
sub    $0x8,%eax
mov    %eax,-0x70(%rbp)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1262 <main+0x122>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    11e3 <main+0xa3>
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    119c <main+0x5c>
mov    -0x38(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
lea    0xe9b(%rip),%rdi
lea    0xea0(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,0x8(%rsp)
xor    %r13d,%r13d
lea    0xea0(%rip),%rbp
mov    $0x22,%edi
call   1030 <putchar@plt>
lea    0x10(%rsp),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
mov    0x8(%rsp),%rcx
call   1050 <fread@plt>
mov    $0x10,%r14d
xor    %r15d,%r15d
xor    %ebx,%ebx
xchg   %ax,%ax
movslq %r15d,%r12
mov    0x14(%rsp,%r12,4),%eax
mov    %ebx,%ecx
shl    %cl,%eax
add    $0x1,%r15d
sar    $0xb,%eax
cltq
movsbl (%rax,%rbp,1),%edi
call   1030 <putchar@plt>
xor    %eax,%eax
cmp    $0x3,%ebx
setl   %al
lea    -0x3(%rbx,%rax,8),%ebx
cmovge %r15d,%r12d
mov    %r12d,%r15d
add    $0xffffffff,%r14d
jne    11b0 <main+0x60>
lea    0xe20(%rip),%rdi
call   1040 <puts@plt>
add    $0x1,%r13d
cmp    $0x4971d,%r13d
jne    1180 <main+0x30>
mov    0x8(%rsp),%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"random.data\00"
@.str.1 = [2 x i8] c"r\00"
@__const.main.chars = [32 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ012345"
@.str.2 = [2 x i8] c"\22\00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [12 x i8] c"\22, 0, NULL\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i32]
%3 = alloca i32*
%4 = alloca [32 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [2 x i32]
%10 = alloca i32
store i32 0, i32* %1
%11 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %3
%12 = bitcast [32 x i8]* %4 to i8*
store i32 0, i32* %5
br label %13
13: ; preds = %64, %0
%14 = load i32, i32* %5
%15 = icmp slt i32 %14, 300829
br i1 %15, label %16, label %67
16: ; preds = %13
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 0
%19 = load i32*, i32** %3
%20 = call i32 @fread(i32* %18, i32 1, i32 10, i32* %19)
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %6
br label %21
21: ; preds = %59, %16
%22 = load i32, i32* %6
%23 = icmp slt i32 %22, 16
br i1 %23, label %24, label %62
24: ; preds = %21
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 %28
%30 = load i32, i32* %29
store i32 %30, i32* %25
%31 = getelementptr inbounds i32, i32* %25, i64 1
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 %33
%35 = load i32, i32* %34
store i32 %35, i32* %31
%36 = getelementptr inbounds [2 x i32], [2 x i32]* %9, i64 0, i64 0
%37 = load i32, i32* %36
store i32 %37, i32* %10
%38 = load i32, i32* %8
%39 = load i32, i32* %10
%40 = shl i32 %39, %38
store i32 %40, i32* %10
%41 = load i32, i32* %10
%42 = ashr i32 %41, 11
store i32 %42, i32* %10
%43 = load i32, i32* %10
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %8
%50 = add nsw i32 %49, 5
store i32 %50, i32* %8
%51 = load i32, i32* %8
%52 = icmp sgt i32 %51, 7
br i1 %52, label %53, label %58
53: ; preds = %24
%54 = load i32, i32* %8
%55 = sub nsw i32 %54, 8
store i32 %55, i32* %8
%56 = load i32, i32* %7
%57 = add nsw i32 %56, 1
store i32 %57, i32* %7
br label %58
58: ; preds = %53, %24
br label %59
59: ; preds = %58
%60 = load i32, i32* %6
%61 = add nsw i32 %60, 1
store i32 %61, i32* %6
br label %21
62: ; preds = %21
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
br label %64
64: ; preds = %62
%65 = load i32, i32* %5
%66 = add nsw i32 %65, 1
store i32 %66, i32* %5
br label %13
67: ; preds = %13
%68 = load i32*, i32** %3
%69 = call i32 @fclose(i32* %68)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"random.data\00"
@.str.1 = [2 x i8] c"r\00"
@__const.main.chars = [32 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ012345"
@str = [11 x i8] c"\22, 0, NULL\00"
define i32 @main() {
%1 = alloca [11 x i32]
%2 = bitcast [11 x i32]* %1 to i8*
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
br label %5
5: ; preds = %0, %30
%6 = phi i32 [ 0, %0 ], [ %32, %30 ]
%7 = tail call i32 @putchar(i32 34)
%8 = call i32 @fread(i32* %4, i32 1, i32 10, i32* %3)
br label %9
9: ; preds = %5, %9
%10 = phi i32 [ 0, %5 ], [ %28, %9 ]
%11 = phi i32 [ 0, %5 ], [ %27, %9 ]
%12 = phi i32 [ 0, %5 ], [ %26, %9 ]
%13 = add nsw i32 %11, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = shl i32 %16, %12
%18 = ashr i32 %17, 11
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [32 x i8], [32 x i8]* @__const.main.chars, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = tail call i32 @putchar(i32 %22)
%24 = icmp sgt i32 %12, 2
%25 = select i1 %24, i32 -3, i32 5
%26 = add nsw i32 %25, %12
%27 = select i1 %24, i32 %13, i32 %11
%28 = add nuw nsw i32 %10, 1
%29 = icmp eq i32 %28, 16
br i1 %29, label %30, label %9
30: ; preds = %9
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%32 = add nuw nsw i32 %6, 1
%33 = icmp eq i32 %32, 300829
br i1 %33, label %34, label %5
34: ; preds = %30
%35 = tail call i32 @fclose(i32* %3)
ret i32 0
}