#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 *);
int strlen(char *);
main() {
  char palavra[15] = "", concat[25] = "";
  int numpalavras = 0;
inicio:
  printf("\nDigite uma palavra: ");
  gets(palavra);
  if (strlen(palavra) > 12) {
    printf("\nPalavra excede limite de 12 caracteres.");
    goto inicio;
  } else {
    strcat(concat, palavra);
    numpalavras++;
    if (numpalavras == 2)
      printf("\nConcatenacao: %s", concat);
    else
      goto inicio;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x13(%rbp),%rdi
xor    %esi,%esi
mov    $0xf,%edx
call   1050 <memset@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x19,%edx
call   1050 <memset@plt>
movl   $0x0,-0x34(%rbp)
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x13(%rbp),%rdi
call   1060 <gets@plt>
lea    -0x13(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0xc,%eax
jle    11c2 <main+0x72>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1186 <main+0x36>
lea    -0x30(%rbp),%rdi
lea    -0x13(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x2,-0x34(%rbp)
jne    11f9 <main+0xa9>
lea    -0x30(%rbp),%rsi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11fe <main+0xae>
jmp    1186 <main+0x36>
jmp    1203 <main+0xb3>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
movq   $0x0,0x7(%rsp)
movq   $0x0,(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x19(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0xd,%eax
jl     11c9 <main+0x89>
lea    0xe82(%rip),%r14
lea    0xe65(%rip),%r15
mov    %rsp,%rbx
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0xc,%eax
jg     11a0 <main+0x60>
lea    0x10(%rsp),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1060 <strcat@plt>
lea    0xe20(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0xd,%eax
jl     1239 <main+0xf9>
lea    0xe13(%rip),%r14
lea    0xdf6(%rip),%r15
mov    %rsp,%rbx
nopl   (%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0xc,%eax
jg     1210 <main+0xd0>
lea    0x10(%rsp),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1060 <strcat@plt>
lea    0xdef(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"\0ADigite uma palavra: \00"
@.str.1 = [41 x i8] c"\0APalavra excede limite de 12 caracteres.\00"
@.str.2 = [18 x i8] c"\0AConcatenacao: %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8]
%3 = alloca [25 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [15 x i8]* %2 to i8*
%6 = bitcast [25 x i8]* %3 to i8*
store i32 0, i32* %4
br label %7
7: ; preds = %27, %14, %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%10 = call i32 @gets(i8* %9)
%11 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = icmp sgt i32 %12, 12
br i1 %13, label %14, label %16
14: ; preds = %7
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
br label %7
16: ; preds = %7
%17 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 0
%18 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%19 = call i32 @strcat(i8* %17, i8* %18)
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 2
br i1 %23, label %24, label %27
24: ; preds = %16
%25 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %25)
br label %28
27: ; preds = %16
br label %7
28: ; preds = %24
br label %29
29: ; preds = %28
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
@.str = [22 x i8] c"\0ADigite uma palavra: \00"
@.str.1 = [41 x i8] c"\0APalavra excede limite de 12 caracteres.\00"
@.str.2 = [18 x i8] c"\0AConcatenacao: %s\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca [25 x i8]
%3 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(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, 12
br i1 %8, label %9, label %15
9: ; preds = %0, %9
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @gets(i8* %3)
%13 = call i32 @strlen(i8* %3)
%14 = icmp sgt i32 %13, 12
br i1 %14, label %9, label %15
15: ; preds = %9, %0
%16 = call i32 @strcat(i8* %4, i8* %3)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @gets(i8* %3)
%19 = call i32 @strlen(i8* %3)
%20 = icmp sgt i32 %19, 12
br i1 %20, label %21, label %27
21: ; preds = %15, %21
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @gets(i8* %3)
%25 = call i32 @strlen(i8* %3)
%26 = icmp sgt i32 %25, 12
br i1 %26, label %21, label %27
27: ; preds = %21, %15
%28 = call i32 @strcat(i8* %4, i8* %3)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %4)
ret i32 0
}