#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 main() {
  int alphabetic(char);
  int longest(char[]);
  int i;
  char line[100];
  printf("input one line:\n");
  gets(line);
  printf("The longest word is:\n");
  for (i = longest(line); alphabetic(line[i]); i++)
    printf("%c", line[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1060 <gets@plt>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1050 <longest@plt>
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%edi
call   1030 <alphabetic@plt>
cmp    $0x0,%eax
je     11bc <main+0x7c>
movslq -0x8(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%esi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1180 <main+0x40>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
lea    0xea2(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%r14
mov    %r14,%rdi
call   1070 <gets@plt>
lea    0xe9b(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1060 <longest@plt>
movslq %eax,%rbx
movsbl (%rsp,%rbx,1),%edi
call   1050 <alphabetic@plt>
test   %eax,%eax
je     11b9 <main+0x69>
add    %r14,%rbx
add    $0x1,%rbx
nopl   0x0(%rax)
movsbl -0x1(%rbx),%edi
call   1030 <putchar@plt>
movsbl (%rbx),%edi
call   1050 <alphabetic@plt>
add    $0x1,%rbx
test   %eax,%eax
jne    11a0 <main+0x50>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"input one line:\0A\00"
@.str.1 = [22 x i8] c"The longest word is:\0A\00"
@.str.2 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x i8]
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%9 = call i32 @longest(i8* %8)
store i32 %9, i32* %2
br label %10
10: ; preds = %24, %0
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = call i32 @alphabetic(i8 signext %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %27
17: ; preds = %10
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %17
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
br label %10
27: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@str = [16 x i8] c"input one line:\00"
@str.3 = [21 x i8] c"The longest word is:\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.3, i64 0, i64 0))
%6 = call i32 @longest(i8* %2)
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = call i32 @alphabetic(i8 signext %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %23, label %12
12: ; preds = %0, %12
%13 = phi i64 [ %18, %12 ], [ %7, %0 ]
%14 = phi i8* [ %19, %12 ], [ %8, %0 ]
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = call i32 @putchar(i32 %16)
%18 = add i64 %13, 1
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = call i32 @alphabetic(i8 signext %20)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %12
23: ; preds = %12, %0
ret i32 0
}