#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 *, ...);
void print_num_and_fill_chars(int data, int size, char fill) {
  int count = 0;
  printf("%d", data);
  while (data >= 10) {
    data /= 10;
    count++;
  }
  count++;
  while (count < size) {
    printf(" ");
    count++;
  }
}


x86 assembly (clang, -O0):
<print_num_and_fill_chars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0xa,-0x4(%rbp)
jl     1161 <print_num_and_fill_chars+0x51>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113b <print_num_and_fill_chars+0x2b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1192 <print_num_and_fill_chars+0x82>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116a <print_num_and_fill_chars+0x5a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_num_and_fill_chars>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xed2(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%eax
cmp    $0xa,%ebp
jl     1164 <print_num_and_fill_chars+0x44>
mov    $0x1,%eax
mov    $0xcccccccd,%ecx
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
add    $0x1,%eax
cmp    $0x63,%ebp
mov    %edx,%ebp
ja     1150 <print_num_and_fill_chars+0x30>
cmp    %ebx,%eax
jge    117f <print_num_and_fill_chars+0x5f>
sub    %eax,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1170 <print_num_and_fill_chars+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c" \00"
define void @print_num_and_fill_chars(i32 %0, i32 %1, i8 signext %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8 %2, i8* %6
store i32 0, i32* %7
%8 = load i32, i32* %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %13, %3
%11 = load i32, i32* %4
%12 = icmp sge i32 %11, 10
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load i32, i32* %4
%15 = sdiv i32 %14, 10
store i32 %15, i32* %4
%16 = load i32, i32* %7
%17 = add nsw i32 %16, 1
store i32 %17, i32* %7
br label %10
18: ; preds = %10
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
store i32 %20, i32* %7
br label %21
21: ; preds = %25, %18
%22 = load i32, i32* %7
%23 = load i32, i32* %5
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %21
29: ; preds = %21
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @print_num_and_fill_chars(i32 %0, i32 %1, i8 signext %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = icmp sgt i32 %0, 9
br i1 %5, label %9, label %6
6: ; preds = %9, %3
%7 = phi i32 [ 1, %3 ], [ %13, %9 ]
%8 = icmp slt i32 %7, %1
br i1 %8, label %15, label %20
9: ; preds = %3, %9
%10 = phi i32 [ %13, %9 ], [ 1, %3 ]
%11 = phi i32 [ %12, %9 ], [ %0, %3 ]
%12 = udiv i32 %11, 10
%13 = add i32 %10, 1
%14 = icmp ugt i32 %11, 99
br i1 %14, label %9, label %6
15: ; preds = %6, %15
%16 = phi i32 [ %18, %15 ], [ %7, %6 ]
%17 = tail call i32 @putchar(i32 32)
%18 = add i32 %16, 1
%19 = icmp eq i32 %18, %1
br i1 %19, label %20, label %15
20: ; preds = %15, %6
ret void
}