#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*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main() {
  char orig[10 + 1] = "cadena";
  char copia[10 + 1];
  int i;
  for (i = 0; i <= 10; i++) {
    copia[i] = orig[i];
    if (copia[i] == '\0')
      break;
  }
  char orig1[10 + 1] = "CaDeNaL";
  char copia1[10 + 1];
  strcpy(copia1, orig1);
  printf("La cadena es: %s;\n", copia1);
  i = strlen(copia1);
  printf("La longuitud de la cadena es: %d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0xf(%rbp)
mov    0xeb7(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xeaf(%rip),%al
mov    %al,-0x5(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0xa,-0x20(%rbp)
jg     11a9 <main+0x79>
movslq -0x20(%rbp),%rax
mov    -0xf(%rbp,%rax,1),%cl
movslq -0x20(%rbp),%rax
mov    %cl,-0x1a(%rbp,%rax,1)
movslq -0x20(%rbp),%rax
movsbl -0x1a(%rbp,%rax,1),%eax
cmp    $0x0,%eax
jne    1196 <main+0x66>
jmp    11a9 <main+0x79>
jmp    119b <main+0x6b>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1165 <main+0x35>
mov    0xe5b(%rip),%rax
mov    %rax,-0x2b(%rbp)
mov    0xe58(%rip),%ax
mov    %ax,-0x23(%rbp)
mov    0xe50(%rip),%al
mov    %al,-0x21(%rbp)
lea    -0x36(%rbp),%rdi
lea    -0x2b(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x36(%rbp),%rsi
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x36(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movabs $0x4c614e65446143,%rax
mov    %rax,0x8(%rsp)
movl   $0x0,0xf(%rsp)
lea    0x15(%rsp),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xea6(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xea0(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.orig = [11 x i8] c"cadena\00\00\00\00\00"
@__const.main.orig1 = [11 x i8] c"CaDeNaL\00\00\00\00"
@.str = [19 x i8] c"La cadena es: %s;\0A\00"
@.str.1 = [34 x i8] c"La longuitud de la cadena es: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i8]
%3 = alloca [11 x i8]
%4 = alloca i32
%5 = alloca [11 x i8]
%6 = alloca [11 x i8]
store i32 0, i32* %1
%7 = bitcast [11 x i8]* %2 to i8*
store i32 0, i32* %4
br label %8
8: ; preds = %27, %0
%9 = load i32, i32* %4
%10 = icmp sle i32 %9, 10
br i1 %10, label %11, label %30
11: ; preds = %8
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 %17
store i8 %15, i8* %18
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %11
br label %30
26: ; preds = %11
br label %27
27: ; preds = %26
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %8
30: ; preds = %25, %8
%31 = bitcast [11 x i8]* %5 to i8*
%32 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%33 = getelementptr inbounds [11 x i8], [11 x i8]* %5, i64 0, i64 0
%34 = call i32 @strcpy(i8* %32, i8* %33)
%35 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %35)
%37 = getelementptr inbounds [11 x i8], [11 x i8]* %6, i64 0, i64 0
%38 = call i32 @strlen(i8* %37)
store i32 %38, i32* %4
%39 = load i32, i32* %4
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %39)
ret i32 0
}

LLVM IR (-O2):
@__const.main.orig1 = [11 x i8] c"CaDeNaL\00\00\00\00"
@.str = [19 x i8] c"La cadena es: %s;\0A\00"
@.str.1 = [34 x i8] c"La longuitud de la cadena es: %d\0A\00"
define i32 @main() {
%1 = alloca [11 x i8]
%2 = alloca [11 x i8]
%3 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* %3)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %4)
%7 = call i32 @strlen(i8* %4)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 0
}