#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 EOF;
int /*<<< orphan*/ exit(int);
int getchar();
int /*<<< orphan*/ printf(char *, int, unsigned char);
void readInputNumber(char *inputNumber) {
  unsigned char i;
  int c = getchar();
  for (i = 0; i < 66 && c != EOF && c != '\0' && c != '\n' && c != '\r'; i++) {
    if (c < '0' || c > '9') {
      printf("\nInvalid input \"%c\" at digit %d\n", c, i + 1);
      exit(9);
    }
    inputNumber[i] = c;
    c = getchar();
  }
  inputNumber[i] = '\0';
}


x86 assembly (clang, -O0):
<readInputNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x10(%rbp)
movb   $0x0,-0x9(%rbp)
movzbl -0x9(%rbp),%ecx
xor    %eax,%eax
cmp    $0x42,%ecx
mov    %al,-0x11(%rbp)
jge    119b <readInputNumber+0x6b>
mov    -0x10(%rbp),%ecx
xor    %eax,%eax
mov    0x2e80(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x11(%rbp)
je     119b <readInputNumber+0x6b>
xor    %eax,%eax
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     119b <readInputNumber+0x6b>
xor    %eax,%eax
cmpl   $0xa,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     119b <readInputNumber+0x6b>
cmpl   $0xd,-0x10(%rbp)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    11ab <readInputNumber+0x7b>
jmp    1209 <readInputNumber+0xd9>
cmpl   $0x30,-0x10(%rbp)
jl     11bf <readInputNumber+0x8f>
cmpl   $0x39,-0x10(%rbp)
jle    11e2 <readInputNumber+0xb2>
mov    -0x10(%rbp),%esi
movzbl -0x9(%rbp),%eax
add    $0x1,%eax
lea    0xe30(%rip),%rdi
movzbl %al,%edx
call   1030 <printf@plt>
mov    $0x9,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
movzbl -0x9(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x10(%rbp)
mov    -0x9(%rbp),%al
add    $0x1,%al
mov    %al,-0x9(%rbp)
jmp    114a <readInputNumber+0x1a>
mov    -0x8(%rbp),%rax
movzbl -0x9(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readInputNumber>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r15
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2e9d(%rip),%r14
cmp    (%r14),%eax
je     1195 <readInputNumber+0x65>
mov    $0x2401,%r12d
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
cmp    $0xd,%eax
ja     116b <readInputNumber+0x3b>
bt     %eax,%r12d
jb     1192 <readInputNumber+0x62>
lea    -0x3a(%rax),%ecx
cmp    $0xfffffff5,%ecx
jbe    11a7 <readInputNumber+0x77>
mov    %al,(%r15,%rbx,1)
xor    %eax,%eax
call   1040 <getchar@plt>
lea    0x1(%rbx),%rbp
cmp    $0x40,%rbx
ja     1195 <readInputNumber+0x65>
mov    %rbp,%rbx
cmp    (%r14),%eax
jne    1160 <readInputNumber+0x30>
jmp    1195 <readInputNumber+0x65>
mov    %rbx,%rbp
movzbl %bpl,%eax
movb   $0x0,(%r15,%rax,1)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
add    $0x1,%ebx
movzbl %bl,%edx
lea    0xe4c(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x9,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [33 x i8] c"\0AInvalid input \22%c\22 at digit %d\0A\00"
define void @readInputNumber(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i32 (...) @getchar()
store i32 %5, i32* %4
store i8 0, i8* %3
br label %6
6: ; preds = %47, %1
%7 = load i8, i8* %3
%8 = zext i8 %7 to i32
%9 = icmp slt i32 %8, 66
br i1 %9, label %10, label %23
10: ; preds = %6
%11 = load i32, i32* %4
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %23
14: ; preds = %10
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 10
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 13
br label %23
23: ; preds = %20, %17, %14, %10, %6
%24 = phi i1 [ false, %17 ], [ false, %14 ], [ false, %10 ], [ false, %6 ], [ %22, %20 ]
br i1 %24, label %25, label %50
25: ; preds = %23
%26 = load i32, i32* %4
%27 = icmp slt i32 %26, 48
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = load i32, i32* %4
%30 = icmp sgt i32 %29, 57
br i1 %30, label %31, label %39
31: ; preds = %28, %25
%32 = load i32, i32* %4
%33 = load i8, i8* %3
%34 = zext i8 %33 to i32
%35 = add nsw i32 %34, 1
%36 = trunc i32 %35 to i8
%37 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %32, i8 zeroext %36)
%38 = call i32 @exit(i32 9)
unreachable
39: ; preds = %28
%40 = load i32, i32* %4
%41 = trunc i32 %40 to i8
%42 = load i8*, i8** %2
%43 = load i8, i8* %3
%44 = zext i8 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
store i8 %41, i8* %45
%46 = call i32 (...) @getchar()
store i32 %46, i32* %4
br label %47
47: ; preds = %39
%48 = load i8, i8* %3
%49 = add i8 %48, 1
store i8 %49, i8* %3
br label %6
50: ; preds = %23
%51 = load i8*, i8** %2
%52 = load i8, i8* %3
%53 = zext i8 %52 to i64
%54 = getelementptr inbounds i8, i8* %51, i64 %53
store i8 0, i8* %54
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [33 x i8] c"\0AInvalid input \22%c\22 at digit %d\0A\00"
define void @readInputNumber(i8* nocapture writeonly %0) {
%2 = tail call i32 (...) @getchar()
%3 = load i32, i32* @EOF
%4 = freeze i32 %3
%5 = icmp eq i32 %2, %4
br i1 %5, label %27, label %6
6: ; preds = %1, %17
%7 = phi i64 [ %21, %17 ], [ 0, %1 ]
%8 = phi i32 [ %20, %17 ], [ %2, %1 ]
switch i32 %8, label %9 [
i32 13, label %27
i32 10, label %27
i32 0, label %27
]
9: ; preds = %6
%10 = add i32 %8, -58
%11 = icmp ult i32 %10, -10
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = trunc i64 %7 to i8
%14 = add nuw nsw i8 %13, 1
%15 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %8, i8 zeroext %14)
%16 = tail call i32 @exit(i32 9)
unreachable
17: ; preds = %9
%18 = trunc i32 %8 to i8
%19 = getelementptr inbounds i8, i8* %0, i64 %7
store i8 %18, i8* %19
%20 = tail call i32 (...) @getchar()
%21 = add nuw nsw i64 %7, 1
%22 = icmp ugt i64 %7, 64
%23 = load i32, i32* @EOF
%24 = freeze i32 %23
%25 = icmp eq i32 %20, %24
%26 = or i1 %22, %25
br i1 %26, label %27, label %6
27: ; preds = %17, %6, %6, %6, %1
%28 = phi i64 [ 0, %1 ], [ %7, %6 ], [ %7, %6 ], [ %7, %6 ], [ %21, %17 ]
%29 = and i64 %28, 255
%30 = getelementptr inbounds i8, i8* %0, i64 %29
store i8 0, i8* %30
ret void
}