#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__ get_word(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int i = 0;
  char words[30][20];
  printf("Enter a sentence: ");
  while (get_word(words[i]) == 0) {
    i += 1;
  }
  while (i >= 0) {
    printf("%s ", words[i]);
    i -= 1;
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x260,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0x260(%rbp),%rdi
imul   $0x14,%rax,%rax
add    %rax,%rdi
call   1040 <get_word@plt>
cmp    $0x0,%rax
jne    1176 <main+0x56>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1147 <main+0x27>
jmp    117b <main+0x5b>
cmpl   $0x0,-0x8(%rbp)
jl     11b3 <main+0x93>
movslq -0x8(%rbp),%rax
lea    -0x260(%rbp),%rsi
imul   $0x14,%rax,%rax
add    %rax,%rsi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117b <main+0x5b>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x260,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x260,%rsp
lea    0xebd(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%r14
nop
mov    %r14,%rdi
call   1050 <get_word@plt>
add    $0x1,%ebx
add    $0x14,%r14
test   %rax,%rax
je     1150 <main+0x20>
lea    -0x1(%rbx),%eax
lea    (%rax,%rax,4),%rax
lea    (%rsp,%rax,4),%r15
lea    0xe9d(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebx
add    $0xffffffffffffffec,%r15
test   %ebx,%ebx
jg     1180 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x260,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter a sentence: \00"
@.str.1 = [4 x i8] c"%s \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [30 x [20 x i8]]
store i32 0, i32* %1
store i32 0, i32* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %12, %0
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [30 x [20 x i8]], [30 x [20 x i8]]* %3, i64 0, i64 %7
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%10 = call i64 @get_word(i8* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %5
%13 = load i32, i32* %2
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %5
15: ; preds = %5
br label %16
16: ; preds = %19, %15
%17 = load i32, i32* %2
%18 = icmp sge i32 %17, 0
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [30 x [20 x i8]], [30 x [20 x i8]]* %3, i64 0, i64 %21
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %22, i64 0, i64 0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %23)
%25 = load i32, i32* %2
%26 = sub nsw i32 %25, 1
store i32 %26, i32* %2
br label %16
27: ; preds = %16
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter a sentence: \00"
@.str.1 = [4 x i8] c"%s \00"
define i32 @main() {
%1 = alloca [30 x [20 x i8]]
%2 = getelementptr inbounds [30 x [20 x i8]], [30 x [20 x i8]]* %1, i64 0, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
%5 = phi i64 [ %9, %4 ], [ 0, %0 ]
%6 = getelementptr inbounds [30 x [20 x i8]], [30 x [20 x i8]]* %1, i64 0, i64 %5, i64 0
%7 = call i64 @get_word(i8* %6)
%8 = icmp eq i64 %7, 0
%9 = add nuw i64 %5, 1
br i1 %8, label %4, label %10
10: ; preds = %4
%11 = and i64 %5, 4294967295
br label %12
12: ; preds = %10, %12
%13 = phi i64 [ %11, %10 ], [ %16, %12 ]
%14 = getelementptr inbounds [30 x [20 x i8]], [30 x [20 x i8]]* %1, i64 0, i64 %13, i64 0
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = add nsw i64 %13, -1
%17 = trunc i64 %13 to i32
%18 = icmp sgt i32 %17, 0
br i1 %18, label %12, label %19
19: ; preds = %12
%20 = call i32 @putchar(i32 10)
ret i32 0
}