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

/* Variables and functions */
int /*<<< orphan*/ sqlite3Randomness(int, unsigned char *);
void randomName(unsigned char *zBuf) {
  static const unsigned char zChars[] = "abcdefghijklmnopqrstuvwxyz"
                                        "0123456789";
  int i;
  sqlite3Randomness(20, zBuf);
  for (i = 0; i < 20; i++) {
    zBuf[i] = zChars[zBuf[i] % (sizeof(zChars) - 1)];
  }
}


x86 assembly (clang, -O0):
<randomName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x14,%edi
call   1030 <sqlite3Randomness@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x14,-0xc(%rbp)
jge    1174 <randomName+0x64>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    $0x24,%ecx
xor    %edx,%edx
div    %rcx
lea    0xea8(%rip),%rax
mov    (%rax,%rdx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1131 <randomName+0x21>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomName>:
push   %rbx
mov    %rdi,%rbx
mov    $0x14,%edi
mov    %rbx,%rsi
call   1030 <sqlite3Randomness@plt>
mov    $0x1,%eax
lea    0xed3(%rip),%rcx
nopl   (%rax)
movzbl -0x1(%rbx,%rax,1),%edx
imul   $0x39,%edx,%esi
shr    $0x9,%esi
and    $0xfffffffc,%esi
lea    (%rsi,%rsi,8),%esi
sub    %sil,%dl
movzbl %dl,%edx
movzbl (%rdx,%rcx,1),%edx
mov    %dl,-0x1(%rbx,%rax,1)
movzbl (%rbx,%rax,1),%edx
imul   $0x39,%edx,%esi
shr    $0x9,%esi
and    $0xfffffffc,%esi
lea    (%rsi,%rsi,8),%esi
sub    %sil,%dl
movzbl %dl,%edx
movzbl (%rdx,%rcx,1),%edx
mov    %dl,(%rbx,%rax,1)
add    $0x2,%rax
cmp    $0x15,%rax
jne    1130 <randomName+0x20>
pop    %rbx
ret

LLVM IR (-O0):
@randomName.zChars = internal constant [37 x i8] c"abcdefghijklmnopqrstuvwxyz0123456789\00"
define void @randomName(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @sqlite3Randomness(i32 20, i8* %4)
store i32 0, i32* %3
br label %6
6: ; preds = %23, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 20
br i1 %8, label %9, label %26
9: ; preds = %6
%10 = load i8*, i8** %2
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = load i8, i8* %13
%15 = zext i8 %14 to i64
%16 = urem i64 %15, 36
%17 = getelementptr inbounds [37 x i8], [37 x i8]* @randomName.zChars, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = load i8*, i8** %2
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
store i8 %18, i8* %22
br label %23
23: ; preds = %9
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %6
26: ; preds = %6
ret void
}

LLVM IR (-O2):
@randomName.zChars = internal unnamed_addr constant [37 x i8] c"abcdefghijklmnopqrstuvwxyz0123456789\00"
define void @randomName(i8* %0) {
%2 = tail call i32 @sqlite3Randomness(i32 20, i8* %0)
br label %3
3: ; preds = %3, %1
%4 = phi i64 [ 0, %1 ], [ %18, %3 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = urem i8 %6, 36
%8 = zext i8 %7 to i64
%9 = getelementptr inbounds [37 x i8], [37 x i8]* @randomName.zChars, i64 0, i64 %8
%10 = load i8, i8* %9
store i8 %10, i8* %5
%11 = or i64 %4, 1
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = urem i8 %13, 36
%15 = zext i8 %14 to i64
%16 = getelementptr inbounds [37 x i8], [37 x i8]* @randomName.zChars, i64 0, i64 %15
%17 = load i8, i8* %16
store i8 %17, i8* %12
%18 = add nuw nsw i64 %4, 2
%19 = icmp eq i64 %18, 20
br i1 %19, label %20, label %3
20: ; preds = %3
ret void
}