#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 */
scalar_t__ compara(char *, char *);
int comprimento(char *);
int /*<<< orphan*/ concatena(char *, char *);
int /*<<< orphan*/ copia(char *, char *);
int /*<<< orphan*/ imprime(char *);
char *le_linha();
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  char *linha;
  char *s1 = "abc123";
  char *s2 = "aabb";
  char *s3 = "abc123aabb";
  char s4[11];
  imprime("Digite uma linha: \n");
  linha = le_linha();
  imprime(linha);
  printf("\n");
  printf("Teste das funcoes ...\n");
  if (comprimento(s1) != 6)
    printf("-> Erro tamanho de s1\n");
  if (comprimento(s2) != 4)
    printf("-> Erro tamanho de s2\n");
  if (comprimento(s3) != 10)
    printf("-> Erro tamanho de s3\n");
  copia(s4, s1);
  if (compara(s4, s1) != 0)
    printf("-> Erro na copia\n");
  concatena(s4, s2);
  if (compara(s4, s3) != 0)
    printf("-> Erro na concatenacao\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe73(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xe75(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xe64(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe64(%rip),%rdi
call   1060 <imprime@plt>
mov    $0x0,%al
call   1080 <le_linha@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <imprime@plt>
lea    0xe56(%rip),%rdi
call   1050 <printf@plt>
lea    0xe4c(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <comprimento@plt>
cmp    $0x6,%eax
je     11fd <main+0x8d>
lea    0xe45(%rip),%rdi
call   1050 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <comprimento@plt>
cmp    $0x4,%eax
je     121b <main+0xab>
lea    0xe3e(%rip),%rdi
call   1050 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1030 <comprimento@plt>
cmp    $0xa,%eax
je     1239 <main+0xc9>
lea    0xe37(%rip),%rdi
call   1050 <printf@plt>
lea    -0x3b(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <copia@plt>
lea    -0x3b(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1090 <compara@plt>
cmp    $0x0,%rax
je     1269 <main+0xf9>
lea    0xe1e(%rip),%rdi
call   1050 <printf@plt>
lea    -0x3b(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1070 <concatena@plt>
lea    -0x3b(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1090 <compara@plt>
cmp    $0x0,%rax
je     1299 <main+0x129>
lea    0xe00(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xe84(%rip),%rdi
call   1070 <imprime@plt>
xor    %eax,%eax
call   1090 <le_linha@plt>
mov    %rax,%rdi
call   1070 <imprime@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe73(%rip),%rdi
call   1040 <puts@plt>
lea    0xe41(%rip),%rdi
call   1050 <comprimento@plt>
cmp    $0x6,%eax
je     11d5 <main+0x55>
lea    0xec1(%rip),%rdi
call   1040 <puts@plt>
lea    0xe31(%rip),%rdi
call   1050 <comprimento@plt>
cmp    $0x4,%eax
je     11f2 <main+0x72>
lea    0xe8e(%rip),%rdi
call   1040 <puts@plt>
lea    0xe0e(%rip),%rdi
call   1050 <comprimento@plt>
cmp    $0xa,%eax
je     120f <main+0x8f>
lea    0xe5b(%rip),%rdi
call   1040 <puts@plt>
lea    0xdea(%rip),%r14
lea    0xd(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1060 <copia@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10a0 <compara@plt>
test   %rax,%rax
je     1242 <main+0xc2>
lea    0xe17(%rip),%rdi
call   1040 <puts@plt>
lea    0xdc4(%rip),%rsi
lea    0xd(%rsp),%rbx
mov    %rbx,%rdi
call   1080 <concatena@plt>
lea    0xdaa(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <compara@plt>
test   %rax,%rax
je     1276 <main+0xf6>
lea    0xdcb(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"abc123\00"
@.str.1 = [5 x i8] c"aabb\00"
@.str.2 = [11 x i8] c"abc123aabb\00"
@.str.3 = [20 x i8] c"Digite uma linha: \0A\00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [23 x i8] c"Teste das funcoes ...\0A\00"
@.str.6 = [23 x i8] c"-> Erro tamanho de s1\0A\00"
@.str.7 = [23 x i8] c"-> Erro tamanho de s2\0A\00"
@.str.8 = [23 x i8] c"-> Erro tamanho de s3\0A\00"
@.str.9 = [18 x i8] c"-> Erro na copia\0A\00"
@.str.10 = [25 x i8] c"-> Erro na concatenacao\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca [11 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %7
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %8
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %9
%11 = call i32 @imprime(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%12 = call i8* (...) @le_linha()
store i8* %12, i8** %6
%13 = load i8*, i8** %6
%14 = call i32 @imprime(i8* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
%17 = load i8*, i8** %7
%18 = call i32 @comprimento(i8* %17)
%19 = icmp ne i32 %18, 6
br i1 %19, label %20, label %22
20: ; preds = %2
%21 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
br label %22
22: ; preds = %20, %2
%23 = load i8*, i8** %8
%24 = call i32 @comprimento(i8* %23)
%25 = icmp ne i32 %24, 4
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
br label %28
28: ; preds = %26, %22
%29 = load i8*, i8** %9
%30 = call i32 @comprimento(i8* %29)
%31 = icmp ne i32 %30, 10
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
br label %34
34: ; preds = %32, %28
%35 = getelementptr inbounds [11 x i8], [11 x i8]* %10, i64 0, i64 0
%36 = load i8*, i8** %7
%37 = call i32 @copia(i8* %35, i8* %36)
%38 = getelementptr inbounds [11 x i8], [11 x i8]* %10, i64 0, i64 0
%39 = load i8*, i8** %7
%40 = call i64 @compara(i8* %38, i8* %39)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %34
%43 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
br label %44
44: ; preds = %42, %34
%45 = getelementptr inbounds [11 x i8], [11 x i8]* %10, i64 0, i64 0
%46 = load i8*, i8** %8
%47 = call i32 @concatena(i8* %45, i8* %46)
%48 = getelementptr inbounds [11 x i8], [11 x i8]* %10, i64 0, i64 0
%49 = load i8*, i8** %9
%50 = call i64 @compara(i8* %48, i8* %49)
%51 = icmp ne i64 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %44
%53 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0))
br label %54
54: ; preds = %52, %44
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"abc123\00"
@.str.1 = [5 x i8] c"aabb\00"
@.str.2 = [11 x i8] c"abc123aabb\00"
@.str.3 = [20 x i8] c"Digite uma linha: \0A\00"
@str = [22 x i8] c"Teste das funcoes ...\00"
@str.11 = [24 x i8] c"-> Erro na concatenacao\00"
@str.12 = [17 x i8] c"-> Erro na copia\00"
@str.13 = [22 x i8] c"-> Erro tamanho de s3\00"
@str.14 = [22 x i8] c"-> Erro tamanho de s2\00"
@str.15 = [22 x i8] c"-> Erro tamanho de s1\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [11 x i8]
%4 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @imprime(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i8* (...) @le_linha()
%7 = tail call i32 @imprime(i8* %6)
%8 = tail call i32 @putchar(i32 10)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @comprimento(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32 %10, 6
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.15, i64 0, i64 0))
br label %14
14: ; preds = %12, %2
%15 = tail call i32 @comprimento(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i32 %15, 4
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.14, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
%20 = tail call i32 @comprimento(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i32 %20, 10
br i1 %21, label %24, label %22
22: ; preds = %19
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.13, i64 0, i64 0))
br label %24
24: ; preds = %22, %19
%25 = call i32 @copia(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%26 = call i64 @compara(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %24
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.12, i64 0, i64 0))
br label %30
30: ; preds = %28, %24
%31 = call i32 @concatena(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%32 = call i64 @compara(i8* %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %30
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.11, i64 0, i64 0))
br label %36
36: ; preds = %34, %30
ret i32 0
}