#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 EOF;
int format_line(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  int c;
  char sentence[1000];
  while ((c = format_line(sentence, 1000)) != EOF)
    if (c != '\n')
      printf("Inverted sentence: %s\n", sentence);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    $0x3e8,%esi
call   1030 <format_line@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e9b(%rip),%rcx
cmp    (%rcx),%eax
je     1177 <main+0x57>
cmpl   $0xa,-0x8(%rbp)
je     1172 <main+0x52>
lea    -0x3f0(%rbp),%rsi
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
jmp    1132 <main+0x12>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x3f0,%rsp
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1030 <format_line@plt>
mov    0x2ea8(%rip),%r15
cmp    (%r15),%eax
jne    1154 <main+0x34>
xor    %eax,%eax
add    $0x3f0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %rsp,%rbx
lea    0xea2(%rip),%r14
jmp    1172 <main+0x52>
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1030 <format_line@plt>
cmp    (%r15),%eax
je     1145 <main+0x25>
cmp    $0xa,%eax
je     1160 <main+0x40>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
jmp    1160 <main+0x40>

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [23 x i8] c"Inverted sentence: %s\0A\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = call i32 @format_line(i8* %2, i32 1000)
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %15, label %6
6: ; preds = %0, %11
%7 = phi i32 [ %12, %11 ], [ %3, %0 ]
%8 = icmp eq i32 %7, 10
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %11
11: ; preds = %9, %6
%12 = call i32 @format_line(i8* %2, i32 1000)
%13 = load i32, i32* @EOF
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %6
15: ; preds = %11, %0
ret i32 0
}