void createVarNameAscii(unsigned char x, unsigned int y, char varname[]) {
  varname[0] = '0' + x / 100;
  varname[1] = '0' + (x / 10) % 10;
  varname[2] = '0' + x % 10;
  varname[3] = '0' + y / 10;
  varname[4] = '0' + y % 10;
  varname[5] = 0;
}


x86 assembly (clang, -O0):
<createVarNameAscii>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movzbl -0x1(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
movzbl -0x1(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
movzbl -0x1(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
add    $0x30,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x4(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x5(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<createVarNameAscii>:
lea    (%rdi,%rdi,4),%eax
lea    (%rdi,%rax,8),%eax
shr    $0xc,%eax
or     $0x30,%al
mov    %al,(%rdx)
imul   $0xcd,%edi,%eax
shr    $0xb,%eax
imul   $0xcd,%eax,%ecx
shr    $0xa,%ecx
and    $0xfffffffe,%ecx
lea    (%rcx,%rcx,4),%r8d
mov    %eax,%ecx
sub    %r8b,%cl
or     $0x30,%cl
mov    %cl,0x1(%rdx)
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %al,%dil
or     $0x30,%dil
mov    %dil,0x2(%rdx)
mov    %esi,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x23,%rcx
lea    0x30(%rcx),%eax
mov    %al,0x3(%rdx)
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%eax
sub    %eax,%esi
or     $0x30,%sil
mov    %sil,0x4(%rdx)
movb   $0x0,0x5(%rdx)
ret

LLVM IR (-O0):
define void @createVarNameAscii(i8 zeroext %0, i32 %1, i8* %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i8*
store i8 %0, i8* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
%9 = sdiv i32 %8, 100
%10 = add nsw i32 48, %9
%11 = trunc i32 %10 to i8
%12 = load i8*, i8** %6
%13 = getelementptr inbounds i8, i8* %12, i64 0
store i8 %11, i8* %13
%14 = load i8, i8* %4
%15 = zext i8 %14 to i32
%16 = sdiv i32 %15, 10
%17 = srem i32 %16, 10
%18 = add nsw i32 48, %17
%19 = trunc i32 %18 to i8
%20 = load i8*, i8** %6
%21 = getelementptr inbounds i8, i8* %20, i64 1
store i8 %19, i8* %21
%22 = load i8, i8* %4
%23 = zext i8 %22 to i32
%24 = srem i32 %23, 10
%25 = add nsw i32 48, %24
%26 = trunc i32 %25 to i8
%27 = load i8*, i8** %6
%28 = getelementptr inbounds i8, i8* %27, i64 2
store i8 %26, i8* %28
%29 = load i32, i32* %5
%30 = udiv i32 %29, 10
%31 = add i32 48, %30
%32 = trunc i32 %31 to i8
%33 = load i8*, i8** %6
%34 = getelementptr inbounds i8, i8* %33, i64 3
store i8 %32, i8* %34
%35 = load i32, i32* %5
%36 = urem i32 %35, 10
%37 = add i32 48, %36
%38 = trunc i32 %37 to i8
%39 = load i8*, i8** %6
%40 = getelementptr inbounds i8, i8* %39, i64 4
store i8 %38, i8* %40
%41 = load i8*, i8** %6
%42 = getelementptr inbounds i8, i8* %41, i64 5
store i8 0, i8* %42
ret void
}

LLVM IR (-O2):
define void @createVarNameAscii(i8 zeroext %0, i32 %1, i8* nocapture writeonly %2) {
%4 = udiv i8 %0, 100
%5 = or i8 %4, 48
store i8 %5, i8* %2
%6 = udiv i8 %0, 10
%7 = urem i8 %6, 10
%8 = or i8 %7, 48
%9 = getelementptr inbounds i8, i8* %2, i64 1
store i8 %8, i8* %9
%10 = urem i8 %0, 10
%11 = or i8 %10, 48
%12 = getelementptr inbounds i8, i8* %2, i64 2
store i8 %11, i8* %12
%13 = udiv i32 %1, 10
%14 = trunc i32 %13 to i8
%15 = add i8 %14, 48
%16 = getelementptr inbounds i8, i8* %2, i64 3
store i8 %15, i8* %16
%17 = urem i32 %1, 10
%18 = trunc i32 %17 to i8
%19 = or i8 %18, 48
%20 = getelementptr inbounds i8, i8* %2, i64 4
store i8 %19, i8* %20
%21 = getelementptr inbounds i8, i8* %2, i64 5
store i8 0, i8* %21
ret void
}