#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*/ system(char *);
int main01(void) {
  char src[] = "abcedfdgds";
  char dst[100] = {0};
  int i = 0;
  for (i = 0; src[i] != '\0'; i++) {
    dst[i] = src[i];
  }
  dst[i] = 0;
  printf("%s\n", dst);
  printf("\n");
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main01>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    0xebe(%rip),%rax
mov    %rax,-0xb(%rbp)
mov    0xebb(%rip),%ax
mov    %ax,-0x3(%rbp)
mov    0xeb3(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x74(%rbp)
movslq -0x74(%rbp),%rax
movsbl -0xb(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     11a8 <main01+0x78>
movslq -0x74(%rbp),%rax
mov    -0xb(%rbp,%rax,1),%cl
movslq -0x74(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1178 <main01+0x48>
movslq -0x74(%rbp),%rax
movb   $0x0,-0x70(%rbp,%rax,1)
lea    -0x70(%rbp),%rsi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe37(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main01>:
sub    $0x68,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0x54(%rsp)
movups %xmm0,0x4a(%rsp)
movups %xmm0,0x3a(%rsp)
movups %xmm0,0x2a(%rsp)
movups %xmm0,0x1a(%rsp)
movups %xmm0,0xa(%rsp)
movabs $0x6764666465636261,%rax
66 64 67
mov    %rax,(%rsp)
movw   $0x7364,0x8(%rsp)
mov    %rsp,%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe88(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x68,%rsp
ret

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

LLVM IR (-O2):
@__const.main01.src = [11 x i8] c"abcedfdgds\00"
@.str.2 = [6 x i8] c"pause\00"
define i32 @main01() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 10
%5 = call i32 @puts(i8* %3)
%6 = tail call i32 @putchar(i32 10)
%7 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}