#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*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int main() {
  char acStr1[30], acStr2[30];
  char acStr3[30], acStr4[30];
  int i, iLen;
  printf("\nEnter the String\n");
  gets(acStr1);
  for (i = 0; acStr1[i] != '\0'; i++) {
    acStr2[i] = acStr1[i];
  }
  acStr2[i] = '\0';
  printf("\nCopied String\n");
  puts(acStr2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1050 <gets@plt>
movl   $0x0,-0x94(%rbp)
movslq -0x94(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11a0 <main+0x70>
movslq -0x94(%rbp),%rax
mov    -0x30(%rbp,%rax,1),%cl
movslq -0x94(%rbp),%rax
mov    %cl,-0x50(%rbp,%rax,1)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1161 <main+0x31>
movslq -0x94(%rbp),%rax
movb   $0x0,-0x50(%rbp,%rax,1)
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
lea    0x20(%rsp),%rdi
call   1040 <gets@plt>
mov    0x20(%rsp),%al
test   %al,%al
je     1164 <main+0x44>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %al,(%rsp,%rcx,1)
movzbl 0x21(%rsp,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1150 <main+0x30>
mov    %ecx,%eax
jmp    1166 <main+0x46>
xor    %eax,%eax
movb   $0x0,(%rsp,%rax,1)
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"\0AEnter the String\0A\00"
@.str.1 = [16 x i8] c"\0ACopied String\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x i8]
%3 = alloca [30 x i8]
%4 = alloca [30 x i8]
%5 = alloca [30 x i8]
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%10 = call i32 @gets(i8* %9)
store i32 0, i32* %6
br label %11
11: ; preds = %26, %0
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %29
18: ; preds = %11
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 %24
store i8 %22, i8* %25
br label %26
26: ; preds = %18
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %11
29: ; preds = %11
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 %31
store i8 0, i8* %32
%33 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%34 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%35 = call i32 @puts(i8* %34)
ret i32 0
}

LLVM IR (-O2):
@str = [18 x i8] c"\0AEnter the String\00"
@str.2 = [15 x i8] c"\0ACopied String\00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = alloca [30 x i8]
%3 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%6 = call i32 @gets(i8* %3)
%7 = load i8, i8* %3
%8 = icmp eq i8 %7, 0
br i1 %8, label %19, label %9
9: ; preds = %0, %9
%10 = phi i64 [ %13, %9 ], [ 0, %0 ]
%11 = phi i8 [ %15, %9 ], [ %7, %0 ]
%12 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %10
store i8 %11, i8* %12
%13 = add nuw nsw i64 %10, 1
%14 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %9
17: ; preds = %9
%18 = and i64 %13, 4294967295
br label %19
19: ; preds = %17, %0
%20 = phi i64 [ 0, %0 ], [ %18, %17 ]
%21 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 %20
store i8 0, i8* %21
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.2, i64 0, i64 0))
%23 = call i32 @puts(i8* %4)
ret i32 0
}