#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 EOF;
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
void dump(FILE *f, int n) {
  printf("static const unsigned char B%d[]={\n", n);
  for (n = 1;; n++) {
    int c = getc(f);
    if (c == EOF)
      break;
    printf("%3u,", c);
    if (n == 20) {
      putchar('\n');
      n = 0;
    }
  }
  printf("\n};\n\n");
}


x86 assembly (clang, -O0):
<dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <getc@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    0x2e7b(%rip),%rcx
cmp    (%rcx),%eax
jne    117a <dump+0x4a>
jmp    11b9 <dump+0x89>
mov    -0x10(%rbp),%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x14,-0xc(%rbp)
jne    11a6 <dump+0x76>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0xc(%rbp)
jmp    11ab <dump+0x7b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1157 <dump+0x27>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1060 <getc@plt>
mov    0x2e81(%rip),%r15
cmp    (%r15),%eax
jne    1182 <dump+0x42>
lea    0xeb6(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>
mov    $0x1,%ebp
lea    0xe96(%rip),%r14
jmp    11a0 <dump+0x60>
add    $0x1,%ebp
mov    %rbx,%rdi
call   1060 <getc@plt>
cmp    (%r15),%eax
je     116c <dump+0x2c>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x14,%ebp
jne    1190 <dump+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
jmp    1190 <dump+0x50>

LLVM IR (-O0):
@.str = [36 x i8] c"static const unsigned char B%d[]={\0A\00"
@EOF = global i32 0
@.str.1 = [5 x i8] c"%3u,\00"
@.str.2 = [6 x i8] c"\0A};\0A\0A\00"
define void @dump(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 1, i32* %4
br label %8
8: ; preds = %23, %2
%9 = load i32*, i32** %3
%10 = call i32 @getc(i32* %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %15
14: ; preds = %8
br label %26
15: ; preds = %8
%16 = load i32, i32* %5
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %4
%19 = icmp eq i32 %18, 20
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = call i32 @putchar(i8 signext 10)
store i32 0, i32* %4
br label %22
22: ; preds = %20, %15
br label %23
23: ; preds = %22
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %8
26: ; preds = %14
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"static const unsigned char B%d[]={\0A\00"
@EOF = global i32 0
@.str.1 = [5 x i8] c"%3u,\00"
@str = [5 x i8] c"\0A};\0A\00"
define void @dump(i32* nocapture %0, i32 %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %1)
%4 = tail call i32 @getc(i32* %0)
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %4, %5
br i1 %6, label %20, label %7
7: ; preds = %2, %14
%8 = phi i32 [ %17, %14 ], [ %4, %2 ]
%9 = phi i32 [ %16, %14 ], [ 1, %2 ]
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%11 = icmp eq i32 %9, 20
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = tail call i32 @putchar(i8 signext 10)
br label %14
14: ; preds = %12, %7
%15 = phi i32 [ %9, %7 ], [ 0, %12 ]
%16 = add nsw i32 %15, 1
%17 = tail call i32 @getc(i32* %0)
%18 = load i32, i32* @EOF
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %7
20: ; preds = %14, %2
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret void
}