#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*/ strcpy(char *, char *);
int strlen(char *);
longestWord() {
  char coment[80];
  char save[80];
  char *bigword;
  int bigger = 0;
  int cont = 0;
  int lon = 0;
  int lon2 = 0;
  int i;
  printf("INGRESA UN COMENTARIO\n");
  gets(coment);
  lon = strlen(coment);
  for (i = 0; i < lon; ++i) {
    if (coment[i] == ' ') {
      printf("Hay un espacio\n");
      cont = 0;
      strcpy(save, "");
    } else {
      strcpy(save, coment);
      cont++;
      if (cont >= bigger) {
        bigger = cont;
      }
    }
  }
  printf("No de letras %i, Palabra: %s \n", bigger, save);
}


x86 assembly (clang, -O0):
<longestWord>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0xbc(%rbp)
movl   $0x0,-0xc0(%rbp)
movl   $0x0,-0xc4(%rbp)
movl   $0x0,-0xc8(%rbp)
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x60(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc4(%rbp)
movl   $0x0,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
cmp    -0xc4(%rbp),%eax
jge    1255 <longestWord+0x115>
movslq -0xcc(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x20,%eax
jne    11fa <longestWord+0xba>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0xc0(%rbp)
lea    -0xb0(%rbp),%rdi
lea    0xe55(%rip),%rsi
call   1030 <strcpy@plt>
jmp    123c <longestWord+0xfc>
lea    -0xb0(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0xc0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc0(%rbp)
mov    -0xc0(%rbp),%eax
cmp    -0xbc(%rbp),%eax
jl     1237 <longestWord+0xf7>
mov    -0xc0(%rbp),%eax
mov    %eax,-0xbc(%rbp)
jmp    123c <longestWord+0xfc>
jmp    1241 <longestWord+0x101>
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    11a3 <longestWord+0x63>
mov    -0xbc(%rbp),%esi
lea    -0xb0(%rbp),%rdx
lea    0xdbe(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<longestWord>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1070 <gets@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    11e6 <longestWord+0x96>
mov    %eax,%ebp
xor    %r14d,%r14d
lea    0x50(%rsp),%r12
mov    %rsp,%r13
xor    %ebx,%ebx
xor    %r15d,%r15d
jmp    11bf <longestWord+0x6f>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
add    $0x1,%r15d
cmp    %ebx,%r15d
cmovge %r15d,%ebx
add    $0x1,%r14
cmp    %r14,%rbp
je     11e8 <longestWord+0x98>
cmpb   $0x20,(%rsp,%r14,1)
jne    11a0 <longestWord+0x50>
lea    0xe68(%rip),%rdi
call   1040 <puts@plt>
mov    %r12,%rdi
lea    0xe42(%rip),%rsi
call   1030 <strcpy@plt>
xor    %r15d,%r15d
jmp    11b6 <longestWord+0x66>
xor    %ebx,%ebx
lea    0xe11(%rip),%rdi
lea    0x50(%rsp),%rdx
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"INGRESA UN COMENTARIO\0A\00"
@.str.1 = [16 x i8] c"Hay un espacio\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [31 x i8] c"No de letras %i, Palabra: %s \0A\00"
define i32 @longestWord() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca [80 x i8]
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%12 = call i32 @gets(i8* %11)
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
store i32 %14, i32* %7
store i32 0, i32* %9
br label %15
15: ; preds = %43, %0
%16 = load i32, i32* %9
%17 = load i32, i32* %7
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %46
19: ; preds = %15
%20 = load i32, i32* %9
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 32
br i1 %25, label %26, label %30
26: ; preds = %19
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %6
%28 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%29 = call i32 @strcpy(i8* %28, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %42
30: ; preds = %19
%31 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%32 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%33 = call i32 @strcpy(i8* %31, i8* %32)
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
%36 = load i32, i32* %6
%37 = load i32, i32* %5
%38 = icmp sge i32 %36, %37
br i1 %38, label %39, label %41
39: ; preds = %30
%40 = load i32, i32* %6
store i32 %40, i32* %5
br label %41
41: ; preds = %39, %30
br label %42
42: ; preds = %41, %26
br label %43
43: ; preds = %42
%44 = load i32, i32* %9
%45 = add nsw i32 %44, 1
store i32 %45, i32* %9
br label %15
46: ; preds = %15
%47 = load i32, i32* %5
%48 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %47, i8* %48)
%50 = load i32, i32* %1
ret i32 %50
}

LLVM IR (-O2):
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [31 x i8] c"No de letras %i, Palabra: %s \0A\00"
@str = [22 x i8] c"INGRESA UN COMENTARIO\00"
@str.4 = [15 x i8] c"Hay un espacio\00"
define i32 @longestWord() {
%1 = alloca [80 x i8]
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%6 = call i32 @gets(i8* %3)
%7 = call i32 @strlen(i8* %3)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %31
9: ; preds = %0
%10 = zext i32 %7 to i64
br label %11
11: ; preds = %9, %26
%12 = phi i64 [ 0, %9 ], [ %29, %26 ]
%13 = phi i32 [ 0, %9 ], [ %28, %26 ]
%14 = phi i32 [ 0, %9 ], [ %27, %26 ]
%15 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %12
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 32
br i1 %17, label %18, label %21
18: ; preds = %11
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.4, i64 0, i64 0))
%20 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %26
21: ; preds = %11
%22 = call i32 @strcpy(i8* %4, i8* %3)
%23 = add nsw i32 %14, 1
%24 = icmp slt i32 %23, %13
%25 = select i1 %24, i32 %13, i32 %23
br label %26
26: ; preds = %21, %18
%27 = phi i32 [ 0, %18 ], [ %23, %21 ]
%28 = phi i32 [ %13, %18 ], [ %25, %21 ]
%29 = add nuw nsw i64 %12, 1
%30 = icmp eq i64 %29, %10
br i1 %30, label %31, label %11
31: ; preds = %26, %0
%32 = phi i32 [ 0, %0 ], [ %28, %26 ]
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %32, i8* %4)
ret i32 undef
}