#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*/ display_info();
int /*<<< orphan*/ free(char *);
int getline(char **, size_t *, int /*<<< orphan*/);
int parsing(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strtok(char *, char *);
int main(int argc, char **argv) {
  int status = 1;
  int read;
  size_t len;
  char *buffer = NULL;
  printf("----- C O N S O L E\t S I M U L A T I O N -----\n\n");
  while (status) {
    display_info();
    read = getline(&buffer, &len, stdin);
    strtok(buffer, "\n");
    status = parsing(buffer);
  }
  if (read)
    free(buffer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movq   $0x0,-0x28(%rbp)
lea    0xe74(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
je     11dc <main+0x7c>
mov    $0x0,%al
call   1060 <display_info@plt>
mov    0x2e3f(%rip),%rax
mov    (%rax),%edx
lea    -0x28(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1080 <getline@plt>
mov    %eax,-0x18(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe69(%rip),%rsi
call   1070 <strtok@plt>
mov    -0x28(%rbp),%rdi
call   1040 <parsing@plt>
mov    %eax,-0x14(%rbp)
jmp    1191 <main+0x31>
cmpl   $0x0,-0x18(%rbp)
je     11ef <main+0x8f>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
movq   $0x0,(%rsp)
lea    0xe85(%rip),%rdi
call   1050 <puts@plt>
mov    0x2e61(%rip),%r12
mov    %rsp,%r14
lea    0x8(%rsp),%r15
lea    0xe98(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <display_info@plt>
mov    (%r12),%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1080 <getline@plt>
mov    %eax,%ebp
mov    (%rsp),%rdi
mov    %rbx,%rsi
call   1070 <strtok@plt>
mov    (%rsp),%rdi
call   1040 <parsing@plt>
test   %eax,%eax
jne    11a0 <main+0x40>
test   %ebp,%ebp
je     11de <main+0x7e>
mov    (%rsp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [49 x i8] c"----- C O N S O L E\09 S I M U L A T I O N -----\0A\0A\00"
@stdin = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i8* null, i8** %9
%10 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %14, %2
%12 = load i32, i32* %6
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %22
14: ; preds = %11
%15 = call i32 (...) @display_info()
%16 = load i32, i32* @stdin
%17 = call i32 @getline(i8** %9, i64* %8, i32 %16)
store i32 %17, i32* %7
%18 = load i8*, i8** %9
%19 = call i32 @strtok(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = load i8*, i8** %9
%21 = call i32 @parsing(i8* %20)
store i32 %21, i32* %6
br label %11
22: ; preds = %11
%23 = load i32, i32* %7
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i8*, i8** %9
%27 = call i32 @free(i8* %26)
br label %28
28: ; preds = %25, %22
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
@str = [48 x i8] c"----- C O N S O L E\09 S I M U L A T I O N -----\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = bitcast i64* %3 to i8*
%6 = bitcast i8** %4 to i8*
store i8* null, i8** %4
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
br label %8
8: ; preds = %2, %8
%9 = call i32 (...) @display_info()
%10 = load i32, i32* @stdin
%11 = call i32 @getline(i8** %4, i64* %3, i32 %10)
%12 = load i8*, i8** %4
%13 = call i32 @strtok(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = load i8*, i8** %4
%15 = call i32 @parsing(i8* %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %8
17: ; preds = %8
%18 = icmp eq i32 %11, 0
br i1 %18, label %22, label %19
19: ; preds = %17
%20 = load i8*, i8** %4
%21 = call i32 @free(i8* %20)
br label %22
22: ; preds = %19, %17
ret i32 0
}