#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ tokenizeGivenStream(char *);
void getUserInput(void) {
  char givenCommand[1024] = {'\0'};
  printf("\nnsh6> ");
  fgets(givenCommand, 1024, stdin);
  if (strcmp(givenCommand, "\n") == 0) {
    return;
  }
  tokenizeGivenStream(givenCommand);
}


x86 assembly (clang, -O0):
<getUserInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
lea    -0x400(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
lea    -0x400(%rbp),%rdi
mov    0x2e60(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1050 <fgets@plt>
lea    -0x400(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11b6 <getUserInput+0x66>
jmp    11c2 <getUserInput+0x72>
lea    -0x400(%rbp),%rdi
call   1070 <tokenizeGivenStream@plt>
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getUserInput>:
push   %rbx
sub    $0x400,%rsp
mov    %rsp,%rbx
mov    $0x400,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1050 <fgets@plt>
lea    0xe75(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11a8 <getUserInput+0x58>
mov    %rsp,%rdi
call   1070 <tokenizeGivenStream@plt>
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"\0Ansh6> \00"
@stdin = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
define void @getUserInput() {
%1 = alloca [1024 x i8]
%2 = bitcast [1024 x i8]* %1 to i8*
%3 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 1024, i32 %5)
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %0
br label %14
11: ; preds = %0
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%13 = call i32 @tokenizeGivenStream(i8* %12)
br label %14
14: ; preds = %11, %10
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"\0Ansh6> \00"
@stdin = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
define void @getUserInput() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %2, i32 1024, i32 %4)
%6 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %0
%9 = call i32 @tokenizeGivenStream(i8* %2)
br label %10
10: ; preds = %0, %8
ret void
}