#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*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  int i;
  char string1[200], string2[50], string3[10] = "acabou";
  for (i = 0; i < 1; i++) {
    printf("digite uma palavra :");
    gets(string2);
    strcpy(string1, string2);
  }
  for (i = 0; strcmp(string2, string3) != 0; i++) {
    printf("digite uma palavra");
    gets(string2);
    if (strcmp(string2, string3) == 0) {
      continue;
    }
    strcat(string1, " ");
    strcat(string1, string2);
  }
  printf("voce digitou %d pavavras\n", i);
  printf("a frase montada ficou \n%s", string1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe97(%rip),%rax
mov    %rax,-0x11a(%rbp)
mov    0xe91(%rip),%ax
mov    %ax,-0x112(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    11ca <main+0x7a>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x110(%rbp),%rdi
call   1060 <gets@plt>
lea    -0xd0(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1185 <main+0x35>
movl   $0x0,-0x8(%rbp)
lea    -0x110(%rbp),%rdi
lea    -0x11a(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     125e <main+0x10e>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x110(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x110(%rbp),%rdi
lea    -0x11a(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    122a <main+0xda>
jmp    1250 <main+0x100>
lea    -0xd0(%rbp),%rdi
lea    0xdfa(%rip),%rsi
call   1070 <strcat@plt>
lea    -0xd0(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d1 <main+0x81>
mov    -0x8(%rbp),%esi
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xd0(%rbp),%rsi
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
movabs $0x756f62616361,%rax
mov    %rax,(%rsp)
movw   $0x0,0x8(%rsp)
lea    0xe8d(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
call   1060 <gets@plt>
lea    0x50(%rsp),%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
mov    %rsp,%rsi
mov    %rbp,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     121d <main+0xcd>
lea    0xe68(%rip),%r14
lea    0x10(%rsp),%r15
mov    %rsp,%r12
lea    0xe6c(%rip),%r13
lea    0x50(%rsp),%rbp
xor    %ebx,%ebx
jmp    11e3 <main+0x93>
nop
add    $0x1,%ebx
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     121d <main+0xcd>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
call   1060 <gets@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11d0 <main+0x80>
mov    %rbp,%rdi
mov    %r13,%rsi
call   1070 <strcat@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1070 <strcat@plt>
jmp    11d0 <main+0x80>
lea    0xe10(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe1a(%rip),%rdi
lea    0x50(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.string3 = [10 x i8] c"acabou\00\00\00\00"
@.str = [21 x i8] c"digite uma palavra :\00"
@.str.1 = [19 x i8] c"digite uma palavra\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [26 x i8] c"voce digitou %d pavavras\0A\00"
@.str.4 = [26 x i8] c"a frase montada ficou \0A%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [200 x i8]
%4 = alloca [50 x i8]
%5 = alloca [10 x i8]
store i32 0, i32* %1
%6 = bitcast [10 x i8]* %5 to i8*
store i32 0, i32* %2
br label %7
7: ; preds = %17, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 1
br i1 %9, label %10, label %20
10: ; preds = %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%13 = call i32 @gets(i8* %12)
%14 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%16 = call i32 @strcpy(i8* %14, i8* %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %7
20: ; preds = %7
store i32 0, i32* %2
br label %21
21: ; preds = %41, %20
%22 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%23 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%24 = call i64 @strcmp(i8* %22, i8* %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %44
26: ; preds = %21
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%28 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%29 = call i32 @gets(i8* %28)
%30 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%31 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%32 = call i64 @strcmp(i8* %30, i8* %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %26
br label %41
35: ; preds = %26
%36 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%37 = call i32 @strcat(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%38 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%39 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%40 = call i32 @strcat(i8* %38, i8* %39)
br label %41
41: ; preds = %35, %34
%42 = load i32, i32* %2
%43 = add nsw i32 %42, 1
store i32 %43, i32* %2
br label %21
44: ; preds = %21
%45 = load i32, i32* %2
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %45)
%47 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %47)
ret i32 0
}

LLVM IR (-O2):
@__const.main.string3 = [10 x i8] c"acabou\00\00\00\00"
@.str = [21 x i8] c"digite uma palavra :\00"
@.str.1 = [19 x i8] c"digite uma palavra\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [26 x i8] c"voce digitou %d pavavras\0A\00"
@.str.4 = [26 x i8] c"a frase montada ficou \0A%s\00"
define i32 @main() {
%1 = alloca [200 x i8]
%2 = alloca [50 x i8]
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @gets(i8* %5)
%9 = call i32 @strcpy(i8* %4, i8* %5)
%10 = call i64 @strcmp(i8* %5, i8* %6)
%11 = icmp eq i64 %10, 0
br i1 %11, label %25, label %12
12: ; preds = %0, %21
%13 = phi i32 [ %22, %21 ], [ 0, %0 ]
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @gets(i8* %5)
%16 = call i64 @strcmp(i8* %5, i8* %6)
%17 = icmp eq i64 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %12
%19 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 @strcat(i8* %4, i8* %5)
br label %21
21: ; preds = %12, %18
%22 = add nuw nsw i32 %13, 1
%23 = call i64 @strcmp(i8* %5, i8* %6)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %12
25: ; preds = %21, %0
%26 = phi i32 [ 0, %0 ], [ %22, %21 ]
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i8* %4)
ret i32 0
}