#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 */
scalar_t__ EOF;
int longitud_string(char *);
int /*<<< orphan*/ printf(char *, char *, int);
scalar_t__ scanf(char *, char *);
int main(void) {
  char input[1000];
  while (scanf("%s", input) != EOF) {
    printf("%s es el string con longitud %d \n", input, longitud_string(input));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rsi
lea    0xeb0(%rip),%rdi
call   1040 <scanf@plt>
mov    0x2e8c(%rip),%rcx
cmp    (%rcx),%rax
je     1199 <main+0x69>
lea    -0x3f0(%rbp),%rax
mov    %rax,-0x3f8(%rbp)
lea    -0x3f0(%rbp),%rdi
call   1050 <longitud_string@plt>
mov    -0x3f8(%rbp),%rsi
mov    %eax,%edx
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x3e8,%rsp
lea    0xebb(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    0x2e94(%rip),%r12
cmp    (%r12),%rax
je     1196 <main+0x66>
mov    %rsp,%rbx
lea    0xe9f(%rip),%r14
lea    0xe95(%rip),%r15
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    (%r12),%rax
jne    1170 <main+0x40>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.1 = [34 x i8] c"%s es el string con longitud %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %8, %0
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%5 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i64, i64* @EOF
%7 = icmp ne i64 %5, %6
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%11 = call i32 @longitud_string(i8* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %9, i32 %11)
br label %3
13: ; preds = %3
ret i32 0
}

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