#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();
int /*<<< orphan*/ lexAnalysis(char *, int);
int /*<<< orphan*/ printf(char *);
int main() {
  char str[100], ch;
  int i = 0;
  printf("Enter string: ");
  while (ch != '\n') {
    ch = getchar();
    str[i] = ch;
    i++;
  }
  lexAnalysis(str, i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x78(%rbp)
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x71(%rbp),%eax
cmp    $0xa,%eax
je     1185 <main+0x55>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x71(%rbp)
mov    -0x71(%rbp),%cl
movslq -0x78(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    1155 <main+0x25>
lea    -0x70(%rbp),%rdi
mov    -0x78(%rbp),%esi
call   1050 <lexAnalysis@plt>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1150 <main+0x20>
mov    %rsp,%rdi
mov    %ebx,%esi
call   1050 <lexAnalysis@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter string: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i8
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %10, %0
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 10
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = call signext i8 (...) @getchar()
store i8 %11, i8* %3
%12 = load i8, i8* %3
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %14
store i8 %12, i8* %15
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
br label %6
18: ; preds = %6
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%20 = load i32, i32* %4
%21 = call i32 @lexAnalysis(i8* %19, i32 %20)
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str = [15 x i8] c"Enter string: \00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %0, %4
%5 = phi i64 [ 0, %0 ], [ %8, %4 ]
%6 = tail call signext i8 (...) @getchar()
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %5
store i8 %6, i8* %7
%8 = add nuw i64 %5, 1
%9 = icmp eq i8 %6, 10
br i1 %9, label %10, label %4
10: ; preds = %4
%11 = trunc i64 %8 to i32
%12 = call i32 @lexAnalysis(i8* %2, i32 %11)
ret i32 0
}