#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 */
typedef int /*<<< orphan*/ str3;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main() {
  int i;
  char str1[10];
  char str2[10];
  char str3[] = "ASIGNADO EN LA DECLARACION";
  str1[0] = 'H';
  str1[1] = 'O';
  str1[2] = 76;
  str1[3] = 'A';
  str1[4] = '\0';
  for (i = 0; str1[i] != '\0'; i++) {
    printf("%c", str1[i]);
  }
  printf("\n");
  sprintf(str2, "CHAU");
  printf("El string str2 es: %s\n", str2);
  strcpy(str3, str1);
  printf("El string str3 es: %s la longitud es %d\n", str3, strlen(str3));
  printf("El tamaño de str3 es: %d \n", sizeof(str3));
  snprintf(str3, sizeof(str3), "%s como te va? %s", str1, str2);
  printf("El string str3 es: %s la longitud es %d\n", str3, strlen(str3));
  snprintf(str3, sizeof(str3), "%s como te va? %s Hasta la próxima", str1,
           str2);
  printf("El string str3 es: %s la longitud es %d\n", str3, strlen(str3));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe9a(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe97(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xe94(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe91(%rip),%ax
mov    %ax,-0x28(%rbp)
mov    0xe89(%rip),%al
mov    %al,-0x26(%rbp)
movb   $0x48,-0x12(%rbp)
movb   $0x4f,-0x11(%rbp)
movb   $0x4c,-0x10(%rbp)
movb   $0x41,-0xf(%rbp)
movb   $0x0,-0xe(%rbp)
movl   $0x0,-0x8(%rbp)
movslq -0x8(%rbp),%rax
movsbl -0x12(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11e6 <main+0x96>
movslq -0x8(%rbp),%rax
movsbl -0x12(%rbp,%rax,1),%esi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11af <main+0x5f>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x1c(%rbp),%rdi
lea    0xe1f(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x1c(%rbp),%rsi
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    -0x12(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x40(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x58(%rbp),%rsi
mov    %eax,%edx
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe14(%rip),%rdi
mov    $0x1b,%esi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    -0x12(%rbp),%rcx
lea    -0x1c(%rbp),%r8
mov    $0x1b,%esi
lea    0xe0c(%rip),%rdx
call   1060 <snprintf@plt>
lea    -0x40(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x50(%rbp),%rsi
mov    %eax,%edx
lea    0xda4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x40(%rbp),%rdi
lea    -0x12(%rbp),%rcx
lea    -0x1c(%rbp),%r8
mov    $0x1b,%esi
lea    0xddc(%rip),%rdx
call   1060 <snprintf@plt>
lea    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x48(%rbp),%rsi
mov    %eax,%edx
lea    0xd62(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x48,%rsp
movups 0xea9(%rip),%xmm0
movups %xmm0,0x2b(%rsp)
movaps 0xe92(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movl   $0x414c4f48,0xa(%rsp)
41
lea    0xb(%rsp),%rbx
movb   $0x0,0xe(%rsp)
mov    $0x48,%al
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1190 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x55414843,0x14(%rsp)
55
movb   $0x0,0x18(%rsp)
lea    0xe5f(%rip),%rdi
lea    0x14(%rsp),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x20(%rsp),%rbx
lea    0xa(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0xe43(%rip),%r12
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe56(%rip),%rdi
mov    $0x1b,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe5f(%rip),%rdx
mov    %rbx,%rdi
mov    $0x1b,%esi
mov    %r15,%rcx
mov    %r14,%r8
call   1070 <snprintf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe40(%rip),%rdx
mov    %rbx,%rdi
mov    $0x1b,%esi
mov    %r15,%rcx
mov    %r14,%r8
call   1070 <snprintf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.str3 = [27 x i8] c"ASIGNADO EN LA DECLARACION\00"
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [5 x i8] c"CHAU\00"
@.str.3 = [23 x i8] c"El string str2 es: %s\0A\00"
@.str.4 = [41 x i8] c"El string str3 es: %s la longitud es %d\0A\00"
@.str.5 = [28 x i8] c"El tama\C3\B1o de str3 es: %d \0A\00"
@.str.6 = [18 x i8] c"%s como te va? %s\00"
@.str.7 = [36 x i8] c"%s como te va? %s Hasta la pr\C3\B3xima\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i8]
%4 = alloca [10 x i8]
%5 = alloca [27 x i8]
store i32 0, i32* %1
%6 = bitcast [27 x i8]* %5 to i8*
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
store i8 72, i8* %7
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 1
store i8 79, i8* %8
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 2
store i8 76, i8* %9
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 3
store i8 65, i8* %10
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 4
store i8 0, i8* %11
store i32 0, i32* %2
br label %12
12: ; preds = %26, %0
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %29
19: ; preds = %12
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %19
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %12
29: ; preds = %12
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%31 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%32 = call i32 @sprintf(i8* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%33 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %33)
%35 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 0
%36 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%37 = call i32 @strcpy(i8* %35, i8* %36)
%38 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 0
%39 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 0
%40 = call i32 @strlen(i8* %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* %38, i32 %40)
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i64 27)
%43 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 0
%44 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%45 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%46 = call i32 @snprintf(i8* %43, i32 27, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8* %44, i8* %45)
%47 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 0
%48 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 0
%49 = call i32 @strlen(i8* %48)
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* %47, i32 %49)
%51 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 0
%52 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%53 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%54 = call i32 @snprintf(i8* %51, i32 27, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0), i8* %52, i8* %53)
%55 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 0
%56 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 0
%57 = call i32 @strlen(i8* %56)
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* %55, i32 %57)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str3 = [27 x i8] c"ASIGNADO EN LA DECLARACION\00"
@.str.2 = [5 x i8] c"CHAU\00"
@.str.3 = [23 x i8] c"El string str2 es: %s\0A\00"
@.str.4 = [41 x i8] c"El string str3 es: %s la longitud es %d\0A\00"
@.str.5 = [28 x i8] c"El tama\C3\B1o de str3 es: %d \0A\00"
@.str.6 = [18 x i8] c"%s como te va? %s\00"
@.str.7 = [36 x i8] c"%s como te va? %s Hasta la pr\C3\B3xima\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [10 x i8]
%3 = alloca [27 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [27 x i8], [27 x i8]* %3, i64 0, i64 0
store i8 72, i8* %4
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 1
store i8 79, i8* %7
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 2
store i8 76, i8* %8
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 3
store i8 65, i8* %9
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 4
store i8 0, i8* %10
br label %11
11: ; preds = %0, %11
%12 = phi i64 [ 0, %0 ], [ %16, %11 ]
%13 = phi i8 [ 72, %0 ], [ %18, %11 ]
%14 = sext i8 %13 to i32
%15 = tail call i32 @putchar(i32 %14)
%16 = add nuw i64 %12, 1
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %11
20: ; preds = %11
%21 = tail call i32 @putchar(i32 10)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i8* %5)
%23 = call i32 @strcpy(i8* %6, i8* %4)
%24 = call i32 @strlen(i8* %6)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* %6, i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i64 27)
%27 = call i32 @snprintf(i8* %6, i32 27, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i8* %4, i8* %5)
%28 = call i32 @strlen(i8* %6)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* %6, i32 %28)
%30 = call i32 @snprintf(i8* %6, i32 27, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0), i8* %4, i8* %5)
%31 = call i32 @strlen(i8* %6)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* %6, i32 %31)
ret i32 0
}