#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*/ scanf(char *, char *);
int main() {
  char *p1, *p2;
  char a[1000], b[1000];
  printf("ÇëÊäÈëµÚÒ»¸ö×Ö·û´®£º");
  scanf("%s", a);
  printf("ÇëÊäÈëµÚ¶þ¸ö×Ö·û´®£º");
  scanf("%s", b);
  p1 = a, p2 = b;
  while (*p1 != '\0')
    p1++;
  while (*p2 != '\0')
    *p1++ = *p2++;
  *p1 = '\0';
  printf("½á¹ûÎª£º%s", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7f0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x400(%rbp),%rsi
lea    0xf14(%rip),%rdi
call   1040 <scanf@plt>
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x7f0(%rbp),%rsi
lea    0xef3(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x400(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x7f0(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11ab <main+0x8b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    118a <main+0x6a>
jmp    11b0 <main+0x90>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11e7 <main+0xc7>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    11b0 <main+0x90>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x400(%rbp),%rsi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x7f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x7d8,%rsp
lea    0x3f0(%rsp),%rbx
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf1b(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rcx
add    $0x1,%rbx
cmpb   $0x0,(%rcx)
jne    1170 <main+0x50>
mov    (%rsp),%al
test   %al,%al
je     11a6 <main+0x86>
mov    $0xffffffffffffffff,%rcx
nopw   0x0(%rax,%rax,1)
mov    %al,(%rbx,%rcx,1)
movzbl 0x2(%rsp,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1190 <main+0x70>
add    %rcx,%rbx
mov    %rbx,%rcx
movb   $0x0,(%rcx)
lea    0xea2(%rip),%rdi
lea    0x3f0(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x7d8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [41 x i8] c"\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB\C2\B5\C3\9A\C3\92\C2\BB\C2\B8\C3\B6\C3\97\C3\96\C2\B7\C3\BB\C2\B4\C2\AE\C2\A3\C2\BA\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [41 x i8] c"\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB\C2\B5\C3\9A\C2\B6\C3\BE\C2\B8\C3\B6\C3\97\C3\96\C2\B7\C3\BB\C2\B4\C2\AE\C2\A3\C2\BA\00"
@.str.3 = [19 x i8] c"\C2\BD\C3\A1\C2\B9\C3\BB\C3\8E\C2\AA\C2\A3\C2\BA%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [1000 x i8]
%5 = alloca [1000 x i8]
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%10 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
store i8* %12, i8** %2
%13 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
store i8* %13, i8** %3
br label %14
14: ; preds = %19, %0
%15 = load i8*, i8** %2
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %2
br label %14
22: ; preds = %14
br label %23
23: ; preds = %28, %22
%24 = load i8*, i8** %3
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %34
28: ; preds = %23
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %3
%31 = load i8, i8* %29
%32 = load i8*, i8** %2
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %2
store i8 %31, i8* %32
br label %23
34: ; preds = %23
%35 = load i8*, i8** %2
store i8 0, i8* %35
%36 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %36)
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB\C2\B5\C3\9A\C3\92\C2\BB\C2\B8\C3\B6\C3\97\C3\96\C2\B7\C3\BB\C2\B4\C2\AE\C2\A3\C2\BA\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [41 x i8] c"\C3\87\C3\AB\C3\8A\C3\A4\C3\88\C3\AB\C2\B5\C3\9A\C2\B6\C3\BE\C2\B8\C3\B6\C3\97\C3\96\C2\B7\C3\BB\C2\B4\C2\AE\C2\A3\C2\BA\00"
@.str.3 = [19 x i8] c"\C2\BD\C3\A1\C2\B9\C3\BB\C3\8E\C2\AA\C2\A3\C2\BA%s\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca [1000 x i8]
%3 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
br label %9
9: ; preds = %9, %0
%10 = phi i8* [ %3, %0 ], [ %13, %9 ]
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
%13 = getelementptr inbounds i8, i8* %10, i64 1
br i1 %12, label %14, label %9
14: ; preds = %9
%15 = load i8, i8* %4
%16 = icmp eq i8 %15, 0
br i1 %16, label %25, label %17
17: ; preds = %14, %17
%18 = phi i8 [ %23, %17 ], [ %15, %14 ]
%19 = phi i8* [ %21, %17 ], [ %4, %14 ]
%20 = phi i8* [ %22, %17 ], [ %10, %14 ]
%21 = getelementptr inbounds i8, i8* %19, i64 1
%22 = getelementptr inbounds i8, i8* %20, i64 1
store i8 %18, i8* %20
%23 = load i8, i8* %21
%24 = icmp eq i8 %23, 0
br i1 %24, label %25, label %17
25: ; preds = %17, %14
%26 = phi i8* [ %10, %14 ], [ %22, %17 ]
store i8 0, i8* %26
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %3)
ret i32 0
}