#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 *, unsigned char *);
showalphnum(unsigned int val) {
  unsigned char s[7] = {
      0,
  };
  unsigned long long max = 26 * 36 * 36 * 36 * 36 * 36 - 1;
  val = val * max / 0xffffffff;
  int ii;
  int t;
  for (ii = 0; ii < 5; ii++) {
    t = val % 36;
    s[5 - ii] = t >= 10 ? (t - 10 + 'a') : (t + '0');
    val /= 36;
  }
  s[0] = val + 'a';
  printf("alphnum is: %s\n", s);
}


x86 assembly (clang, -O0):
<showalphnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
lea    -0xf(%rbp),%rdi
xor    %esi,%esi
mov    $0x7,%edx
call   1040 <memset@plt>
movq   $0x5db4a7ff,-0x18(%rbp)
5d
mov    -0x8(%rbp),%eax
imul   -0x18(%rbp),%rax
mov    $0xffffffff,%ecx
xor    %edx,%edx
div    %rcx
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    11cc <showalphnum+0xac>
mov    -0x8(%rbp),%eax
mov    $0x24,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x20(%rbp)
cmpl   $0xa,-0x20(%rbp)
jl     1193 <showalphnum+0x73>
mov    -0x20(%rbp),%eax
sub    $0xa,%eax
add    $0x61,%eax
mov    %eax,-0x24(%rbp)
jmp    119c <showalphnum+0x7c>
mov    -0x20(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %al,%cl
mov    $0x5,%eax
sub    -0x1c(%rbp),%eax
cltq
mov    %cl,-0xf(%rbp,%rax,1)
mov    -0x8(%rbp),%eax
mov    $0x24,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x8(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115f <showalphnum+0x3f>
mov    -0x8(%rbp),%eax
add    $0x61,%eax
mov    %al,-0xf(%rbp)
lea    -0xf(%rbp),%rsi
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showalphnum>:
push   %rax
movb   $0x0,0x7(%rsp)
mov    %edi,%eax
imul   $0x5db4a7ff,%rax,%rax
movabs $0x8000000080000001,%rcx
mul    %rcx
shr    $0x1f,%rdx
imul   $0x38e38e39,%rdx,%rax
shr    $0x23,%rax
lea    0x0(,%rax,4),%ecx
lea    (%rcx,%rcx,8),%ecx
mov    %edx,%esi
sub    %ecx,%esi
lea    0x57(%rsi),%edi
neg    %ecx
cmp    $0xa,%esi
lea    0x30(%rdx,%rcx,1),%ecx
cmovae %edi,%ecx
mov    %cl,0x6(%rsp)
imul   $0x38e38e39,%rax,%rcx
shr    $0x23,%rcx
shl    $0x2,%ecx
lea    (%rcx,%rcx,8),%ecx
mov    %eax,%esi
sub    %ecx,%esi
lea    0x57(%rsi),%edi
neg    %ecx
cmp    $0xa,%esi
lea    0x30(%rax,%rcx,1),%eax
cmovae %edi,%eax
mov    $0xca4587e7,%ecx
imul   %rdx,%rcx
shr    $0x2a,%rcx
imul   $0x38e38e39,%rcx,%rsi
shr    $0x23,%rsi
shl    $0x2,%esi
lea    (%rsi,%rsi,8),%esi
sub    %esi,%ecx
lea    0x30(%rcx),%esi
lea    0x57(%rcx),%edi
cmp    $0xa,%ecx
cmovb  %esi,%edi
mov    %al,0x5(%rsp)
mov    %dil,0x4(%rsp)
imul   $0x59e60383,%rdx,%rax
shr    $0x2e,%rax
movzwl %ax,%ecx
imul   $0xe38f,%ecx,%ecx
shr    $0x13,%ecx
and    $0xfffffffc,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cmp    $0xa,%ax
mov    $0x57,%ecx
mov    $0x30,%esi
cmovae %ecx,%esi
add    %al,%sil
mov    $0x9fd1cd5b,%eax
imul   %rdx,%rax
shr    $0x34,%rax
imul   $0xe38f,%eax,%edi
shr    $0x13,%edi
and    $0xfffffffc,%edi
lea    (%rdi,%rdi,8),%edi
sub    %edi,%eax
mov    $0x30,%edi
cmp    $0xa,%ax
cmovae %ecx,%edi
mov    %sil,0x3(%rsp)
add    %al,%dil
mov    %dil,0x2(%rsp)
shr    $0xa,%edx
imul   $0x2383f5,%rdx,%rax
shr    $0x25,%rax
add    $0x61,%al
mov    %al,0x1(%rsp)
lea    0xdc6(%rip),%rdi
lea    0x1(%rsp),%rsi
call   1030 <printf@plt>
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"alphnum is: %s\0A\00"
define i32 @showalphnum(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [7 x i8]
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
%8 = bitcast [7 x i8]* %4 to i8*
store i64 1572120575, i64* %5
%9 = load i32, i32* %3
%10 = zext i32 %9 to i64
%11 = load i64, i64* %5
%12 = mul i64 %10, %11
%13 = udiv i64 %12, 4294967295
%14 = trunc i64 %13 to i32
store i32 %14, i32* %3
store i32 0, i32* %6
br label %15
15: ; preds = %39, %1
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 5
br i1 %17, label %18, label %42
18: ; preds = %15
%19 = load i32, i32* %3
%20 = urem i32 %19, 36
store i32 %20, i32* %7
%21 = load i32, i32* %7
%22 = icmp sge i32 %21, 10
br i1 %22, label %23, label %27
23: ; preds = %18
%24 = load i32, i32* %7
%25 = sub nsw i32 %24, 10
%26 = add nsw i32 %25, 97
br label %30
27: ; preds = %18
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 48
br label %30
30: ; preds = %27, %23
%31 = phi i32 [ %26, %23 ], [ %29, %27 ]
%32 = trunc i32 %31 to i8
%33 = load i32, i32* %6
%34 = sub nsw i32 5, %33
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 %35
store i8 %32, i8* %36
%37 = load i32, i32* %3
%38 = udiv i32 %37, 36
store i32 %38, i32* %3
br label %39
39: ; preds = %30
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %15
42: ; preds = %15
%43 = load i32, i32* %3
%44 = add i32 %43, 97
%45 = trunc i32 %44 to i8
%46 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
store i8 %45, i8* %46
%47 = getelementptr inbounds [7 x i8], [7 x i8]* %4, i64 0, i64 0
%48 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %47)
%49 = load i32, i32* %2
ret i32 %49
}

LLVM IR (-O2):
@.str = [16 x i8] c"alphnum is: %s\0A\00"
define i32 @showalphnum(i32 %0) {
%2 = alloca [7 x i8]
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 6
store i8 0, i8* %4
%5 = zext i32 %0 to i64
%6 = mul nuw nsw i64 %5, 1572120575
%7 = udiv i64 %6, 4294967295
%8 = trunc i64 %7 to i32
%9 = urem i32 %8, 36
%10 = icmp ugt i32 %9, 9
%11 = select i1 %10, i32 87, i32 48
%12 = add nuw nsw i32 %11, %9
%13 = trunc i32 %12 to i8
%14 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 5
store i8 %13, i8* %14
%15 = udiv i32 %8, 36
%16 = urem i32 %15, 36
%17 = icmp ugt i32 %16, 9
%18 = select i1 %17, i32 87, i32 48
%19 = add nuw nsw i32 %18, %16
%20 = trunc i32 %19 to i8
%21 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 4
store i8 %20, i8* %21
%22 = udiv i32 %8, 1296
%23 = urem i32 %22, 36
%24 = icmp ugt i32 %23, 9
%25 = select i1 %24, i32 87, i32 48
%26 = add nuw nsw i32 %25, %23
%27 = trunc i32 %26 to i8
%28 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 3
store i8 %27, i8* %28
%29 = udiv i32 %8, 46656
%30 = trunc i32 %29 to i16
%31 = urem i16 %30, 36
%32 = trunc i16 %31 to i8
%33 = icmp ugt i16 %31, 9
%34 = select i1 %33, i8 87, i8 48
%35 = add nuw i8 %34, %32
%36 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 2
store i8 %35, i8* %36
%37 = udiv i32 %8, 1679616
%38 = trunc i32 %37 to i16
%39 = urem i16 %38, 36
%40 = trunc i16 %39 to i8
%41 = icmp ugt i16 %39, 9
%42 = select i1 %41, i8 87, i8 48
%43 = add nuw i8 %42, %40
%44 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 1
store i8 %43, i8* %44
%45 = udiv i32 %8, 60466176
%46 = trunc i32 %45 to i8
%47 = add nuw nsw i8 %46, 97
store i8 %47, i8* %3
%48 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 undef
}