#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*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
char *coltoa(int col) {
  static char rname[3];
  register char *p = rname;
  if (col < 0 || col > 27 * 26)
    (void)fprintf(stderr, "coltoa: invalid col: %d", col);
  if (col > 25) {
    *p++ = col / 26 + 'A' - 1;
    col %= 26;
  }
  *p++ = col + 'A';
  *p = '\0';
  return (rname);
}


x86 assembly (clang, -O0):
<coltoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0x2f0a(%rip),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     113d <coltoa+0x2d>
cmpl   $0x2be,-0x4(%rbp)
jle    1155 <coltoa+0x45>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xeb0(%rip),%rsi
call   1030 <fprintf@plt>
cmpl   $0x19,-0x4(%rbp)
jle    1191 <coltoa+0x81>
mov    -0x4(%rbp),%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x41,%eax
sub    $0x1,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x41,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2e74(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<coltoa>:
push   %rbx
mov    %edi,%ebx
cmp    $0x2bf,%edi
jb     1132 <coltoa+0x22>
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
lea    0xed5(%rip),%rsi
mov    %ebx,%edx
call   1030 <fprintf@plt>
cmp    $0x1a,%ebx
jl     1160 <coltoa+0x50>
mov    %ebx,%eax
imul   $0x4ec4ec4f,%rax,%rax
shr    $0x23,%rax
lea    0x40(%rax),%ecx
mov    %cl,0x2edf(%rip)
lea    (%rax,%rax,4),%ecx
lea    (%rcx,%rcx,4),%ecx
add    %eax,%ecx
sub    %ecx,%ebx
lea    0x2ecf(%rip),%rax
jmp    1167 <coltoa+0x57>
lea    0x2ec5(%rip),%rax
add    $0x41,%bl
mov    %bl,(%rax)
movb   $0x0,0x1(%rax)
lea    0x2eb5(%rip),%rax
pop    %rbx
ret

LLVM IR (-O0):
@coltoa.rname = internal global [3 x i8] zeroinitializer
@stderr = global i32 0
@.str = [24 x i8] c"coltoa: invalid col: %d\00"
define i8* @coltoa(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @coltoa.rname, i64 0, i64 0), i8** %3
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 702
br i1 %8, label %9, label %13
9: ; preds = %6, %1
%10 = load i32, i32* @stderr
%11 = load i32, i32* %2
%12 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %9, %6
%14 = load i32, i32* %2
%15 = icmp sgt i32 %14, 25
br i1 %15, label %16, label %26
16: ; preds = %13
%17 = load i32, i32* %2
%18 = sdiv i32 %17, 26
%19 = add nsw i32 %18, 65
%20 = sub nsw i32 %19, 1
%21 = trunc i32 %20 to i8
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %3
store i8 %21, i8* %22
%24 = load i32, i32* %2
%25 = srem i32 %24, 26
store i32 %25, i32* %2
br label %26
26: ; preds = %16, %13
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 65
%29 = trunc i32 %28 to i8
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %3
store i8 %29, i8* %30
%32 = load i8*, i8** %3
store i8 0, i8* %32
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @coltoa.rname, i64 0, i64 0)
}

LLVM IR (-O2):
@coltoa.rname = internal global [3 x i8] zeroinitializer
@stderr = global i32 0
@.str = [24 x i8] c"coltoa: invalid col: %d\00"
define i8* @coltoa(i32 %0) {
%2 = icmp ugt i32 %0, 702
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %6
6: ; preds = %1, %3
%7 = icmp sgt i32 %0, 25
br i1 %7, label %8, label %13
8: ; preds = %6
%9 = udiv i32 %0, 26
%10 = trunc i32 %9 to i8
%11 = add i8 %10, 64
store i8 %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @coltoa.rname, i64 0, i64 0)
%12 = urem i32 %0, 26
br label %13
13: ; preds = %8, %6
%14 = phi i32 [ %12, %8 ], [ %0, %6 ]
%15 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @coltoa.rname, i64 0, i64 1), %8 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @coltoa.rname, i64 0, i64 0), %6 ]
%16 = trunc i32 %14 to i8
%17 = add i8 %16, 65
%18 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %17, i8* %15
store i8 0, i8* %18
ret i8* getelementptr inbounds ([3 x i8], [3 x i8]* @coltoa.rname, i64 0, i64 0)
}