#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 /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char sree[10] = {0};
  char i = 0;
  printf("Enter the name: ");
  scanf("%s", sree);
  while (sree[i] != 0) {
    putchar(sree[i]);
    i++;
  }
  putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
movb   $0x0,-0xf(%rbp)
lea    0xe96(%rip),%rdi
call   1040 <printf@plt>
lea    -0xe(%rbp),%rsi
lea    0xe97(%rip),%rdi
call   1060 <scanf@plt>
movsbq -0xf(%rbp),%rax
movsbl -0xe(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11ae <main+0x6e>
movsbq -0xf(%rbp),%rax
movsbl -0xe(%rbp,%rax,1),%edi
call   1030 <putchar@plt>
mov    -0xf(%rbp),%al
add    $0x1,%al
mov    %al,-0xf(%rbp)
jmp    117f <main+0x3f>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movw   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0xeb5(%rip),%rdi
call   1040 <printf@plt>
lea    0xeba(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%al
test   %al,%al
je     1187 <main+0x57>
mov    $0x1,%bl
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putchar@plt>
movsbq %bl,%rbx
movzbl (%rsp,%rbx,1),%eax
add    $0x1,%bl
test   %al,%al
jne    1170 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"Enter the name: \00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %0, %7
%8 = phi i8 [ %14, %7 ], [ %5, %0 ]
%9 = phi i8 [ %11, %7 ], [ 0, %0 ]
%10 = call i32 @putchar(i8 signext %8)
%11 = add i8 %9, 1
%12 = sext i8 %11 to i64
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %7
16: ; preds = %7, %0
%17 = call i32 @putchar(i8 signext 10)
ret i32 0
}