#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*/ fputc(char, unsigned int);
int /*<<< orphan*/ report(char);
void fprint_udecimal(unsigned udecimal, unsigned handle) {
  char digits[10];
  unsigned digitval;
  unsigned i;
  digitval = 1000000000;
  i = 0;
  while (digitval) {
    digits[i] = ((udecimal / digitval) & 0xf) | '0';
    report(digits[i]);
    udecimal %= digitval;
    digitval /= 10;
    i++;
  }
  for (i = 0; i < 10; i++)
    fputc(digits[i], handle);
}


x86 assembly (clang, -O0):
<fprint_udecimal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x3b9aca00,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1194 <fprint_udecimal+0x74>
mov    -0x4(%rbp),%eax
xor    %edx,%edx
divl   -0x18(%rbp)
and    $0xf,%eax
or     $0x30,%eax
mov    %al,%cl
mov    -0x1c(%rbp),%eax
mov    %cl,-0x12(%rbp,%rax,1)
mov    -0x1c(%rbp),%eax
movsbl -0x12(%rbp,%rax,1),%edi
call   1040 <report@plt>
mov    -0x18(%rbp),%ecx
mov    -0x4(%rbp),%eax
xor    %edx,%edx
div    %ecx
mov    %edx,-0x4(%rbp)
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113c <fprint_udecimal+0x1c>
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
jae    11c5 <fprint_udecimal+0xa5>
mov    -0x1c(%rbp),%eax
mov    -0x12(%rbp,%rax,1),%al
mov    -0x8(%rbp),%esi
movsbl %al,%edi
call   1030 <fputc@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    119b <fprint_udecimal+0x7b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprint_udecimal>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %esi,%r14d
mov    %edi,%r15d
mov    $0x3b9aca00,%ebx
xor    %ebp,%ebp
mov    $0xcccccccd,%r12d
nop
mov    %r15d,%eax
xor    %edx,%edx
div    %ebx
and    $0xf,%al
or     $0x30,%al
mov    %al,0x6(%rsp,%rbp,1)
movzbl %al,%edi
mov    %edx,%r15d
call   1040 <report@plt>
mov    %ebx,%ebx
imul   %r12,%rbx
shr    $0x23,%rbx
add    $0x1,%rbp
cmp    $0xa,%rbp
jne    1140 <fprint_udecimal+0x20>
movsbl 0x6(%rsp),%edi
mov    %r14d,%esi
call   1030 <fputc@plt>
movsbl 0x7(%rsp),%edi
mov    %r14d,%esi
call   1030 <fputc@plt>
movsbl 0x8(%rsp),%edi
mov    %r14d,%esi
call   1030 <fputc@plt>
movsbl 0x9(%rsp),%edi
mov    %r14d,%esi
call   1030 <fputc@plt>
movsbl 0xa(%rsp),%edi
mov    %r14d,%esi
call   1030 <fputc@plt>
movsbl 0xb(%rsp),%edi
mov    %r14d,%esi
call   1030 <fputc@plt>
movsbl 0xc(%rsp),%edi
mov    %r14d,%esi
call   1030 <fputc@plt>
movsbl 0xd(%rsp),%edi
mov    %r14d,%esi
call   1030 <fputc@plt>
movsbl 0xe(%rsp),%edi
mov    %r14d,%esi
call   1030 <fputc@plt>
movsbl 0xf(%rsp),%edi
mov    %r14d,%esi
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
define void @fprint_udecimal(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [10 x i8]
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 1000000000, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %11, %2
%9 = load i32, i32* %6
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %33
11: ; preds = %8
%12 = load i32, i32* %3
%13 = load i32, i32* %6
%14 = udiv i32 %12, %13
%15 = and i32 %14, 15
%16 = or i32 %15, 48
%17 = trunc i32 %16 to i8
%18 = load i32, i32* %7
%19 = zext i32 %18 to i64
%20 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 %19
store i8 %17, i8* %20
%21 = load i32, i32* %7
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = call i32 @report(i8 signext %24)
%26 = load i32, i32* %6
%27 = load i32, i32* %3
%28 = urem i32 %27, %26
store i32 %28, i32* %3
%29 = load i32, i32* %6
%30 = udiv i32 %29, 10
store i32 %30, i32* %6
%31 = load i32, i32* %7
%32 = add i32 %31, 1
store i32 %32, i32* %7
br label %8
33: ; preds = %8
store i32 0, i32* %7
br label %34
34: ; preds = %44, %33
%35 = load i32, i32* %7
%36 = icmp ult i32 %35, 10
br i1 %36, label %37, label %47
37: ; preds = %34
%38 = load i32, i32* %7
%39 = zext i32 %38 to i64
%40 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = load i32, i32* %4
%43 = call i32 @fputc(i8 signext %41, i32 %42)
br label %44
44: ; preds = %37
%45 = load i32, i32* %7
%46 = add i32 %45, 1
store i32 %46, i32* %7
br label %34
47: ; preds = %34
ret void
}

LLVM IR (-O2):
define void @fprint_udecimal(i32 %0, i32 %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
br label %5
5: ; preds = %2, %5
%6 = phi i64 [ 0, %2 ], [ %17, %5 ]
%7 = phi i32 [ 1000000000, %2 ], [ %16, %5 ]
%8 = phi i32 [ %0, %2 ], [ %15, %5 ]
%9 = udiv i32 %8, %7
%10 = trunc i32 %9 to i8
%11 = and i8 %10, 15
%12 = or i8 %11, 48
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %6
store i8 %12, i8* %13
%14 = tail call i32 @report(i8 signext %12)
%15 = urem i32 %8, %7
%16 = udiv i32 %7, 10
%17 = add nuw nsw i64 %6, 1
%18 = icmp eq i64 %17, 10
br i1 %18, label %19, label %5
19: ; preds = %5
%20 = load i8, i8* %4
%21 = tail call i32 @fputc(i8 signext %20, i32 %1)
%22 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 1
%23 = load i8, i8* %22
%24 = tail call i32 @fputc(i8 signext %23, i32 %1)
%25 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 2
%26 = load i8, i8* %25
%27 = tail call i32 @fputc(i8 signext %26, i32 %1)
%28 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 3
%29 = load i8, i8* %28
%30 = tail call i32 @fputc(i8 signext %29, i32 %1)
%31 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 4
%32 = load i8, i8* %31
%33 = tail call i32 @fputc(i8 signext %32, i32 %1)
%34 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 5
%35 = load i8, i8* %34
%36 = tail call i32 @fputc(i8 signext %35, i32 %1)
%37 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 6
%38 = load i8, i8* %37
%39 = tail call i32 @fputc(i8 signext %38, i32 %1)
%40 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 7
%41 = load i8, i8* %40
%42 = tail call i32 @fputc(i8 signext %41, i32 %1)
%43 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 8
%44 = load i8, i8* %43
%45 = tail call i32 @fputc(i8 signext %44, i32 %1)
%46 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 9
%47 = load i8, i8* %46
%48 = tail call i32 @fputc(i8 signext %47, i32 %1)
ret void
}