#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 */
scalar_t__ getline(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ reverse(char *);
int main(void) {
  char line[10000] = "";
  while (getline(line, 10000) > 0) {
    reverse(line);
    printf("%s", line);
  }
  (void)putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2720,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x2720(%rbp),%rdi
xor    %esi,%esi
mov    $0x2710,%edx
call   1060 <memset@plt>
lea    -0x2720(%rbp),%rdi
mov    $0x2710,%esi
call   1070 <getline@plt>
cmp    $0x0,%rax
jle    11b4 <main+0x64>
lea    -0x2720(%rbp),%rdi
call   1030 <reverse@plt>
lea    -0x2720(%rbp),%rsi
lea    0xe56(%rip),%rdi
call   1050 <printf@plt>
jmp    1175 <main+0x25>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x2720,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x2718,%rsp
mov    %rsp,%rbx
mov    $0x2710,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
call   1070 <getline@plt>
test   %rax,%rax
jle    11b5 <main+0x65>
mov    %rsp,%rbx
lea    0xe78(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <reverse@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2710,%esi
call   1070 <getline@plt>
test   %rax,%rax
jg     1190 <main+0x40>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x2718,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10000 x i8]
store i32 0, i32* %1
%3 = bitcast [10000 x i8]* %2 to i8*
br label %4
4: ; preds = %8, %0
%5 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 0
%6 = call i64 @getline(i8* %5, i32 10000)
%7 = icmp sgt i64 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 0
%10 = call i32 @reverse(i8* %9)
%11 = getelementptr inbounds [10000 x i8], [10000 x i8]* %2, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %4
13: ; preds = %4
%14 = call i32 @putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [10000 x i8]
%2 = getelementptr inbounds [10000 x i8], [10000 x i8]* %1, i64 0, i64 0
%3 = call i64 @getline(i8* %2, i32 10000)
%4 = icmp sgt i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %0, %5
%6 = call i32 @reverse(i8* %2)
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%8 = call i64 @getline(i8* %2, i32 10000)
%9 = icmp sgt i64 %8, 0
br i1 %9, label %5, label %10
10: ; preds = %5, %0
%11 = call i32 @putchar(i8 signext 10)
ret i32 0
}