#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 main() {
  char texto[] = "VALERIA";
  char *p;
  int longitud = 0;
  p = texto;
  while (*p != '\0') {
    longitud++;
    printf("%c\n", *p);
    p++;
  }
  printf("La cadena \"%s\" tiene %i caracteres.\n", texto, longitud);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0xc(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1178 <main+0x68>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%esi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1139 <main+0x29>
lea    -0xc(%rbp),%rsi
mov    -0x1c(%rbp),%edx
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movabs $0x414952454c4156,%rax
mov    %rax,(%rsp)
mov    $0x56,%al
lea    0xed5(%rip),%r14
xor    %ebx,%ebx
nopl   (%rax)
movsbl %al,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movzbl 0x1(%rsp,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <main+0x20>
lea    0xeb3(%rip),%rdi
mov    %rsp,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.texto = [8 x i8] c"VALERIA\00"
@.str = [4 x i8] c"%c\0A\00"
@.str.1 = [37 x i8] c"La cadena \22%s\22 tiene %i caracteres.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i8]
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [8 x i8]* %2 to i8*
store i32 0, i32* %4
%6 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
store i8* %6, i8** %3
br label %7
7: ; preds = %12, %0
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %21
12: ; preds = %7
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 1
store i32 %14, i32* %4
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %3
br label %7
21: ; preds = %7
%22 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%23 = load i32, i32* %4
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %22, i32 %23)
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
@.str.1 = [37 x i8] c"La cadena \22%s\22 tiene %i caracteres.\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 18376491184963926, i64* %1
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %8, %3 ]
%5 = phi i8* [ %2, %0 ], [ %10, %3 ]
%6 = phi i8 [ 86, %0 ], [ %11, %3 ]
%7 = sext i8 %6 to i32
%8 = add nuw nsw i32 %4, 1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%10 = getelementptr inbounds i8, i8* %5, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %3
13: ; preds = %3
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i64* %1, i32 %8)
ret i32 0
}