#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*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void EncodingTable(FILE *out, const char *name, const unsigned *encoding_table,
                   int chars) {
  fprintf(out, "};\n\n");
  fprintf(out,
          "\t/// character encoding for each index entry\n"
          "static const unsigned short __%s_index__[] = {\n",
          name);
  while (chars--) {
    fprintf(out, "\t%u,\n", *encoding_table++);
  }
}


x86 assembly (clang, -O0):
<EncodingTable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xece(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xebd(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
je     118b <EncodingTable+0x7b>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%edx
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    114f <EncodingTable+0x3f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EncodingTable>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xec6(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %r12,%rcx
call   1040 <fwrite@plt>
lea    0xeb2(%rip),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %ebp,%ebp
je     1189 <EncodingTable+0x69>
mov    %ebp,%ebp
lea    0xef5(%rip),%r15
xor    %ebx,%ebx
nop
mov    (%r14,%rbx,4),%edx
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%rbx
cmp    %ebx,%ebp
jne    1170 <EncodingTable+0x50>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"};\0A\0A\00"
@.str.1 = [93 x i8] c"\09/// character encoding for each index entry\0Astatic const unsigned short __%s_index__[] = {\0A\00"
@.str.2 = [6 x i8] c"\09%u,\0A\00"
define void @EncodingTable(i32* %0, i8* %1, i32* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%9 = load i32*, i32** %5
%10 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%11 = load i32*, i32** %5
%12 = load i8*, i8** %6
%13 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str.1, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %18, %4
%15 = load i32, i32* %8
%16 = add nsw i32 %15, -1
store i32 %16, i32* %8
%17 = icmp ne i32 %15, 0
br i1 %17, label %18, label %24
18: ; preds = %14
%19 = load i32*, i32** %5
%20 = load i32*, i32** %7
%21 = getelementptr inbounds i32, i32* %20, i32 1
store i32* %21, i32** %7
%22 = load i32, i32* %20
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %22)
br label %14
24: ; preds = %14
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"};\0A\0A\00"
@.str.1 = [93 x i8] c"\09/// character encoding for each index entry\0Astatic const unsigned short __%s_index__[] = {\0A\00"
@.str.2 = [6 x i8] c"\09%u,\0A\00"
define void @EncodingTable(i32* nocapture %0, i8* %1, i32* nocapture %2, i32 %3) {
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 4, i64 1, i32* %0)
%6 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([93 x i8], [93 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%7 = icmp eq i32 %3, 0
br i1 %7, label %16, label %8
8: ; preds = %4, %8
%9 = phi i32 [ %11, %8 ], [ %3, %4 ]
%10 = phi i32* [ %12, %8 ], [ %2, %4 ]
%11 = add nsw i32 %9, -1
%12 = getelementptr inbounds i32, i32* %10, i64 1
%13 = load i32, i32* %10
%14 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = icmp eq i32 %11, 0
br i1 %15, label %16, label %8
16: ; preds = %8, %4
ret void
}