#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;
char *strchr(char *, char);
scalar_t__ strcmp(char *, char *);
void console_loop() {
  char user_input[255] = "";
  int loop_exit = 0;
  while (!loop_exit) {
    printf(">");
    fgets(user_input, sizeof user_input, stdin);
    char *p = strchr(user_input, '\n');
    if (p) {
      *p = 0;
    }
    if (strcmp(user_input, "quit") != 0 && strcmp(user_input, "exit") != 0) {
      printf("	Column1		Column2		Column3\n");
      printf("0	Row1		Row2		Row3\n");
    } else {
      loop_exit = 1;
    }
  }
}


x86 assembly (clang, -O0):
<console_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
lea    -0x100(%rbp),%rdi
xor    %esi,%esi
mov    $0xff,%edx
call   1050 <memset@plt>
movl   $0x0,-0x104(%rbp)
cmpl   $0x0,-0x104(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1191 <console_loop+0x41>
jmp    124d <console_loop+0xfd>
lea    0xe68(%rip),%rdi
call   1040 <printf@plt>
lea    -0x100(%rbp),%rdi
mov    0x2e3d(%rip),%rax
mov    (%rax),%edx
mov    $0xff,%esi
call   1060 <fgets@plt>
lea    -0x100(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
mov    %rax,-0x110(%rbp)
cmpq   $0x0,-0x110(%rbp)
je     11e7 <console_loop+0x97>
mov    -0x110(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x100(%rbp),%rdi
lea    0xe0d(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     123e <console_loop+0xee>
lea    -0x100(%rbp),%rdi
lea    0xdf5(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     123e <console_loop+0xee>
lea    0xde4(%rip),%rdi
call   1040 <printf@plt>
lea    0xdf4(%rip),%rdi
call   1040 <printf@plt>
jmp    1248 <console_loop+0xf8>
movl   $0x1,-0x104(%rbp)
jmp    1178 <console_loop+0x28>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<console_loop>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0xef(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    0x2e16(%rip),%rbp
mov    %rsp,%rbx
lea    0xe24(%rip),%r14
lea    0xe22(%rip),%r15
lea    0xe20(%rip),%r12
lea    0xe34(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x3e,%edi
call   1030 <putchar@plt>
mov    0x0(%rbp),%edx
mov    %rbx,%rdi
mov    $0xff,%esi
call   1060 <fgets@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     122f <console_loop+0xdf>
movb   $0x0,(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1261 <console_loop+0x111>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1261 <console_loop+0x111>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    %r13,%rdi
call   1040 <puts@plt>
jmp    1200 <console_loop+0xb0>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c">\00"
@stdin = global i32 0
@.str.1 = [5 x i8] c"quit\00"
@.str.2 = [5 x i8] c"exit\00"
@.str.3 = [28 x i8] c"\09Column1\09\09Column2\09\09Column3\0A\00"
@.str.4 = [20 x i8] c"0\09Row1\09\09Row2\09\09Row3\0A\00"
define void @console_loop() {
%1 = alloca [255 x i8]
%2 = alloca i32
%3 = alloca i8*
%4 = bitcast [255 x i8]* %1 to i8*
store i32 0, i32* %2
br label %5
5: ; preds = %32, %0
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
br i1 %8, label %9, label %33
9: ; preds = %5
%10 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%12 = load i32, i32* @stdin
%13 = call i32 @fgets(i8* %11, i32 255, i32 %12)
%14 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%15 = call i8* @strchr(i8* %14, i8 signext 10)
store i8* %15, i8** %3
%16 = load i8*, i8** %3
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %20
18: ; preds = %9
%19 = load i8*, i8** %3
store i8 0, i8* %19
br label %20
20: ; preds = %18, %9
%21 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %31
24: ; preds = %20
%25 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %32
31: ; preds = %24, %20
store i32 1, i32* %2
br label %32
32: ; preds = %31, %28
br label %5
33: ; preds = %5
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@.str.1 = [5 x i8] c"quit\00"
@.str.2 = [5 x i8] c"exit\00"
@str = [27 x i8] c"\09Column1\09\09Column2\09\09Column3\00"
@str.5 = [19 x i8] c"0\09Row1\09\09Row2\09\09Row3\00"
define void @console_loop() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %16, %0
%4 = call i32 @putchar(i32 62)
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %2, i32 255, i32 %5)
%7 = call i8* @strchr(i8* %2, i8 signext 10)
%8 = icmp eq i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %3
store i8 0, i8* %7
br label %10
10: ; preds = %9, %3
%11 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %19, label %13
13: ; preds = %10
%14 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.5, i64 0, i64 0))
br label %3
19: ; preds = %10, %13
ret void
}