#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*/ free(char *);
char *get_next_line(int /*<<< orphan*/);
int /*<<< orphan*/ print(char *);
int main(int ac, char **av) {
  char *s;
  if ((!av[1])) {
    while ((s = get_next_line(0))) {
      print(s);
      print("\n");
      free(s);
    }
    free(s);
    return (0);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jne    11a7 <main+0x77>
jmp    115a <main+0x2a>
xor    %edi,%edi
call   1050 <get_next_line@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1192 <main+0x62>
mov    -0x18(%rbp),%rdi
call   1040 <print@plt>
lea    0xe81(%rip),%rdi
call   1040 <print@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
jmp    115a <main+0x2a>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ae <main+0x7e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmpq   $0x0,0x8(%rsi)
jne    118e <main+0x5e>
xor    %edi,%edi
call   1050 <get_next_line@plt>
test   %rax,%rax
je     1187 <main+0x57>
mov    %rax,%rbx
lea    0xeaf(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <print@plt>
mov    %r14,%rdi
call   1040 <print@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %edi,%edi
call   1050 <get_next_line@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1160 <main+0x30>
xor    %edi,%edi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = icmp ne i8* %9, null
br i1 %10, label %24, label %11
11: ; preds = %2
br label %12
12: ; preds = %15, %11
%13 = call i8* @get_next_line(i32 0)
store i8* %13, i8** %6
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i8*, i8** %6
%17 = call i32 @print(i8* %16)
%18 = call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%19 = load i8*, i8** %6
%20 = call i32 @free(i8* %19)
br label %12
21: ; preds = %12
%22 = load i8*, i8** %6
%23 = call i32 @free(i8* %22)
store i32 0, i32* %3
br label %25
24: ; preds = %2
store i32 0, i32* %3
br label %25
25: ; preds = %24, %21
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %18
6: ; preds = %2
%7 = tail call i8* @get_next_line(i32 0)
%8 = icmp eq i8* %7, null
br i1 %8, label %16, label %9
9: ; preds = %6, %9
%10 = phi i8* [ %14, %9 ], [ %7, %6 ]
%11 = tail call i32 @print(i8* %10)
%12 = tail call i32 @print(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 @free(i8* %10)
%14 = tail call i8* @get_next_line(i32 0)
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %9
16: ; preds = %9, %6
%17 = tail call i32 @free(i8* null)
br label %18
18: ; preds = %2, %16
ret i32 0
}