#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 printlong(char num[]) {
  int i = 0;
  while (!num[i] && i != 110)
    i++;
  while (i < 111)
    printf("%d", num[i++]);
  printf("\n");
}


x86 assembly (clang, -O0):
<printlong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
xor    %eax,%eax
cmpb   $0x0,(%rcx,%rdx,1)
mov    %al,-0xd(%rbp)
jne    1144 <printlong+0x34>
cmpl   $0x6e,-0xc(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1154 <printlong+0x44>
jmp    1162 <printlong+0x52>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <printlong+0x13>
jmp    1167 <printlong+0x57>
cmpl   $0x6f,-0xc(%rbp)
jge    119a <printlong+0x8a>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1167 <printlong+0x57>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printlong>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movsbl (%r15,%rax,1),%esi
lea    0x1(%rax),%rbx
test   %esi,%esi
jne    1146 <printlong+0x26>
cmp    $0x6e,%rax
mov    %rbx,%rax
jne    1130 <printlong+0x10>
lea    -0x1(%rbx),%eax
cmp    $0x6e,%eax
ja     1189 <printlong+0x69>
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x6f,%rbx
je     1189 <printlong+0x69>
lea    0xe97(%rip),%r14
nopl   0x0(%rax)
movsbl (%r15,%rbx,1),%esi
add    $0x1,%rbx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x6f,%rbx
jne    1170 <printlong+0x50>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @printlong(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %9, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = icmp ne i64 %3, 110
%8 = select i1 %6, i1 %7, i1 false
%9 = add nuw nsw i64 %3, 1
br i1 %8, label %2, label %10
10: ; preds = %2
%11 = trunc i64 %3 to i32
%12 = icmp ult i32 %11, 111
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = add nuw nsw i64 %3, 1
%15 = sext i8 %5 to i32
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = icmp eq i64 %14, 111
br i1 %17, label %26, label %18
18: ; preds = %13, %18
%19 = phi i64 [ %22, %18 ], [ %14, %13 ]
%20 = getelementptr inbounds i8, i8* %0, i64 %19
%21 = load i8, i8* %20
%22 = add nuw nsw i64 %19, 1
%23 = sext i8 %21 to i32
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = icmp eq i64 %22, 111
br i1 %25, label %26, label %18
26: ; preds = %18, %13, %10
%27 = tail call i32 @putchar(i32 10)
ret void
}