#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*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ parse_line(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ version(char *);
void main_text_ui(void) {
  version("Frame-Selector (text-ui)");
  fputc('\n', stdout);
  while (1) {
    char line[1024];
    printf("> ");
    fgets(line, 1024, stdin);
    if (!parse_line(line))
      break;
  }
}


x86 assembly (clang, -O0):
<main_text_ui>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
lea    0xe9e(%rip),%rdi
call   1060 <version@plt>
mov    0x2e6a(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
lea    -0x400(%rbp),%rdi
mov    0x2e54(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1050 <fgets@plt>
lea    -0x400(%rbp),%rdi
call   1070 <parse_line@plt>
cmp    $0x0,%eax
jne    11ba <main_text_ui+0x6a>
jmp    11bf <main_text_ui+0x6f>
jmp    117a <main_text_ui+0x2a>
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main_text_ui>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
lea    0xe9d(%rip),%rdi
call   1060 <version@plt>
mov    0x2e69(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <fputc@plt>
lea    0xe97(%rip),%r14
mov    0x2e5f(%rip),%r15
mov    %rsp,%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
call   1070 <parse_line@plt>
test   %eax,%eax
jne    1190 <main_text_ui+0x40>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Frame-Selector (text-ui)\00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"> \00"
@stdin = global i32 0
define void @main_text_ui() {
%1 = alloca [1024 x i8]
%2 = call i32 @version(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = call i32 @fputc(i8 signext 10, i32 %3)
br label %5
5: ; preds = %0, %14
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %7, i32 1024, i32 %8)
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%11 = call i32 @parse_line(i8* %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %5
br label %15
14: ; preds = %5
br label %5
15: ; preds = %13
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Frame-Selector (text-ui)\00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"> \00"
@stdin = global i32 0
define void @main_text_ui() {
%1 = alloca [1024 x i8]
%2 = tail call i32 @version(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = tail call i32 @fputc(i8 signext 10, i32 %3)
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
br label %6
6: ; preds = %6, %0
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %5, i32 1024, i32 %8)
%10 = call i32 @parse_line(i8* %5)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %6
12: ; preds = %6
ret void
}