#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*/ memset(char *, int /*<<< orphan*/, int);
void _b64_compute_codebook(const char *forward, char *reverse) {
  size_t i = 0;
  memset(reverse, 0, 256);
  for (; (i < 64); ++i) {
    reverse[forward[i]] = i;
  }
}


x86 assembly (clang, -O0):
<_b64_compute_codebook>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1030 <memset@plt>
cmpq   $0x40,-0x18(%rbp)
jae    116e <_b64_compute_codebook+0x5e>
mov    -0x18(%rbp),%rax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rsi
movsbq (%rcx,%rsi,1),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1138 <_b64_compute_codebook+0x28>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_b64_compute_codebook>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1030 <memset@plt>
nopl   0x0(%rax)
movsbq (%r15,%rbx,1),%rax
mov    %bl,(%r14,%rax,1)
movsbq 0x1(%r15,%rbx,1),%rax
lea    0x1(%rbx),%ecx
mov    %cl,(%r14,%rax,1)
movsbq 0x2(%r15,%rbx,1),%rax
lea    0x2(%rbx),%ecx
mov    %cl,(%r14,%rax,1)
movsbq 0x3(%r15,%rbx,1),%rax
lea    0x3(%rbx),%ecx
mov    %cl,(%r14,%rax,1)
add    $0x4,%rbx
cmp    $0x40,%rbx
jne    1130 <_b64_compute_codebook+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @_b64_compute_codebook(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
store i64 0, i64* %5
%6 = load i8*, i8** %4
%7 = call i32 @memset(i8* %6, i32 0, i32 256)
br label %8
8: ; preds = %21, %2
%9 = load i64, i64* %5
%10 = icmp ult i64 %9, 64
br i1 %10, label %11, label %24
11: ; preds = %8
%12 = load i64, i64* %5
%13 = trunc i64 %12 to i8
%14 = load i8*, i8** %4
%15 = load i8*, i8** %3
%16 = load i64, i64* %5
%17 = getelementptr inbounds i8, i8* %15, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i64
%20 = getelementptr inbounds i8, i8* %14, i64 %19
store i8 %13, i8* %20
br label %21
21: ; preds = %11
%22 = load i64, i64* %5
%23 = add i64 %22, 1
store i64 %23, i64* %5
br label %8
24: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @_b64_compute_codebook(i8* nocapture %0, i8* %1) {
%3 = tail call i32 @memset(i8* %1, i32 0, i32 256)
br label %4
4: ; preds = %4, %2
%5 = phi i64 [ 0, %2 ], [ %29, %4 ]
%6 = trunc i64 %5 to i8
%7 = getelementptr inbounds i8, i8* %0, i64 %5
%8 = load i8, i8* %7
%9 = sext i8 %8 to i64
%10 = getelementptr inbounds i8, i8* %1, i64 %9
store i8 %6, i8* %10
%11 = or i64 %5, 1
%12 = trunc i64 %11 to i8
%13 = getelementptr inbounds i8, i8* %0, i64 %11
%14 = load i8, i8* %13
%15 = sext i8 %14 to i64
%16 = getelementptr inbounds i8, i8* %1, i64 %15
store i8 %12, i8* %16
%17 = or i64 %5, 2
%18 = trunc i64 %17 to i8
%19 = getelementptr inbounds i8, i8* %0, i64 %17
%20 = load i8, i8* %19
%21 = sext i8 %20 to i64
%22 = getelementptr inbounds i8, i8* %1, i64 %21
store i8 %18, i8* %22
%23 = or i64 %5, 3
%24 = trunc i64 %23 to i8
%25 = getelementptr inbounds i8, i8* %0, i64 %23
%26 = load i8, i8* %25
%27 = sext i8 %26 to i64
%28 = getelementptr inbounds i8, i8* %1, i64 %27
store i8 %24, i8* %28
%29 = add nuw nsw i64 %5, 4
%30 = icmp eq i64 %29, 64
br i1 %30, label %31, label %4
31: ; preds = %4
ret void
}