#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 *, ...);
void binary_encodemap() {
  static const unsigned char sBinaryChars[] = "01";
  int i, j;
  printf("%s", "static const char* modp_b2_encodemap[] = {\n");
  unsigned char buf[9];
  buf[8] = 0;
  for (i = 0; i < 256; ++i) {
    for (j = 0; j < 8; ++j) {
      buf[j] = sBinaryChars[(i >> (7 - j)) & 1];
    }
    printf("\"%s\"", buf);
    if (i != 255) {
      printf("%s", ", ");
    }
    if ((i + 1) % 6 == 0) {
      printf("%s", "\n");
    }
  }
  printf("%s", "};\n");
}


x86 assembly (clang, -O0):
<binary_encodemap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xee4(%rip),%rdi
lea    0xee0(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x0,-0x9(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x100,-0x4(%rbp)
jge    11fc <binary_encodemap+0xec>
movl   $0x0,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    1189 <binary_encodemap+0x79>
mov    -0x4(%rbp),%eax
mov    $0x7,%ecx
sub    -0x8(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
movslq %eax,%rcx
lea    0xe90(%rip),%rax
mov    (%rax,%rcx,1),%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x11(%rbp,%rax,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114c <binary_encodemap+0x3c>
lea    -0x11(%rbp),%rsi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xff,-0x4(%rbp)
je     11bd <binary_encodemap+0xad>
lea    0xe54(%rip),%rdi
lea    0xe81(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11e9 <binary_encodemap+0xd9>
lea    0xe28(%rip),%rdi
lea    0xe5a(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ee <binary_encodemap+0xde>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1138 <binary_encodemap+0x28>
lea    0xe00(%rip),%rdi
lea    0xe30(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<binary_encodemap>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xec9(%rip),%rdi
call   1040 <puts@plt>
movb   $0x0,0x17(%rsp)
mov    $0x1,%bl
lea    0xea8(%rip),%rbp
lea    0xea7(%rip),%r14
lea    0xf(%rsp),%r13
xor    %r15d,%r15d
jmp    1177 <binary_encodemap+0x47>
nopl   0x0(%rax)
add    $0x1,%bl
add    $0x1,%r15d
mov    %r15d,%eax
mov    %rax,%rcx
shr    $0x7,%rcx
movzbl (%rcx,%rbp,1),%ecx
mov    %cl,0xf(%rsp)
mov    %r15d,%ecx
shr    $0x6,%ecx
and    $0x1,%ecx
movzbl (%rcx,%rbp,1),%ecx
mov    %cl,0x10(%rsp)
mov    %r15d,%ecx
shr    $0x5,%ecx
and    $0x1,%ecx
movzbl (%rcx,%rbp,1),%ecx
mov    %cl,0x11(%rsp)
mov    %r15d,%ecx
shr    $0x4,%ecx
and    $0x1,%ecx
movzbl (%rcx,%rbp,1),%ecx
mov    %cl,0x12(%rsp)
mov    %r15d,%ecx
shr    $0x3,%ecx
and    $0x1,%ecx
movzbl (%rcx,%rbp,1),%ecx
mov    %cl,0x13(%rsp)
mov    %r15d,%ecx
shr    $0x2,%ecx
and    $0x1,%ecx
movzbl (%rcx,%rbp,1),%ecx
mov    %cl,0x14(%rsp)
mov    %r15d,%ecx
shr    %ecx
and    $0x1,%ecx
movzbl (%rcx,%rbp,1),%ecx
mov    %cl,0x15(%rsp)
and    $0x1,%eax
movzbl (%rax,%rbp,1),%eax
mov    %al,0x16(%rsp)
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0xff,%r15d
je     1258 <binary_encodemap+0x128>
movzbl %bl,%eax
imul   $0xab,%eax,%eax
shr    $0x9,%eax
and    $0xfffffffe,%eax
lea    (%rax,%rax,2),%eax
add    $0xfe,%al
movzbl %al,%r12d
or     $0x1,%r12d
lea    0xdd1(%rip),%rdi
lea    0xdd2(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    %r15b,%r12b
jne    1170 <binary_encodemap+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1170 <binary_encodemap+0x40>
lea    0xdda(%rip),%rdi
call   1040 <puts@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@binary_encodemap.sBinaryChars = internal constant [3 x i8] c"01\00"
@.str = [3 x i8] c"%s\00"
@.str.1 = [44 x i8] c"static const char* modp_b2_encodemap[] = {\0A\00"
@.str.2 = [5 x i8] c"\22%s\22\00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [4 x i8] c"};\0A\00"
define void @binary_encodemap() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [9 x i8]
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%5 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 8
store i8 0, i8* %5
store i32 0, i32* %1
br label %6
6: ; preds = %43, %0
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 256
br i1 %8, label %9, label %46
9: ; preds = %6
store i32 0, i32* %2
br label %10
10: ; preds = %25, %9
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 8
br i1 %12, label %13, label %28
13: ; preds = %10
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = sub nsw i32 7, %15
%17 = ashr i32 %14, %16
%18 = and i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [3 x i8], [3 x i8]* @binary_encodemap.sBinaryChars, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = load i32, i32* %2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 %23
store i8 %21, i8* %24
br label %25
25: ; preds = %13
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %10
28: ; preds = %10
%29 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %29)
%31 = load i32, i32* %1
%32 = icmp ne i32 %31, 255
br i1 %32, label %33, label %35
33: ; preds = %28
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %35
35: ; preds = %33, %28
%36 = load i32, i32* %1
%37 = add nsw i32 %36, 1
%38 = srem i32 %37, 6
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %35
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %42
42: ; preds = %40, %35
br label %43
43: ; preds = %42
%44 = load i32, i32* %1
%45 = add nsw i32 %44, 1
store i32 %45, i32* %1
br label %6
46: ; preds = %6
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@binary_encodemap.sBinaryChars = internal unnamed_addr constant [3 x i8] c"01\00"
@.str = [3 x i8] c"%s\00"
@.str.2 = [5 x i8] c"\22%s\22\00"
@.str.3 = [3 x i8] c", \00"
@str = [43 x i8] c"static const char* modp_b2_encodemap[] = {\00"
@str.6 = [3 x i8] c"};\00"
define void @binary_encodemap() {
%1 = alloca [9 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%3 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 8
store i8 0, i8* %4
%5 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 1
%6 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 2
%7 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 3
%8 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 4
%9 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 5
%10 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 6
%11 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 7
br label %12
12: ; preds = %60, %0
%13 = phi i32 [ 0, %0 ], [ %56, %60 ]
%14 = lshr i32 %13, 7
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds [3 x i8], [3 x i8]* @binary_encodemap.sBinaryChars, i64 0, i64 %15
%17 = load i8, i8* %16
store i8 %17, i8* %3
%18 = lshr i32 %13, 6
%19 = and i32 %18, 1
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds [3 x i8], [3 x i8]* @binary_encodemap.sBinaryChars, i64 0, i64 %20
%22 = load i8, i8* %21
store i8 %22, i8* %5
%23 = lshr i32 %13, 5
%24 = and i32 %23, 1
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds [3 x i8], [3 x i8]* @binary_encodemap.sBinaryChars, i64 0, i64 %25
%27 = load i8, i8* %26
store i8 %27, i8* %6
%28 = lshr i32 %13, 4
%29 = and i32 %28, 1
%30 = zext i32 %29 to i64
%31 = getelementptr inbounds [3 x i8], [3 x i8]* @binary_encodemap.sBinaryChars, i64 0, i64 %30
%32 = load i8, i8* %31
store i8 %32, i8* %7
%33 = lshr i32 %13, 3
%34 = and i32 %33, 1
%35 = zext i32 %34 to i64
%36 = getelementptr inbounds [3 x i8], [3 x i8]* @binary_encodemap.sBinaryChars, i64 0, i64 %35
%37 = load i8, i8* %36
store i8 %37, i8* %8
%38 = lshr i32 %13, 2
%39 = and i32 %38, 1
%40 = zext i32 %39 to i64
%41 = getelementptr inbounds [3 x i8], [3 x i8]* @binary_encodemap.sBinaryChars, i64 0, i64 %40
%42 = load i8, i8* %41
store i8 %42, i8* %9
%43 = lshr i32 %13, 1
%44 = and i32 %43, 1
%45 = zext i32 %44 to i64
%46 = getelementptr inbounds [3 x i8], [3 x i8]* @binary_encodemap.sBinaryChars, i64 0, i64 %45
%47 = load i8, i8* %46
store i8 %47, i8* %10
%48 = and i32 %13, 1
%49 = zext i32 %48 to i64
%50 = getelementptr inbounds [3 x i8], [3 x i8]* @binary_encodemap.sBinaryChars, i64 0, i64 %49
%51 = load i8, i8* %50
store i8 %51, i8* %11
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%53 = icmp eq i32 %13, 255
br i1 %53, label %63, label %54
54: ; preds = %12
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%56 = add nuw nsw i32 %13, 1
%57 = trunc i32 %56 to i8
%58 = urem i8 %57, 6
%59 = icmp eq i8 %58, 0
br i1 %59, label %61, label %60
60: ; preds = %54, %61
br label %12
61: ; preds = %54
%62 = call i32 @putchar(i32 10)
br label %60
63: ; preds = %12
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.6, i64 0, i64 0))
ret void
}