#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, int, ...);
int /*<<< orphan*/ sscanf(char *, char *, char *, int *);
int /*<<< orphan*/ stdin;
int strcmp(char *, char *);
int strnlen(char *, int);
int main() {
  char str[64];
  int n = 64;
  char name[10];
  int age;
  fgets(str, n, stdin);
  n = strnlen(str, 64);
  printf("%s %d \n\n", str, n);
  sscanf(str, "%s %d", name, &age);
  n = strcmp(name, "Milton");
  printf("name: %s age: %d es: %d", name, age, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x40,-0x54(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x54(%rbp),%esi
mov    0x2e74(%rip),%rax
mov    (%rax),%edx
call   1050 <fgets@plt>
lea    -0x50(%rbp),%rdi
mov    $0x40,%esi
call   1040 <strnlen@plt>
mov    %eax,-0x54(%rbp)
lea    -0x50(%rbp),%rsi
mov    -0x54(%rbp),%edx
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
lea    -0x5e(%rbp),%rdx
lea    0xe59(%rip),%rsi
lea    -0x64(%rbp),%rcx
call   1070 <sscanf@plt>
lea    -0x5e(%rbp),%rdi
lea    0xe4b(%rip),%rsi
call   1060 <strcmp@plt>
mov    %eax,-0x54(%rbp)
lea    -0x5e(%rbp),%rsi
mov    -0x64(%rbp),%edx
mov    -0x54(%rbp),%ecx
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    0x2e8a(%rip),%rax
mov    (%rax),%edx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x40,%esi
call   1050 <fgets@plt>
mov    %rbx,%rdi
mov    $0x40,%esi
call   1040 <strnlen@plt>
lea    0xe7a(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe70(%rip),%rsi
lea    0x6(%rsp),%r14
mov    %rsp,%rcx
mov    %rbx,%rdi
mov    %r14,%rdx
call   1070 <sscanf@plt>
lea    0xe5c(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcmp@plt>
mov    (%rsp),%edx
lea    0xe51(%rip),%rdi
mov    %r14,%rsi
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [9 x i8] c"%s %d \0A\0A\00"
@.str.1 = [6 x i8] c"%s %d\00"
@.str.2 = [7 x i8] c"Milton\00"
@.str.3 = [24 x i8] c"name: %s age: %d es: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [64 x i8]
%3 = alloca i32
%4 = alloca [10 x i8]
%5 = alloca i32
store i32 0, i32* %1
store i32 64, i32* %3
%6 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* %3
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %6, i32 %7, i32 %8)
%10 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%11 = call i32 @strnlen(i8* %10, i32 64)
store i32 %11, i32* %3
%12 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%13 = load i32, i32* %3
%14 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %12, i32 %13)
%15 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%17 = call i32 @sscanf(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %16, i32* %5)
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 %19, i32* %3
%20 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%21 = load i32, i32* %5
%22 = load i32, i32* %3
%23 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %20, i32 %21, i32 %22)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [9 x i8] c"%s %d \0A\0A\00"
@.str.1 = [6 x i8] c"%s %d\00"
@.str.2 = [7 x i8] c"Milton\00"
@.str.3 = [24 x i8] c"name: %s age: %d es: %d\00"
define i32 @main() {
%1 = alloca [64 x i8]
%2 = alloca [10 x i8]
%3 = alloca i32
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = bitcast i32* %3 to i8*
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %4, i32 64, i32 %7)
%9 = call i32 @strnlen(i8* %4, i32 64)
%10 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %9)
%11 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %5, i32* %3)
%12 = call i32 @strcmp(i8* %5, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* %3
%14 = call i32 (i8*, i8*, i32, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %5, i32 %13, i32 %12)
ret i32 0
}