#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 longitud_string(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  char string1[] = "Hola a todos";
  char string2[200];
  printf("cadena: %s\n", string1);
  printf("longitud cadena: %d\n", longitud_string(string1));
  strcpy(string2, "leer libros y revistas");
  printf("cadena2: %s\n", string2);
  printf("longitud cadena: %d\n", longitud_string(string2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x11(%rbp)
mov    0xeb5(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xeb0(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x11(%rbp),%rsi
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x11(%rbp),%rdi
call   1050 <longitud_string@plt>
mov    %eax,%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xe0(%rbp),%rdi
lea    0xe96(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0xe0(%rbp),%rsi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xe0(%rbp),%rdi
call   1050 <longitud_string@plt>
mov    %eax,%esi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0xd8,%rsp
movabs $0x736f646f742061,%rax
mov    %rax,0x5(%rsp)
movabs $0x74206120616c6f48,%rax
61 20 74
mov    %rax,(%rsp)
lea    0xeaf(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <longitud_string@plt>
lea    0xe9f(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea1(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xea4(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <longitud_string@plt>
mov    %r14,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.string1 = [13 x i8] c"Hola a todos\00"
@.str = [12 x i8] c"cadena: %s\0A\00"
@.str.1 = [21 x i8] c"longitud cadena: %d\0A\00"
@.str.2 = [23 x i8] c"leer libros y revistas\00"
@.str.3 = [13 x i8] c"cadena2: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x i8]
%3 = alloca [200 x i8]
store i32 0, i32* %1
%4 = bitcast [13 x i8]* %2 to i8*
%5 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%8 = call i32 @longitud_string(i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%12 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%15 = call i32 @longitud_string(i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %15)
ret i32 0
}

LLVM IR (-O2):
@__const.main.string1 = [13 x i8] c"Hola a todos\00"
@.str = [12 x i8] c"cadena: %s\0A\00"
@.str.1 = [21 x i8] c"longitud cadena: %d\0A\00"
@.str.2 = [23 x i8] c"leer libros y revistas\00"
@.str.3 = [13 x i8] c"cadena2: %s\0A\00"
define i32 @main() {
%1 = alloca [13 x i8]
%2 = alloca [200 x i8]
%3 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = call i32 @longitud_string(i8* %3)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%10 = call i32 @longitud_string(i8* %4)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}