#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 rand();
char *randname() {
  static char name[9];
  int i;
  int r;
  name[0] = 'B';
  for (i = 1; i < 8; i++) {
    r = rand() % (26 + 10);
    if (r < 10)
      name[i] = (char)(r + '0');
    else
      name[i] = (char)(r + 'A' - 10);
  }
  name[8] = 0;
  return name;
}


x86 assembly (clang, -O0):
<randname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x42,0x2f0a(%rip)
movl   $0x1,-0x4(%rbp)
cmpl   $0x8,-0x4(%rbp)
jge    1193 <randname+0x83>
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x24,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1167 <randname+0x57>
mov    -0x8(%rbp),%eax
add    $0x30,%eax
mov    %al,%dl
movslq -0x4(%rbp),%rcx
lea    0x2eca(%rip),%rax
mov    %dl,(%rax,%rcx,1)
jmp    1180 <randname+0x70>
mov    -0x8(%rbp),%eax
add    $0x41,%eax
sub    $0xa,%eax
mov    %al,%dl
movslq -0x4(%rbp),%rcx
lea    0x2eac(%rip),%rax
mov    %dl,(%rax,%rcx,1)
jmp    1185 <randname+0x75>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1126 <randname+0x16>
movb   $0x0,0x2e97(%rip)
lea    0x2e88(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randname>:
push   %rbp
push   %r14
push   %rbx
movb   $0x42,0x2f0e(%rip)
lea    0x2f07(%rip),%r14
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cmp    $0xa,%eax
mov    $0x30,%ebx
mov    $0x37,%ebp
mov    $0x37,%ecx
cmovl  %ebx,%ecx
add    %al,%cl
mov    %cl,0x2ec6(%rip)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cmp    $0xa,%eax
mov    $0x37,%ecx
cmovl  %ebx,%ecx
add    %cl,%al
mov    %al,0x2e8f(%rip)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cmp    $0xa,%eax
mov    $0x37,%ecx
cmovl  %ebx,%ecx
add    %cl,%al
mov    %al,0x2e58(%rip)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cmp    $0xa,%eax
mov    $0x37,%ecx
cmovl  %ebx,%ecx
add    %cl,%al
mov    %al,0x2e21(%rip)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cmp    $0xa,%eax
mov    $0x37,%ecx
cmovl  %ebx,%ecx
add    %cl,%al
mov    %al,0x2dea(%rip)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cmp    $0xa,%eax
mov    $0x37,%ecx
cmovl  %ebx,%ecx
add    %cl,%al
mov    %al,0x2db3(%rip)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cmp    $0xa,%eax
cmovl  %ebx,%ebp
add    %bpl,%al
mov    %al,0x2d80(%rip)
movb   $0x0,0x2d7a(%rip)
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@randname.name = internal global [9 x i8] zeroinitializer
define i8* @randname() {
%1 = alloca i32
%2 = alloca i32
store i8 66, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @randname.name, i64 0, i64 0)
store i32 1, i32* %1
br label %3
3: ; preds = %27, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 8
br i1 %5, label %6, label %30
6: ; preds = %3
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 36
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %18
11: ; preds = %6
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 48
%14 = trunc i32 %13 to i8
%15 = load i32, i32* %1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [9 x i8], [9 x i8]* @randname.name, i64 0, i64 %16
store i8 %14, i8* %17
br label %26
18: ; preds = %6
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 65
%21 = sub nsw i32 %20, 10
%22 = trunc i32 %21 to i8
%23 = load i32, i32* %1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [9 x i8], [9 x i8]* @randname.name, i64 0, i64 %24
store i8 %22, i8* %25
br label %26
26: ; preds = %18, %11
br label %27
27: ; preds = %26
%28 = load i32, i32* %1
%29 = add nsw i32 %28, 1
store i32 %29, i32* %1
br label %3
30: ; preds = %3
store i8 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @randname.name, i64 0, i64 8)
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @randname.name, i64 0, i64 0)
}

LLVM IR (-O2):
@randname.name = internal global [9 x i8] zeroinitializer
define i8* @randname() {
store i8 66, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @randname.name, i64 0, i64 0)
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 36
%3 = icmp slt i32 %2, 10
%4 = trunc i32 %2 to i8
%5 = select i1 %3, i8 48, i8 55
%6 = add nsw i8 %5, %4
store i8 %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @randname.name, i64 0, i64 1)
%7 = tail call i32 (...) @rand()
%8 = srem i32 %7, 36
%9 = icmp slt i32 %8, 10
%10 = select i1 %9, i8 48, i8 55
%11 = trunc i32 %8 to i8
%12 = add nsw i8 %10, %11
store i8 %12, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @randname.name, i64 0, i64 2)
%13 = tail call i32 (...) @rand()
%14 = srem i32 %13, 36
%15 = icmp slt i32 %14, 10
%16 = select i1 %15, i8 48, i8 55
%17 = trunc i32 %14 to i8
%18 = add nsw i8 %16, %17
store i8 %18, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @randname.name, i64 0, i64 3)
%19 = tail call i32 (...) @rand()
%20 = srem i32 %19, 36
%21 = icmp slt i32 %20, 10
%22 = select i1 %21, i8 48, i8 55
%23 = trunc i32 %20 to i8
%24 = add nsw i8 %22, %23
store i8 %24, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @randname.name, i64 0, i64 4)
%25 = tail call i32 (...) @rand()
%26 = srem i32 %25, 36
%27 = icmp slt i32 %26, 10
%28 = select i1 %27, i8 48, i8 55
%29 = trunc i32 %26 to i8
%30 = add nsw i8 %28, %29
store i8 %30, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @randname.name, i64 0, i64 5)
%31 = tail call i32 (...) @rand()
%32 = srem i32 %31, 36
%33 = icmp slt i32 %32, 10
%34 = select i1 %33, i8 48, i8 55
%35 = trunc i32 %32 to i8
%36 = add nsw i8 %34, %35
store i8 %36, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @randname.name, i64 0, i64 6)
%37 = tail call i32 (...) @rand()
%38 = srem i32 %37, 36
%39 = icmp slt i32 %38, 10
%40 = select i1 %39, i8 48, i8 55
%41 = trunc i32 %38 to i8
%42 = add nsw i8 %40, %41
store i8 %42, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @randname.name, i64 0, i64 7)
store i8 0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @randname.name, i64 0, i64 8)
ret i8* getelementptr inbounds ([9 x i8], [9 x i8]* @randname.name, i64 0, i64 0)
}