#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*/ fgets(char *, int, int /*<<< orphan*/);
char getchar();
int /*<<< orphan*/ insert(char *, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, char *, char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ ungetc(char, int /*<<< orphan*/);
int main(void) {
  char c, buf[20];
  char str[11], substr[4], result[16];
  int largest, i;
  while ((c = getchar()) != '\n') {
    ungetc(c, stdin);
    fgets(buf, 14, stdin);
    sscanf(buf, "%s %s", str, substr);
    insert(str, substr, result);
    printf("%s\n", result);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
cmp    $0xa,%eax
je     11ee <main+0x8e>
mov    -0x5(%rbp),%al
mov    0x2e59(%rip),%rcx
mov    (%rcx),%esi
movsbl %al,%edi
call   1060 <ungetc@plt>
lea    -0x20(%rbp),%rdi
mov    0x2e44(%rip),%rax
mov    (%rax),%edx
mov    $0xe,%esi
call   1040 <fgets@plt>
lea    -0x20(%rbp),%rdi
lea    -0x2b(%rbp),%rdx
lea    -0x2f(%rbp),%rcx
lea    0xe3d(%rip),%rsi
call   1070 <sscanf@plt>
lea    -0x2b(%rbp),%rdi
lea    -0x2f(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1080 <insert@plt>
lea    -0x40(%rbp),%rsi
lea    0xe22(%rip),%rdi
call   1030 <printf@plt>
jmp    116f <main+0xf>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     11f4 <main+0x94>
mov    0x2e68(%rip),%r14
lea    0x20(%rsp),%r15
lea    0x5(%rsp),%r12
lea    0x1(%rsp),%r13
lea    0x10(%rsp),%rbx
lea    0xe6b(%rip),%rbp
nopl   0x0(%rax,%rax,1)
mov    (%r14),%esi
movsbl %al,%edi
call   1060 <ungetc@plt>
mov    (%r14),%edx
mov    %r15,%rdi
mov    $0xe,%esi
call   1040 <fgets@plt>
mov    %r15,%rdi
lea    0xe3b(%rip),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1070 <sscanf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1080 <insert@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    11a0 <main+0x40>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [6 x i8] c"%s %s\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca [20 x i8]
%4 = alloca [11 x i8]
%5 = alloca [4 x i8]
%6 = alloca [16 x i8]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
br label %9
9: ; preds = %13, %0
%10 = call signext i8 (...) @getchar()
store i8 %10, i8* %2
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 10
br i1 %12, label %13, label %30
13: ; preds = %9
%14 = load i8, i8* %2
%15 = load i32, i32* @stdin
%16 = call i32 @ungetc(i8 signext %14, i32 %15)
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%18 = load i32, i32* @stdin
%19 = call i32 @fgets(i8* %17, i32 14, i32 %18)
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%21 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%23 = call i32 @sscanf(i8* %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %21, i8* %22)
%24 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%26 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%27 = call i32 @insert(i8* %24, i8* %25, i8* %26)
%28 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %28)
br label %9
30: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [6 x i8] c"%s %s\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [11 x i8]
%3 = alloca [4 x i8]
%4 = alloca [16 x i8]
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%9 = call signext i8 (...) @getchar()
%10 = icmp eq i8 %9, 10
br i1 %10, label %22, label %11
11: ; preds = %0, %11
%12 = phi i8 [ %20, %11 ], [ %9, %0 ]
%13 = load i32, i32* @stdin
%14 = call i32 @ungetc(i8 signext %12, i32 %13)
%15 = load i32, i32* @stdin
%16 = call i32 @fgets(i8* %5, i32 14, i32 %15)
%17 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7)
%18 = call i32 @insert(i8* %6, i8* %7, i8* %8)
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%20 = call signext i8 (...) @getchar()
%21 = icmp eq i8 %20, 10
br i1 %21, label %22, label %11
22: ; preds = %11, %0
ret i32 0
}