#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 scalar_t__ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ cli_putc(char);
int /*<<< orphan*/ cli_putstr(char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ ultoa(unsigned long, char *, int);
void print_aligned(unsigned long value, uint8_t align) {
  char str[10];
  uint8_t i;
  ultoa(value, str, 16);
  for (i = strlen(str); i < align; ++i)
    cli_putc(' ');
  cli_putstr(str);
}


x86 assembly (clang, -O0):
<print_aligned>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x1a(%rbp),%rsi
mov    $0x10,%edx
call   1060 <ultoa@plt>
lea    -0x1a(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1198 <print_aligned+0x58>
mov    $0x20,%edi
call   1030 <cli_putc@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    116f <print_aligned+0x2f>
lea    -0x1a(%rbp),%rdi
call   1040 <cli_putstr@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_aligned>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
lea    0xe(%rsp),%r14
mov    %r14,%rsi
mov    $0x10,%edx
call   1060 <ultoa@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
cmp    %rbx,%rax
jge    1180 <print_aligned+0x40>
sub    %rax,%rbx
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <cli_putc@plt>
add    $0xffffffffffffffff,%rbx
jne    1170 <print_aligned+0x30>
lea    0xe(%rsp),%rdi
call   1040 <cli_putstr@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @print_aligned(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca [10 x i8]
%6 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%7 = load i64, i64* %3
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%9 = call i32 @ultoa(i64 %7, i8* %8, i32 16)
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%11 = call i64 @strlen(i8* %10)
store i64 %11, i64* %6
br label %12
12: ; preds = %18, %2
%13 = load i64, i64* %6
%14 = load i64, i64* %4
%15 = icmp slt i64 %13, %14
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = call i32 @cli_putc(i8 signext 32)
br label %18
18: ; preds = %16
%19 = load i64, i64* %6
%20 = add nsw i64 %19, 1
store i64 %20, i64* %6
br label %12
21: ; preds = %12
%22 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%23 = call i32 @cli_putstr(i8* %22)
ret void
}

LLVM IR (-O2):
define void @print_aligned(i64 %0, i64 %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = call i32 @ultoa(i64 %0, i8* %4, i32 16)
%6 = call i64 @strlen(i8* %4)
%7 = icmp slt i64 %6, %1
br i1 %7, label %8, label %13
8: ; preds = %2, %8
%9 = phi i64 [ %11, %8 ], [ %6, %2 ]
%10 = call i32 @cli_putc(i8 signext 32)
%11 = add i64 %9, 1
%12 = icmp eq i64 %11, %1
br i1 %12, label %13, label %8
13: ; preds = %8, %2
%14 = call i32 @cli_putstr(i8* %4)
ret void
}