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

/* Variables and functions */
int /*<<< orphan*/ _genieWriteInhLabel(int, char *);
long abs(long);
int _genieMakeInhLabel(int index, long n, int base) {
  char buf[8 * sizeof(long) + 1];
  char *str = &buf[sizeof(buf) - 1];
  int neg = 0;
  if (n < 0)
    neg = 1;
  n = abs(n);
  *str = '\0';
  do {
    unsigned long m = n;
    n /= base;
    char c = m - base * n;
    *--str = c < 10 ? c + '0' : c + 'A' - 10;
  } while (n);
  if (neg)
    *--str = '-';
  _genieWriteInhLabel(index, str);
  return 0;
}


x86 assembly (clang, -O0):
<_genieMakeInhLabel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x60(%rbp),%rax
add    $0x40,%rax
mov    %rax,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    115a <_genieMakeInhLabel+0x3a>
movl   $0x1,-0x6c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <abs@plt>
mov    %rax,-0x10(%rbp)
mov    -0x68(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x78(%rbp)
movslq -0x14(%rbp),%rcx
mov    -0x10(%rbp),%rax
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
mov    -0x78(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %al,-0x79(%rbp)
movsbl -0x79(%rbp),%eax
cmp    $0xa,%eax
jge    11b6 <_genieMakeInhLabel+0x96>
movsbl -0x79(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x80(%rbp)
jmp    11c3 <_genieMakeInhLabel+0xa3>
movsbl -0x79(%rbp),%eax
add    $0x41,%eax
sub    $0xa,%eax
mov    %eax,-0x80(%rbp)
mov    -0x80(%rbp),%eax
mov    %al,%cl
mov    -0x68(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x68(%rbp)
mov    %cl,-0x1(%rax)
cmpq   $0x0,-0x10(%rbp)
jne    116e <_genieMakeInhLabel+0x4e>
cmpl   $0x0,-0x6c(%rbp)
je     1202 <_genieMakeInhLabel+0xe2>
mov    -0x68(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x68(%rbp)
movb   $0x2d,-0x1(%rax)
mov    -0x4(%rbp),%edi
mov    -0x68(%rbp),%rsi
call   1040 <_genieWriteInhLabel@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_genieMakeInhLabel>:
sub    $0x48,%rsp
mov    %edx,%r9d
mov    %rsi,%r8
mov    %rsi,%rax
neg    %rax
cmovs  %rsi,%rax
movb   $0x0,0x40(%rsp)
movslq %edx,%r11
lea    0x3f(%rsp),%rsi
mov    $0x30,%r10d
jmp    115e <_genieMakeInhLabel+0x4e>
nopl   0x0(%rax)
cqto
idiv   %r11
cmp    $0xa,%dl
mov    $0x37,%ecx
cmovl  %r10d,%ecx
add    %dl,%cl
mov    %cl,(%rsi)
add    $0xffffffffffffffff,%rsi
test   %rax,%rax
je     1171 <_genieMakeInhLabel+0x61>
mov    %rax,%rdx
or     %r11,%rdx
shr    $0x20,%rdx
jne    1140 <_genieMakeInhLabel+0x30>
xor    %edx,%edx
div    %r9d
jmp    1145 <_genieMakeInhLabel+0x35>
test   %r8,%r8
js     117c <_genieMakeInhLabel+0x6c>
add    $0x1,%rsi
jmp    117f <_genieMakeInhLabel+0x6f>
movb   $0x2d,(%rsi)
call   1030 <_genieWriteInhLabel@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
define i32 @_genieMakeInhLabel(i32 %0, i64 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
%7 = alloca [65 x i8]
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i64
%11 = alloca i8
store i32 %0, i32* %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%12 = getelementptr inbounds [65 x i8], [65 x i8]* %7, i64 0, i64 64
store i8* %12, i8** %8
store i32 0, i32* %9
%13 = load i64, i64* %5
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %3
store i32 1, i32* %9
br label %16
16: ; preds = %15, %3
%17 = load i64, i64* %5
%18 = call i64 @abs(i64 %17)
store i64 %18, i64* %5
%19 = load i8*, i8** %8
store i8 0, i8* %19
br label %20
20: ; preds = %50, %16
%21 = load i64, i64* %5
store i64 %21, i64* %10
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = load i64, i64* %5
%25 = sdiv i64 %24, %23
store i64 %25, i64* %5
%26 = load i64, i64* %10
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = load i64, i64* %5
%30 = mul nsw i64 %28, %29
%31 = sub i64 %26, %30
%32 = trunc i64 %31 to i8
store i8 %32, i8* %11
%33 = load i8, i8* %11
%34 = sext i8 %33 to i32
%35 = icmp slt i32 %34, 10
br i1 %35, label %36, label %40
36: ; preds = %20
%37 = load i8, i8* %11
%38 = sext i8 %37 to i32
%39 = add nsw i32 %38, 48
br label %45
40: ; preds = %20
%41 = load i8, i8* %11
%42 = sext i8 %41 to i32
%43 = add nsw i32 %42, 65
%44 = sub nsw i32 %43, 10
br label %45
45: ; preds = %40, %36
%46 = phi i32 [ %39, %36 ], [ %44, %40 ]
%47 = trunc i32 %46 to i8
%48 = load i8*, i8** %8
%49 = getelementptr inbounds i8, i8* %48, i32 -1
store i8* %49, i8** %8
store i8 %47, i8* %49
br label %50
50: ; preds = %45
%51 = load i64, i64* %5
%52 = icmp ne i64 %51, 0
br i1 %52, label %20, label %53
53: ; preds = %50
%54 = load i32, i32* %9
%55 = icmp ne i32 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %53
%57 = load i8*, i8** %8
%58 = getelementptr inbounds i8, i8* %57, i32 -1
store i8* %58, i8** %8
store i8 45, i8* %58
br label %59
59: ; preds = %56, %53
%60 = load i32, i32* %4
%61 = load i8*, i8** %8
%62 = call i32 @_genieWriteInhLabel(i32 %60, i8* %61)
ret i32 0
}

LLVM IR (-O2):
define i32 @_genieMakeInhLabel(i32 %0, i64 %1, i32 %2) {
%4 = alloca [65 x i8]
%5 = getelementptr inbounds [65 x i8], [65 x i8]* %4, i64 0, i64 0
%6 = getelementptr inbounds [65 x i8], [65 x i8]* %4, i64 0, i64 64
%7 = tail call i64 @llvm.abs.i64(i64 %1, i1 true)
store i8 0, i8* %6
%8 = sext i32 %2 to i64
br label %9
9: ; preds = %9, %3
%10 = phi i8* [ %6, %3 ], [ %19, %9 ]
%11 = phi i64 [ %7, %3 ], [ %12, %9 ]
%12 = sdiv i64 %11, %8
%13 = mul nsw i64 %12, %8
%14 = srem i64 %11, %8
%15 = trunc i64 %14 to i8
%16 = icmp slt i8 %15, 10
%17 = select i1 %16, i8 48, i8 55
%18 = add i8 %17, %15
%19 = getelementptr inbounds i8, i8* %10, i64 -1
store i8 %18, i8* %19
%20 = icmp eq i64 %12, 0
br i1 %20, label %21, label %9
21: ; preds = %9
%22 = icmp slt i64 %1, 0
br i1 %22, label %23, label %25
23: ; preds = %21
%24 = getelementptr inbounds i8, i8* %10, i64 -2
store i8 45, i8* %24
br label %25
25: ; preds = %23, %21
%26 = phi i8* [ %24, %23 ], [ %19, %21 ]
%27 = call i32 @_genieWriteInhLabel(i32 %0, i8* %26)
ret i32 0
}