#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ print_sc(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ read(int, char *, int);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ string_getNext(char *, char *);
int main(void) {
  static char code[1024];
  static char identifier[24];
  static int times = 0;
  static char times_flag = 0;
  while (1) {
    read(0xffffffff, code, 1024);
    string_getNext(code, identifier);
    if (strcmp(identifier, "quit")) {
      break;
    } else if (strcmp(identifier, "print")) {
      if (times_flag) {
        while (times) {
          print_sc(code);
          times--;
        }
      } else {
        print_sc(code);
      }
    } else {
      puts("Unknown identifier.");
    }
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xffffffff,%edi
lea    0x2ee5(%rip),%rsi
mov    $0x400,%edx
call   1040 <read@plt>
lea    0x2ed4(%rip),%rdi
lea    0x32cd(%rip),%rsi
call   1080 <string_getNext@plt>
lea    0x32c1(%rip),%rdi
lea    0xe5a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11ba <main+0x5a>
jmp    1242 <main+0xe2>
lea    0x329f(%rip),%rdi
lea    0xe3d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     122c <main+0xcc>
cmpb   $0x0,0x329e(%rip)
je     121b <main+0xbb>
jmp    11e9 <main+0x89>
cmpl   $0x0,0x3288(%rip)
je     1216 <main+0xb6>
lea    0x2e63(%rip),%rdi
call   1060 <print_sc@plt>
mov    0x3270(%rip),%eax
add    $0xffffffff,%eax
mov    %eax,0x3267(%rip)
jmp    11e9 <main+0x89>
jmp    1227 <main+0xc7>
lea    0x2e3e(%rip),%rdi
call   1060 <print_sc@plt>
jmp    1238 <main+0xd8>
lea    0xdd8(%rip),%rdi
call   1030 <puts@plt>
jmp    123d <main+0xdd>
jmp    116f <main+0xf>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
lea    0x2ef0(%rip),%r14
mov    $0xffffffff,%edi
mov    %r14,%rsi
mov    $0x400,%edx
call   1040 <read@plt>
lea    0x32d7(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <string_getNext@plt>
lea    0xe65(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    121f <main+0xbf>
lea    0x32b1(%rip),%rbx
lea    0xe4f(%rip),%r14
lea    0xe4e(%rip),%r15
lea    0x2e9c(%rip),%r12
lea    0xe35(%rip),%r13
jmp    1205 <main+0xa5>
nopl   (%rax)
mov    %r15,%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
mov    %r12,%rsi
mov    $0x400,%edx
call   1040 <read@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1080 <string_getNext@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    121f <main+0xbf>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11d0 <main+0x70>
mov    %r12,%rdi
call   1060 <print_sc@plt>
jmp    11d8 <main+0x78>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@main.code = internal global [1024 x i8] zeroinitializer
@main.identifier = internal global [24 x i8] zeroinitializer
@main.times = internal global i32 0
@main.times_flag = internal global i8 0
@.str = [5 x i8] c"quit\00"
@.str.1 = [6 x i8] c"print\00"
@.str.2 = [20 x i8] c"Unknown identifier.\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %29
%3 = call i32 @read(i32 -1, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.code, i64 0, i64 0), i32 1024)
%4 = call i32 @string_getNext(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.code, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @main.identifier, i64 0, i64 0))
%5 = call i64 @strcmp(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @main.identifier, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %2
br label %30
8: ; preds = %2
%9 = call i64 @strcmp(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @main.identifier, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %26
11: ; preds = %8
%12 = load i8, i8* @main.times_flag
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %23
14: ; preds = %11
br label %15
15: ; preds = %18, %14
%16 = load i32, i32* @main.times
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = call i32 @print_sc(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.code, i64 0, i64 0))
%20 = load i32, i32* @main.times
%21 = add nsw i32 %20, -1
store i32 %21, i32* @main.times
br label %15
22: ; preds = %15
br label %25
23: ; preds = %11
%24 = call i32 @print_sc(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.code, i64 0, i64 0))
br label %25
25: ; preds = %23, %22
br label %28
26: ; preds = %8
%27 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %26, %25
br label %29
29: ; preds = %28
br label %2
30: ; preds = %7
%31 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@main.code = internal global [1024 x i8] zeroinitializer
@main.identifier = internal global [24 x i8] zeroinitializer
@.str = [5 x i8] c"quit\00"
@.str.1 = [6 x i8] c"print\00"
@.str.2 = [20 x i8] c"Unknown identifier.\00"
define i32 @main() {
%1 = tail call i32 @read(i32 -1, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.code, i64 0, i64 0), i32 1024)
%2 = tail call i32 @string_getNext(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.code, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @main.identifier, i64 0, i64 0))
%3 = tail call i64 @strcmp(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @main.identifier, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %17
5: ; preds = %0, %12
%6 = tail call i64 @strcmp(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @main.identifier, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @print_sc(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.code, i64 0, i64 0))
br label %12
10: ; preds = %5
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
%13 = tail call i32 @read(i32 -1, i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.code, i64 0, i64 0), i32 1024)
%14 = tail call i32 @string_getNext(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @main.code, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @main.identifier, i64 0, i64 0))
%15 = tail call i64 @strcmp(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @main.identifier, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %5, label %17
17: ; preds = %12, %0
%18 = tail call i32 @exit(i32 0)
unreachable
}