#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 str_loc(char *, char *);
int main() {
  char str[50], s1[50], s2[50];
  scanf("%s", str);
  scanf("%s", s1);
  scanf("%s", s2);
  int n = str_loc(str, s1);
  char s3[50];
  int i = 0;
  for (; i < n; i++) {
    s3[i] = str[i];
  }
  s3[i] = '\0';
  printf("%s%s", s3, s2);
  while (str[i] != '\0') {
    printf("%c", str[i]);
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rsi
lea    0xeb5(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x80(%rbp),%rsi
lea    0xea5(%rip),%rdi
call   1050 <scanf@plt>
lea    -0xc0(%rbp),%rsi
lea    0xe92(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x40(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1040 <str_loc@plt>
mov    %eax,-0xc4(%rbp)
movl   $0x0,-0x104(%rbp)
mov    -0x104(%rbp),%eax
cmp    -0xc4(%rbp),%eax
jge    11d1 <main+0xa1>
movslq -0x104(%rbp),%rax
mov    -0x40(%rbp,%rax,1),%cl
movslq -0x104(%rbp),%rax
mov    %cl,-0x100(%rbp,%rax,1)
mov    -0x104(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x104(%rbp)
jmp    1192 <main+0x62>
movslq -0x104(%rbp),%rax
movb   $0x0,-0x100(%rbp,%rax,1)
lea    -0x100(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x104(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     123f <main+0x10f>
movslq -0x104(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%esi
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x104(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x104(%rbp)
jmp    11fc <main+0xcc>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
lea    0xe9f(%rip),%rbx
lea    0x40(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <scanf@plt>
lea    0xc0(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <scanf@plt>
lea    0x80(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <str_loc@plt>
test   %eax,%eax
jle    11b9 <main+0x69>
mov    %eax,%ebx
mov    %rsp,%rdi
lea    0x40(%rsp),%rsi
mov    %rbx,%rdx
call   1060 <memcpy@plt>
jmp    11bb <main+0x6b>
xor    %ebx,%ebx
movb   $0x0,(%rsp,%rbx,1)
lea    0xe3a(%rip),%rdi
mov    %rsp,%rsi
lea    0x80(%rsp),%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x40(%rsp,%rbx,1),%al
test   %al,%al
je     1203 <main+0xb3>
add    %r14,%rbx
add    $0x1,%rbx
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    11f0 <main+0xa0>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"%s%s\00"
@.str.2 = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
%3 = alloca [50 x i8]
%4 = alloca [50 x i8]
%5 = alloca i32
%6 = alloca [50 x i8]
%7 = alloca i32
store i32 0, i32* %1
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%16 = call i32 @str_loc(i8* %14, i8* %15)
store i32 %16, i32* %5
store i32 0, i32* %7
br label %17
17: ; preds = %29, %0
%18 = load i32, i32* %7
%19 = load i32, i32* %5
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %32
21: ; preds = %17
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 %27
store i8 %25, i8* %28
br label %29
29: ; preds = %21
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
store i32 %31, i32* %7
br label %17
32: ; preds = %17
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 %34
store i8 0, i8* %35
%36 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%37 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %36, i8* %37)
br label %39
39: ; preds = %46, %32
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %55
46: ; preds = %39
%47 = load i32, i32* %7
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 %48
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %51)
%53 = load i32, i32* %7
%54 = add nsw i32 %53, 1
store i32 %54, i32* %7
br label %39
55: ; preds = %39
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"%s%s\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = alloca [50 x i8]
%3 = alloca [50 x i8]
%4 = alloca [50 x i8]
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
%11 = call i32 @str_loc(i8* %5, i8* %6)
%12 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%13 = icmp sgt i32 %11, 0
br i1 %13, label %14, label %19
14: ; preds = %0
%15 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%17 = zext i32 %11 to i64
%18 = zext i32 %11 to i64
br label %19
19: ; preds = %14, %0
%20 = phi i64 [ 0, %0 ], [ %18, %14 ]
%21 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 %20
store i8 0, i8* %21
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %12, i8* %7)
%23 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %20
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 0
br i1 %25, label %35, label %26
26: ; preds = %19, %26
%27 = phi i64 [ %31, %26 ], [ %20, %19 ]
%28 = phi i8 [ %33, %26 ], [ %24, %19 ]
%29 = sext i8 %28 to i32
%30 = call i32 @putchar(i32 %29)
%31 = add nuw i64 %27, 1
%32 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 0
br i1 %34, label %35, label %26
35: ; preds = %26, %19
ret i32 0
}