#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 *, char);
main() {
  unsigned int k = 987, i = 0;
  char trans[10];
  do {
    trans[i++] = (k % 16 > 9) ? (k % 16 - 10 + 'a') : (k % 16 - '0');
  } while (k /= 16);
  for (i = 0; i < 10; i++)
    printf("%d ", trans[i]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3db,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0xf,%eax
cmp    $0x9,%eax
jbe    1150 <main+0x40>
mov    -0x8(%rbp),%eax
and    $0xf,%eax
sub    $0xa,%eax
add    $0x61,%eax
mov    %eax,-0x1c(%rbp)
jmp    115c <main+0x4c>
mov    -0x8(%rbp),%eax
and    $0xf,%eax
sub    $0x30,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %al,%cl
mov    -0xc(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
mov    %eax,%eax
mov    %cl,-0x16(%rbp,%rax,1)
mov    -0x8(%rbp),%eax
shr    $0x4,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jne    112d <main+0x1d>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jae    11b7 <main+0xa7>
mov    -0xc(%rbp),%eax
lea    0xe61(%rip),%rdi
movsbl -0x16(%rbp,%rax,1),%esi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118b <main+0x7b>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x62,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xffffffd3,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [10 x i8]
store i32 0, i32* %1
store i32 987, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %25, %0
%6 = load i32, i32* %2
%7 = urem i32 %6, 16
%8 = icmp ugt i32 %7, 9
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = load i32, i32* %2
%11 = urem i32 %10, 16
%12 = sub i32 %11, 10
%13 = add i32 %12, 97
br label %18
14: ; preds = %5
%15 = load i32, i32* %2
%16 = urem i32 %15, 16
%17 = sub i32 %16, 48
br label %18
18: ; preds = %14, %9
%19 = phi i32 [ %13, %9 ], [ %17, %14 ]
%20 = trunc i32 %19 to i8
%21 = load i32, i32* %3
%22 = add i32 %21, 1
store i32 %22, i32* %3
%23 = zext i32 %21 to i64
%24 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 %23
store i8 %20, i8* %24
br label %25
25: ; preds = %18
%26 = load i32, i32* %2
%27 = udiv i32 %26, 16
store i32 %27, i32* %2
%28 = icmp ne i32 %27, 0
br i1 %28, label %5, label %29
29: ; preds = %25
store i32 0, i32* %3
br label %30
30: ; preds = %39, %29
%31 = load i32, i32* %3
%32 = icmp ult i32 %31, 10
br i1 %32, label %33, label %42
33: ; preds = %30
%34 = load i32, i32* %3
%35 = zext i32 %34 to i64
%36 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext %37)
br label %39
39: ; preds = %33
%40 = load i32, i32* %3
%41 = add i32 %40, 1
store i32 %41, i32* %3
br label %30
42: ; preds = %30
%43 = load i32, i32* %1
ret i32 %43
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 98)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 100)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext -45)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext undef)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext undef)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext undef)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext undef)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext undef)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext undef)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext undef)
ret i32 0
}