#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 /*<<< orphan*/ bzero(char *, int);
scalar_t__ getline(char *);
int /*<<< orphan*/ puts(char *);
int cstart() {
  char buf[256];
  bzero(buf, sizeof(buf));
  do {
    puts("> ");
    if (getline(buf) > 0) {
      puts("\r\n");
      puts(buf);
      bzero(buf, sizeof(buf));
    }
    puts("\r\n");
  } while (1);
}


x86 assembly (clang, -O0):
<cstart>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
lea    -0x110(%rbp),%rdi
mov    $0x100,%esi
call   1040 <bzero@plt>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
lea    -0x110(%rbp),%rdi
call   1050 <getline@plt>
cmp    $0x0,%rax
jle    1197 <cstart+0x67>
lea    0xe8e(%rip),%rdi
call   1030 <puts@plt>
lea    -0x110(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x110(%rbp),%rdi
mov    $0x100,%esi
call   1040 <bzero@plt>
lea    0xe65(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%al
test   $0x1,%al
jne    114c <cstart+0x1c>
jmp    11b2 <cstart+0x82>
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cstart>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1040 <bzero@plt>
lea    0xead(%rip),%r14
lea    0xea9(%rip),%r15
jmp    1168 <cstart+0x38>
nopl   0x0(%rax)
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <getline@plt>
test   %rax,%rax
jle    1160 <cstart+0x30>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x100,%esi
call   1040 <bzero@plt>
jmp    1160 <cstart+0x30>

LLVM IR (-O0):
@.str = [3 x i8] c"> \00"
@.str.1 = [3 x i8] c"\0D\0A\00"
define i32 @cstart() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @bzero(i8* %3, i32 256)
br label %5
5: ; preds = %18, %0
%6 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%8 = call i64 @getline(i8* %7)
%9 = icmp sgt i64 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %5
%11 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%13 = call i32 @puts(i8* %12)
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%15 = call i32 @bzero(i8* %14, i32 256)
br label %16
16: ; preds = %10, %5
%17 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16
br i1 true, label %5, label %19
19: ; preds = %18
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@.str = [3 x i8] c"> \00"
@.str.1 = [3 x i8] c"\0D\0A\00"
define i32 @cstart() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @bzero(i8* %2, i32 256)
br label %4
4: ; preds = %12, %0
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = call i64 @getline(i8* %2)
%7 = icmp sgt i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @puts(i8* %2)
%11 = call i32 @bzero(i8* %2, i32 256)
br label %12
12: ; preds = %8, %4
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %4
}