#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 *, char *, int);
int scanf(char *, char *);
int main(void) {
  char string1[] = "Hola a todos";
  char string2[200];
  while (scanf("%s", string2) == 1)
    printf("longitud %s:\t %d\n", string2, longitud_string(string2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%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    -0xe0(%rbp),%rsi
lea    0xea0(%rip),%rdi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    11af <main+0x7f>
lea    -0xe0(%rbp),%rax
mov    %rax,-0xe8(%rbp)
lea    -0xe0(%rbp),%rdi
call   1050 <longitud_string@plt>
mov    -0xe8(%rbp),%rsi
mov    %eax,%edx
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
jmp    115f <main+0x2f>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xd0,%rsp
lea    0xebd(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    1195 <main+0x65>
mov    %rsp,%rbx
lea    0xea9(%rip),%r14
lea    0xe9f(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <longitud_string@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
je     1170 <main+0x40>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.string1 = [13 x i8] c"Hola a todos\00"
@.str = [3 x i8] c"%s\00"
@.str.1 = [18 x i8] c"longitud %s:\09 %d\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*
br label %5
5: ; preds = %9, %0
%6 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%12 = call i32 @longitud_string(i8* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %10, i32 %12)
br label %5
14: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [18 x i8] c"longitud %s:\09 %d\0A\00"
define i32 @main() {
%1 = alloca [200 x i8]
%2 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %10
5: ; preds = %0, %5
%6 = call i32 @longitud_string(i8* %2)
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 %6)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%9 = icmp eq i32 %8, 1
br i1 %9, label %5, label %10
10: ; preds = %5, %0
ret i32 0
}