#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*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void supcon_putui(unsigned int num) {
  char buffer[128];
  int position = 126;
  unsigned int temp = num;
  if (num == 0) {
    fputs("0", stdout);
    return;
  }
  buffer[127] = 0;
  while (temp > 0) {
    buffer[position--] = '0' + (temp % 10);
    temp = temp / 10;
  }
  fputs(buffer + position + 1, stdout);
}


x86 assembly (clang, -O0):
<supcon_putui>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x7e,-0x94(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x98(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1155 <supcon_putui+0x45>
mov    0x2e9e(%rip),%rax
mov    (%rax),%esi
lea    0xeb5(%rip),%rdi
call   1030 <fputs@plt>
jmp    11d1 <supcon_putui+0xc1>
movb   $0x0,-0x11(%rbp)
cmpl   $0x0,-0x98(%rbp)
jbe    11ae <supcon_putui+0x9e>
mov    -0x98(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x94(%rbp),%eax
mov    %eax,%edx
add    $0xffffffff,%edx
mov    %edx,-0x94(%rbp)
cltq
mov    %cl,-0x90(%rbp,%rax,1)
mov    -0x98(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x98(%rbp)
jmp    1159 <supcon_putui+0x49>
lea    -0x90(%rbp),%rdi
movslq -0x94(%rbp),%rax
add    %rax,%rdi
add    $0x1,%rdi
mov    0x2e16(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<supcon_putui>:
sub    $0x88,%rsp
test   %edi,%edi
je     118d <supcon_putui+0x7d>
movb   $0x0,0x7f(%rsp)
lea    0x7e(%rsp),%rcx
movabs $0x7e00000000,%rax
mov    $0xcccccccd,%r8d
movabs $0xffffffff00000000,%r9
ff ff ff
nop
add    %r9,%rax
mov    %edi,%edx
imul   %r8,%rdx
shr    $0x23,%rdx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%r10d
mov    %edi,%esi
sub    %r10d,%esi
or     $0x30,%sil
mov    %sil,(%rcx)
add    $0xffffffffffffffff,%rcx
cmp    $0x9,%edi
mov    %edx,%edi
ja     1140 <supcon_putui+0x30>
sar    $0x20,%rax
lea    (%rsp,%rax,1),%rdi
add    $0x1,%rdi
mov    0x2e62(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
add    $0x88,%rsp
ret
mov    0x2e4c(%rip),%rax
mov    (%rax),%esi
lea    0xe63(%rip),%rdi
add    $0x88,%rsp
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
@stdout = global i32 0
define void @supcon_putui(i32 %0) {
%2 = alloca i32
%3 = alloca [128 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
store i32 126, i32* %4
%6 = load i32, i32* %2
store i32 %6, i32* %5
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* @stdout
%11 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %36
12: ; preds = %1
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 127
store i8 0, i8* %13
br label %14
14: ; preds = %17, %12
%15 = load i32, i32* %5
%16 = icmp ugt i32 %15, 0
br i1 %16, label %17, label %28
17: ; preds = %14
%18 = load i32, i32* %5
%19 = urem i32 %18, 10
%20 = add i32 48, %19
%21 = trunc i32 %20 to i8
%22 = load i32, i32* %4
%23 = add nsw i32 %22, -1
store i32 %23, i32* %4
%24 = sext i32 %22 to i64
%25 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %24
store i8 %21, i8* %25
%26 = load i32, i32* %5
%27 = udiv i32 %26, 10
store i32 %27, i32* %5
br label %14
28: ; preds = %14
%29 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = getelementptr inbounds i8, i8* %32, i64 1
%34 = load i32, i32* @stdout
%35 = call i32 @fputs(i8* %33, i32 %34)
br label %36
36: ; preds = %28, %9
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
@stdout = global i32 0
define void @supcon_putui(i32 %0) {
%2 = alloca [128 x i8]
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%4 = icmp eq i32 %0, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* @stdout
%7 = tail call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %27
8: ; preds = %1
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 127
store i8 0, i8* %9
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 126, %8 ], [ %16, %10 ]
%12 = phi i32 [ %0, %8 ], [ %18, %10 ]
%13 = urem i32 %12, 10
%14 = trunc i32 %13 to i8
%15 = or i8 %14, 48
%16 = add i64 %11, -1
%17 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 %11
store i8 %15, i8* %17
%18 = udiv i32 %12, 10
%19 = icmp ult i32 %12, 10
br i1 %19, label %20, label %10
20: ; preds = %10
%21 = shl i64 %16, 32
%22 = ashr exact i64 %21, 32
%23 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 %22
%24 = getelementptr inbounds i8, i8* %23, i64 1
%25 = load i32, i32* @stdout
%26 = call i32 @fputs(i8* %24, i32 %25)
br label %27
27: ; preds = %20, %5
ret void
}