#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 */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ forth_init();
scalar_t__ forth_parse(char *, size_t);
int /*<<< orphan*/ stdin;
size_t strlen(char *);
int main(void) {
  char buf[1024];
  forth_init();
  (void)forth_parse(buf, 0);
  while (fgets(buf, sizeof(buf), stdin) != NULL) {
    size_t n = strlen(buf + 0);
    if (forth_parse(buf + 0, n) < 0) {
      return EXIT_FAILURE;
    }
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <forth_init@plt>
lea    -0x410(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <forth_parse@plt>
lea    -0x410(%rbp),%rdi
mov    0x2e71(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     11d3 <main+0x93>
lea    -0x410(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x418(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x418(%rbp),%rsi
call   1050 <forth_parse@plt>
cmp    $0x0,%rax
jge    11ce <main+0x8e>
mov    0x2e14(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11df <main+0x9f>
jmp    1169 <main+0x29>
mov    0x2df6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x408,%rsp
xor    %eax,%eax
call   1060 <forth_init@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <forth_parse@plt>
mov    0x2e7f(%rip),%r15
mov    0x2e60(%rip),%r14
mov    0x2e61(%rip),%r12
nopw   0x0(%rax,%rax,1)
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     11b0 <main+0x70>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <forth_parse@plt>
test   %rax,%rax
jns    1180 <main+0x40>
mov    %r12,%r14
mov    (%r14),%eax
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca i64
store i32 0, i32* %1
%4 = call i32 (...) @forth_init()
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%6 = call i64 @forth_parse(i8* %5, i64 0)
br label %7
7: ; preds = %23, %0
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%9 = load i32, i32* @stdin
%10 = call i32* @fgets(i8* %8, i32 1024, i32 %9)
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %24
12: ; preds = %7
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = call i64 @strlen(i8* %14)
store i64 %15, i64* %3
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i64, i64* %3
%19 = call i64 @forth_parse(i8* %17, i64 %18)
%20 = icmp slt i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %12
%22 = load i32, i32* @EXIT_FAILURE
store i32 %22, i32* %1
br label %26
23: ; preds = %12
br label %7
24: ; preds = %7
%25 = load i32, i32* @EXIT_SUCCESS
store i32 %25, i32* %1
br label %26
26: ; preds = %24, %21
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
@stdin = global i32 0
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @forth_init()
%4 = call i64 @forth_parse(i8* %2, i64 0)
br label %5
5: ; preds = %9, %0
%6 = load i32, i32* @stdin
%7 = call i32* @fgets(i8* %2, i32 1024, i32 %6)
%8 = icmp eq i32* %7, null
br i1 %8, label %13, label %9
9: ; preds = %5
%10 = call i64 @strlen(i8* %2)
%11 = call i64 @forth_parse(i8* %2, i64 %10)
%12 = icmp slt i64 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %9
%14 = phi i32* [ @EXIT_FAILURE, %9 ], [ @EXIT_SUCCESS, %5 ]
%15 = load i32, i32* %14
ret i32 %15
}