#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 */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int scan(unsigned char *);
int main(int argc, char **argv) {
  unsigned char buf[2];
  unsigned int ch = 0;
  buf[1] = 0u;
  printf("const uint ebc2asc[256] =\n");
  printf("    { /* Based on ISO 8859/1 and Code Page 37 */\n");
  for (;;) {
    if (ch % 16 == 0) {
      printf("        ");
    }
    buf[0] = ch++;
    printf("0x%02x", scan(buf));
    if (ch == 256) {
      printf("\n");
      break;
    }
    if (ch % 16 == 0) {
      printf(",\n");
    } else {
      printf(", ");
    }
  }
  printf("    };\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movb   $0x0,-0x11(%rbp)
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
and    $0xf,%eax
cmp    $0x0,%eax
jne    117a <main+0x5a>
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x18(%rbp)
mov    %al,-0x12(%rbp)
lea    -0x12(%rbp),%rdi
call   1040 <scan@plt>
mov    %eax,%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x100,-0x18(%rbp)
jne    11c1 <main+0xa1>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f6 <main+0xd6>
mov    -0x18(%rbp),%eax
and    $0xf,%eax
cmp    $0x0,%eax
jne    11e3 <main+0xc3>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f1 <main+0xd1>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    115d <main+0x3d>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movb   $0x0,0x7(%rsp)
lea    0xebc(%rip),%rdi
call   1040 <puts@plt>
lea    0xeca(%rip),%rdi
call   1040 <puts@plt>
lea    0xe91(%rip),%r14
lea    0x6(%rsp),%r15
lea    0xe8e(%rip),%rbx
lea    0xedc(%rip),%r12
lea    0xe87(%rip),%r13
xor    %ebp,%ebp
test   $0xf,%bpl
jne    11b8 <main+0x78>
jmp    11ae <main+0x6e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rdi
call   1040 <puts@plt>
test   $0xf,%bpl
jne    11b8 <main+0x78>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %bpl,0x6(%rsp)
mov    %r15,%rdi
call   1060 <scan@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0xff,%ebp
je     11f4 <main+0xb4>
add    $0x1,%ebp
test   $0xf,%bpl
je     11a0 <main+0x60>
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   $0xf,%bpl
jne    11b8 <main+0x78>
jmp    11ae <main+0x6e>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe5b(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"const uint ebc2asc[256] =\0A\00"
@.str.1 = [50 x i8] c" { /* Based on ISO 8859/1 and Code Page 37 */\0A\00"
@.str.2 = [9 x i8] c" \00"
@.str.3 = [7 x i8] c"0x%02x\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [3 x i8] c",\0A\00"
@.str.6 = [3 x i8] c", \00"
@.str.7 = [8 x i8] c" };\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 1
store i8 0, i8* %8
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %37, %2
%12 = load i32, i32* %7
%13 = urem i32 %12, 16
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %11
%18 = load i32, i32* %7
%19 = add i32 %18, 1
store i32 %19, i32* %7
%20 = trunc i32 %18 to i8
%21 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
store i8 %20, i8* %21
%22 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%23 = call i32 @scan(i8* %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %23)
%25 = load i32, i32* %7
%26 = icmp eq i32 %25, 256
br i1 %26, label %27, label %29
27: ; preds = %17
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %38
29: ; preds = %17
%30 = load i32, i32* %7
%31 = urem i32 %30, 16
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %29
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %37
35: ; preds = %29
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %37
37: ; preds = %35, %33
br label %11
38: ; preds = %27
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [9 x i8] c" \00"
@.str.3 = [7 x i8] c"0x%02x\00"
@.str.6 = [3 x i8] c", \00"
@str = [26 x i8] c"const uint ebc2asc[256] =\00"
@str.8 = [49 x i8] c" { /* Based on ISO 8859/1 and Code Page 37 */\00"
@str.9 = [2 x i8] c",\00"
@str.10 = [7 x i8] c" };\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [2 x i8]
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
store i8 0, i8* %5
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.8, i64 0, i64 0))
br label %8
8: ; preds = %30, %2
%9 = phi i32 [ 0, %2 ], [ %15, %30 ]
%10 = and i32 %9, 15
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %12, %8
%15 = add nuw nsw i32 %9, 1
%16 = trunc i32 %9 to i8
store i8 %16, i8* %4
%17 = call i32 @scan(i8* %4)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%19 = icmp eq i32 %15, 256
br i1 %19, label %20, label %23
20: ; preds = %14
%21 = call i32 @putchar(i32 10)
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.10, i64 0, i64 0))
ret i32 0
23: ; preds = %14
%24 = and i32 %15, 15
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0))
br label %30
28: ; preds = %23
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %30
30: ; preds = %28, %26
br label %8
}