#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*/ PipcdDrawString(char *);
int /*<<< orphan*/ PipcdInit();
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main() {
  PipcdInit();
  setbuf(stdout, NULL);
  char dat[255];
  while (fgets(dat, 255, stdin)) {
    PipcdDrawString(dat);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <PipcdInit@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <setbuf@plt>
lea    -0x110(%rbp),%rdi
mov    0x2e6f(%rip),%rax
mov    (%rax),%edx
mov    $0xff,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     11a0 <main+0x60>
lea    -0x110(%rbp),%rdi
call   1030 <PipcdDrawString@plt>
jmp    116b <main+0x2b>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x108,%rsp
xor    %eax,%eax
call   1060 <PipcdInit@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1040 <setbuf@plt>
mov    0x2e80(%rip),%r14
mov    (%r14),%edx
mov    %rsp,%rdi
mov    $0xff,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     119d <main+0x5d>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <PipcdDrawString@plt>
mov    (%r14),%edx
mov    %rbx,%rdi
mov    $0xff,%esi
call   1050 <fgets@plt>
test   %rax,%rax
jne    1180 <main+0x40>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdout = global i32 0
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [255 x i8]
store i32 0, i32* %1
%3 = call i32 (...) @PipcdInit()
%4 = load i32, i32* @stdout
%5 = call i32 @setbuf(i32 %4, i32* null)
br label %6
6: ; preds = %11, %0
%7 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i64 @fgets(i8* %7, i32 255, i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%13 = call i32 @PipcdDrawString(i8* %12)
br label %6
14: ; preds = %6
ret i32 0
}

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