#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ stdout;
int main(void) {
  char string1[20];
  char string2[] = "Juan Dela Cruz";
  int i;
  printf("Enter a string: ");
  fflush(stdout);
  scanf("%s", string1);
  printf("%s\n", string1);
  printf("%s\n", string2);
  for (i = 0; string1[i] != '\0'; i++) {
    printf("%c ", string1[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x2f(%rbp)
mov    0xeb8(%rip),%eax
mov    %eax,-0x27(%rbp)
mov    0xeb2(%rip),%ax
mov    %ax,-0x23(%rbp)
mov    0xeaa(%rip),%al
mov    %al,-0x21(%rbp)
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
lea    -0x20(%rbp),%rsi
lea    0xe92(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x20(%rbp),%rsi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x2f(%rbp),%rsi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11f5 <main+0xc5>
movslq -0x34(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%esi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11be <main+0x8e>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movabs $0x7a75724320616c,%rax
mov    %rax,0x7(%rsp)
movabs $0x6c6544206e61754a,%rax
44 65 6c
mov    %rax,(%rsp)
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
lea    0xe99(%rip),%rdi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
call   1030 <puts@plt>
mov    0x10(%rsp),%al
test   %al,%al
je     11d8 <main+0x98>
lea    0x11(%rsp),%rbx
lea    0xe6b(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsbl %al,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    11c0 <main+0x80>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.string2 = [15 x i8] c"Juan Dela Cruz\00"
@.str = [17 x i8] c"Enter a string: \00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [4 x i8] c"%c \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [15 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [15 x i8]* %3 to i8*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stdout
%8 = call i32 @fflush(i32 %7)
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %13)
store i32 0, i32* %4
br label %15
15: ; preds = %29, %0
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %32
22: ; preds = %15
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %22
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %15
32: ; preds = %15
ret i32 0
}

LLVM IR (-O2):
@__const.main.string2 = [15 x i8] c"Juan Dela Cruz\00"
@.str = [17 x i8] c"Enter a string: \00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"%s\00"
@.str.3 = [4 x i8] c"%c \00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [15 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @stdout
%7 = tail call i32 @fflush(i32 %6)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%9 = call i32 @puts(i8* %3)
%10 = call i32 @puts(i8* %4)
%11 = load i8, i8* %3
%12 = icmp eq i8 %11, 0
br i1 %12, label %22, label %13
13: ; preds = %0, %13
%14 = phi i64 [ %18, %13 ], [ 0, %0 ]
%15 = phi i8 [ %20, %13 ], [ %11, %0 ]
%16 = sext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = add nuw i64 %14, 1
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %22, label %13
22: ; preds = %13, %0
ret i32 0
}