#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*/ printf(char *, char *, int);
int /*<<< orphan*/ stdin;
int strlen(char *);
scalar_t__ timlib_get_line(char *, int /*<<< orphan*/, int);
int main(void) {
  char buffer[65536];
  while (timlib_get_line(buffer, stdin, 65536))
    printf("%s|%d\n", buffer, strlen(buffer));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10020,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10010(%rbp),%rdi
mov    0x2e98(%rip),%rax
mov    (%rax),%esi
mov    $0x10000,%edx
call   1050 <timlib_get_line@plt>
cmp    $0x0,%rax
je     119a <main+0x6a>
lea    -0x10010(%rbp),%rax
mov    %rax,-0x10018(%rbp)
lea    -0x10010(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x10018(%rbp),%rsi
mov    %eax,%edx
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x10020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10000,%rsp
mov    0x2ea5(%rip),%r15
mov    (%r15),%esi
mov    %rsp,%rdi
mov    $0x10000,%edx
call   1050 <timlib_get_line@plt>
test   %rax,%rax
je     119a <main+0x6a>
mov    %rsp,%rbx
lea    0xe9e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
mov    (%r15),%esi
mov    %rbx,%rdi
mov    $0x10000,%edx
call   1050 <timlib_get_line@plt>
test   %rax,%rax
jne    1170 <main+0x40>
xor    %eax,%eax
add    $0x10000,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [7 x i8] c"%s|%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [65536 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %8, %0
%4 = getelementptr inbounds [65536 x i8], [65536 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i64 @timlib_get_line(i8* %4, i32 %5, i32 65536)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = getelementptr inbounds [65536 x i8], [65536 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds [65536 x i8], [65536 x i8]* %2, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %9, i32 %11)
br label %3
13: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [7 x i8] c"%s|%d\0A\00"
define i32 @main() {
%1 = alloca [65536 x i8]
%2 = getelementptr inbounds [65536 x i8], [65536 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i64 @timlib_get_line(i8* %2, i32 %3, i32 65536)
%5 = icmp eq i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %0, %6
%7 = call i32 @strlen(i8* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %7)
%9 = load i32, i32* @stdin
%10 = call i64 @timlib_get_line(i8* %2, i32 %9, i32 65536)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %6
12: ; preds = %6, %0
ret i32 0
}