#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 */
char *calloc(int, int);
int /*<<< orphan*/ free(char *);
int parse_raw_input(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
int get_input(void) {
  char c;
  char *input = calloc(100, sizeof(char));
  int j = 0;
  scanf("%c", &c);
  while (c != '\n' && j < 100) {
    input[j++] = c;
    scanf("%c", &c);
  }
  if (j >= 100) {
    while (c != '\n')
      scanf("%c", &c);
    puts("Error: Input length exceeds 100 characters.");
    free(input);
    return 1;
  }
  int return_val = parse_raw_input(input);
  free(input);
  return return_val;
}


x86 assembly (clang, -O0):
<get_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x64,%edi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xe87(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1060 <scanf@plt>
movsbl -0x5(%rbp),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x19(%rbp)
je     119e <get_input+0x4e>
cmpl   $0x64,-0x14(%rbp)
setl   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11ae <get_input+0x5e>
jmp    11db <get_input+0x8b>
mov    -0x5(%rbp),%dl
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x14(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
lea    0xe33(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1060 <scanf@plt>
jmp    1182 <get_input+0x32>
cmpl   $0x64,-0x14(%rbp)
jl     122d <get_input+0xdd>
jmp    11ea <get_input+0x9a>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     120c <get_input+0xbc>
lea    0xe02(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1060 <scanf@plt>
jmp    11ea <get_input+0x9a>
lea    0xdf0(%rip),%rdi
call   1040 <puts@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    1248 <get_input+0xf8>
mov    -0x10(%rbp),%rdi
call   1070 <parse_raw_input@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_input>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    $0x64,%edi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,%r12
lea    0xe8b(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xf(%rsp),%al
cmp    $0xa,%al
je     1205 <get_input+0xb5>
xor    %ebp,%ebp
lea    0xe70(%rip),%r14
lea    0xf(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x1(%rbp),%rbx
mov    %al,(%r12,%rbp,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
movzbl 0xf(%rsp),%eax
cmp    $0xa,%al
je     11c5 <get_input+0x75>
cmp    $0x63,%rbp
mov    %rbx,%rbp
jb     11a0 <get_input+0x50>
cmp    $0x64,%ebx
jb     1205 <get_input+0xb5>
cmp    $0xa,%al
je     11f2 <get_input+0xa2>
lea    0xe2b(%rip),%r14
lea    0xf(%rsp),%rbp
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
cmpb   $0xa,0xf(%rsp)
jne    11e0 <get_input+0x90>
lea    0xe0a(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%ebp
jmp    120f <get_input+0xbf>
mov    %r12,%rdi
call   1070 <parse_raw_input@plt>
mov    %eax,%ebp
mov    %r12,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [44 x i8] c"Error: Input length exceeds 100 characters.\00"
define i32 @get_input() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = call i8* @calloc(i32 100, i32 1)
store i8* %6, i8** %3
store i32 0, i32* %4
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %8
8: ; preds = %17, %0
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 10
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 100
br label %15
15: ; preds = %12, %8
%16 = phi i1 [ false, %8 ], [ %14, %12 ]
br i1 %16, label %17, label %25
17: ; preds = %15
%18 = load i8, i8* %2
%19 = load i8*, i8** %3
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
%22 = sext i32 %20 to i64
%23 = getelementptr inbounds i8, i8* %19, i64 %22
store i8 %18, i8* %23
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %8
25: ; preds = %15
%26 = load i32, i32* %4
%27 = icmp sge i32 %26, 100
br i1 %27, label %28, label %39
28: ; preds = %25
br label %29
29: ; preds = %33, %28
%30 = load i8, i8* %2
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 10
br i1 %32, label %33, label %35
33: ; preds = %29
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %29
35: ; preds = %29
%36 = call i32 @puts(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%37 = load i8*, i8** %3
%38 = call i32 @free(i8* %37)
store i32 1, i32* %1
br label %45
39: ; preds = %25
%40 = load i8*, i8** %3
%41 = call i32 @parse_raw_input(i8* %40)
store i32 %41, i32* %5
%42 = load i8*, i8** %3
%43 = call i32 @free(i8* %42)
%44 = load i32, i32* %5
store i32 %44, i32* %1
br label %45
45: ; preds = %39, %35
%46 = load i32, i32* %1
ret i32 %46
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.1 = [44 x i8] c"Error: Input length exceeds 100 characters.\00"
define i32 @get_input() {
%1 = alloca i8
%2 = tail call dereferenceable_or_null(100) i8* @calloc(i32 100, i32 1)
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 10
br i1 %5, label %27, label %6
6: ; preds = %0, %6
%7 = phi i64 [ %9, %6 ], [ 0, %0 ]
%8 = phi i8 [ %12, %6 ], [ %4, %0 ]
%9 = add nuw nsw i64 %7, 1
%10 = getelementptr inbounds i8, i8* %2, i64 %7
store i8 %8, i8* %10
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%12 = load i8, i8* %1
%13 = icmp ne i8 %12, 10
%14 = icmp ult i64 %7, 99
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %6, label %16
16: ; preds = %6
%17 = trunc i64 %9 to i32
%18 = icmp ugt i32 %17, 99
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = icmp eq i8 %12, 10
br i1 %20, label %25, label %21
21: ; preds = %19, %21
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%23 = load i8, i8* %1
%24 = icmp eq i8 %23, 10
br i1 %24, label %25, label %21
25: ; preds = %21, %19
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
br label %29
27: ; preds = %0, %16
%28 = call i32 @parse_raw_input(i8* %2)
br label %29
29: ; preds = %27, %25
%30 = phi i32 [ 1, %25 ], [ %28, %27 ]
%31 = call i32 @free(i8* %2)
ret i32 %30
}