#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 getchar();
scalar_t__ isspace(char);
int /*<<< orphan*/ neglect_input();
int /*<<< orphan*/ puts(char *);
int get_s(char *s) {
  int i = 0;
  do {
    while ((s[i] = getchar()) != '\n') {
      if (isspace(s[i]))
        continue;
      if (i == 100) {
        puts("Expression too long\ntype \"help\" to get help");
        neglect_input();
        return 1;
      }
      i++;
    }
    s[i] = '\0';
  } while (s[0] == '\0');
  return 0;
}


x86 assembly (clang, -O0):
<get_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
jmp    1158 <get_s+0x18>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
mov    %al,(%rcx,%rdx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     11cd <get_s+0x8d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     1196 <get_s+0x56>
jmp    1158 <get_s+0x18>
cmpl   $0x64,-0x14(%rbp)
jne    11bf <get_s+0x7f>
lea    0xe59(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1060 <neglect_input@plt>
movl   $0x1,-0x4(%rbp)
jmp    11f0 <get_s+0xb0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1158 <get_s+0x18>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1153 <get_s+0x13>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_s>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
jmp    115b <get_s+0x1b>
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%r14,%rbx,1)
cmpb   $0x0,(%r14)
jne    1188 <get_s+0x48>
movslq %ebx,%rbx
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,(%r14,%rbx,1)
cmp    $0xa,%al
je     1150 <get_s+0x10>
movsbl %al,%edi
call   1040 <isspace@plt>
test   %rax,%rax
jne    1160 <get_s+0x20>
cmp    $0x64,%rbx
je     118c <get_s+0x4c>
add    $0x1,%rbx
jmp    1160 <get_s+0x20>
xor    %eax,%eax
jmp    11a4 <get_s+0x64>
lea    0xe6d(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <neglect_input@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [44 x i8] c"Expression too long\0Atype \22help\22 to get help\00"
define i32 @get_s(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %37, %1
br label %6
6: ; preds = %29, %22, %5
%7 = call signext i8 (...) @getchar()
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
store i8 %7, i8* %11
%12 = sext i8 %7 to i32
%13 = icmp ne i32 %12, 10
br i1 %13, label %14, label %32
14: ; preds = %6
%15 = load i8*, i8** %3
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = call i64 @isspace(i8 signext %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %14
br label %6
23: ; preds = %14
%24 = load i32, i32* %4
%25 = icmp eq i32 %24, 100
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = call i32 @puts(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%28 = call i32 (...) @neglect_input()
store i32 1, i32* %2
br label %44
29: ; preds = %23
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %6
32: ; preds = %6
%33 = load i8*, i8** %3
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
store i8 0, i8* %36
br label %37
37: ; preds = %32
%38 = load i8*, i8** %3
%39 = getelementptr inbounds i8, i8* %38, i64 0
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 0
br i1 %42, label %5, label %43
43: ; preds = %37
store i32 0, i32* %2
br label %44
44: ; preds = %43, %26
%45 = load i32, i32* %2
ret i32 %45
}

LLVM IR (-O2):
@.str = [44 x i8] c"Expression too long\0Atype \22help\22 to get help\00"
define i32 @get_s(i8* nocapture %0) {
br label %2
2: ; preds = %22, %1
%3 = phi i64 [ 0, %1 ], [ %7, %22 ]
%4 = shl i64 %3, 32
%5 = ashr exact i64 %4, 32
br label %6
6: ; preds = %20, %2
%7 = phi i64 [ %21, %20 ], [ %5, %2 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
br label %9
9: ; preds = %6, %12
%10 = tail call signext i8 (...) @getchar()
store i8 %10, i8* %8
%11 = icmp eq i8 %10, 10
br i1 %11, label %22, label %12
12: ; preds = %9
%13 = tail call i64 @isspace(i8 signext %10)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %9
15: ; preds = %12
%16 = icmp eq i64 %7, 100
br i1 %16, label %17, label %20
17: ; preds = %15
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%19 = tail call i32 (...) @neglect_input()
br label %25
20: ; preds = %15
%21 = add nsw i64 %7, 1
br label %6
22: ; preds = %9
store i8 0, i8* %8
%23 = load i8, i8* %0
%24 = icmp eq i8 %23, 0
br i1 %24, label %2, label %25
25: ; preds = %22, %17
%26 = phi i32 [ 1, %17 ], [ 0, %22 ]
ret i32 %26
}