#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*/ *gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int strlen(char *);
int main(int argc, const char *argv[]) {
  int i;
  char str[501];
  while (gets(str) != NULL) {
    for (i = strlen(str) - 1; i >= 0; i--)
      if (str[i] >= 'a' && str[i] <= 'z')
        putchar(str[i]);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x210(%rbp),%rdi
call   1060 <gets@plt>
cmp    $0x0,%rax
je     11ea <main+0xaa>
lea    -0x210(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11d9 <main+0x99>
movslq -0x14(%rbp),%rax
movsbl -0x210(%rbp,%rax,1),%eax
ff
cmp    $0x61,%eax
jl     11c6 <main+0x86>
movslq -0x14(%rbp),%rax
movsbl -0x210(%rbp,%rax,1),%eax
ff
cmp    $0x7a,%eax
jg     11c6 <main+0x86>
movslq -0x14(%rbp),%rax
movsbl -0x210(%rbp,%rax,1),%edi
ff
call   1030 <putchar@plt>
jmp    11cb <main+0x8b>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1181 <main+0x41>
lea    0xe20(%rip),%rdi
call   1050 <printf@plt>
jmp    1159 <main+0x19>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1f8,%rsp
mov    %rsp,%rdi
call   1050 <gets@plt>
test   %rax,%rax
je     11a3 <main+0x73>
mov    %rsp,%r14
jmp    1167 <main+0x37>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
call   1050 <gets@plt>
test   %rax,%rax
je     11a3 <main+0x73>
mov    %r14,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1150 <main+0x20>
mov    %eax,%ebx
add    $0x1,%rbx
jmp    118a <main+0x5a>
nopl   0x0(%rax,%rax,1)
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
jbe    1150 <main+0x20>
lea    -0x2(%rbx),%eax
movzbl (%rsp,%rax,1),%eax
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     1180 <main+0x50>
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1180 <main+0x50>
xor    %eax,%eax
add    $0x1f8,%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 i32
%7 = alloca [501 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %8
8: ; preds = %43, %2
%9 = getelementptr inbounds [501 x i8], [501 x i8]* %7, i64 0, i64 0
%10 = call i32* @gets(i8* %9)
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %45
12: ; preds = %8
%13 = getelementptr inbounds [501 x i8], [501 x i8]* %7, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
%15 = sub nsw i32 %14, 1
store i32 %15, i32* %6
br label %16
16: ; preds = %40, %12
%17 = load i32, i32* %6
%18 = icmp sge i32 %17, 0
br i1 %18, label %19, label %43
19: ; preds = %16
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [501 x i8], [501 x i8]* %7, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp sge i32 %24, 97
br i1 %25, label %26, label %39
26: ; preds = %19
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [501 x i8], [501 x i8]* %7, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp sle i32 %31, 122
br i1 %32, label %33, label %39
33: ; preds = %26
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [501 x i8], [501 x i8]* %7, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = call i32 @putchar(i8 signext %37)
br label %39
39: ; preds = %33, %26, %19
br label %40
40: ; preds = %39
%41 = load i32, i32* %6
%42 = add nsw i32 %41, -1
store i32 %42, i32* %6
br label %16
43: ; preds = %16
%44 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %8
45: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [501 x i8]
%4 = getelementptr inbounds [501 x i8], [501 x i8]* %3, i64 0, i64 0
%5 = call i32* @gets(i8* %4)
%6 = icmp eq i32* %5, null
br i1 %6, label %28, label %7
7: ; preds = %2, %24
%8 = call i32 @strlen(i8* %4)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %24
10: ; preds = %7
%11 = zext i32 %8 to i64
br label %12
12: ; preds = %10, %22
%13 = phi i64 [ %11, %10 ], [ %14, %22 ]
%14 = add nsw i64 %13, -1
%15 = and i64 %14, 4294967295
%16 = getelementptr inbounds [501 x i8], [501 x i8]* %3, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = add i8 %17, -97
%19 = icmp ult i8 %18, 26
br i1 %19, label %20, label %22
20: ; preds = %12
%21 = call i32 @putchar(i8 signext %17)
br label %22
22: ; preds = %12, %20
%23 = icmp ugt i64 %13, 1
br i1 %23, label %12, label %24
24: ; preds = %22, %7
%25 = call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 10)
%26 = call i32* @gets(i8* %4)
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %7
28: ; preds = %24, %2
ret i32 0
}