#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ next_word(char **, char *);
int /*<<< orphan*/ parse_word(char *, char **);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
const char *parse_line(char *s) {
  char *e;
  fprintf(stderr, "OP =");
  while (*s) {
    parse_word(s, &e);
    if (strcmp(s, "quit") == 0) {
      return "entered quit";
    }
    fprintf(stderr, " '%s'", s);
    next_word(&s, e);
  }
  fprintf(stderr, "\n");
  return NULL;
}


x86 assembly (clang, -O0):
<parse_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
lea    0xea4(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11d4 <parse_line+0x94>
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <parse_word@plt>
mov    -0x10(%rbp),%rdi
lea    0xe85(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11a7 <parse_line+0x67>
lea    0xe67(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11f3 <parse_line+0xb3>
mov    0x2e32(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe57(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x18(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1030 <next_word@plt>
jmp    1163 <parse_line+0x23>
mov    0x2e05(%rip),%rax
mov    (%rax),%edi
lea    0xe34(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_line>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbp
mov    %rdi,0x8(%rsp)
mov    0x2e83(%rip),%r14
mov    (%r14),%edi
lea    0xe99(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
cmpb   $0x0,0x0(%rbp)
je     11d7 <parse_line+0x97>
lea    0x10(%rsp),%r15
lea    0xe8d(%rip),%r13
lea    0xe8b(%rip),%r12
lea    0x8(%rsp),%rbx
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    %r15,%rsi
call   1060 <parse_word@plt>
mov    0x8(%rsp),%rdi
mov    %r13,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11ec <parse_line+0xac>
mov    (%r14),%edi
mov    0x8(%rsp),%rdx
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <next_word@plt>
mov    0x8(%rsp),%rbp
cmpb   $0x0,0x0(%rbp)
jne    1190 <parse_line+0x50>
mov    (%r14),%edi
lea    0xe37(%rip),%rsi
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    11f3 <parse_line+0xb3>
lea    0xe12(%rip),%rbx
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [5 x i8] c"OP =\00"
@.str.1 = [5 x i8] c"quit\00"
@.str.2 = [13 x i8] c"entered quit\00"
@.str.3 = [6 x i8] c" '%s'\00"
@.str.4 = [2 x i8] c"\0A\00"
define i8* @parse_line(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i32, i32* @stderr
%6 = call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %18, %1
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %24
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = call i32 @parse_word(i8* %12, i8** %4)
%14 = load i8*, i8** %3
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %11
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %27
18: ; preds = %11
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %3
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %20)
%22 = load i8*, i8** %4
%23 = call i32 @next_word(i8** %3, i8* %22)
br label %7
24: ; preds = %7
%25 = load i32, i32* @stderr
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i8* null, i8** %2
br label %27
27: ; preds = %24, %17
%28 = load i8*, i8** %2
ret i8* %28
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [5 x i8] c"OP =\00"
@.str.1 = [5 x i8] c"quit\00"
@.str.2 = [13 x i8] c"entered quit\00"
@.str.3 = [6 x i8] c" '%s'\00"
@.str.4 = [2 x i8] c"\0A\00"
define i8* @parse_line(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = bitcast i8** %3 to i8*
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %24, label %9
9: ; preds = %1, %15
%10 = phi i8* [ %21, %15 ], [ %0, %1 ]
%11 = call i32 @parse_word(i8* %10, i8** %3)
%12 = load i8*, i8** %2
%13 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %27, label %15
15: ; preds = %9
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %2
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %17)
%19 = load i8*, i8** %3
%20 = call i32 @next_word(i8** %2, i8* %19)
%21 = load i8*, i8** %2
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
br i1 %23, label %24, label %9
24: ; preds = %15, %1
%25 = load i32, i32* @stderr
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %27
27: ; preds = %9, %24
%28 = phi i8* [ null, %24 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %9 ]
ret i8* %28
}