#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(void) {
  char text1[15], text2[15], text3[15], text4[15];
  printf("String 1: ");
  scanf("%s", text1);
  printf("String 2: ");
  scanf("%s", text2);
  printf("String 3: ");
  scanf("%s", text3);
  printf("String 4: ");
  scanf("%s", text4);
  printf("** \"Output\" **\n");
  printf("%.3s\n%.4s\n%.5s\n%.6s\n", text1, text2, text3, text4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x13(%rbp),%rsi
lea    0xec3(%rip),%rdi
call   1040 <scanf@plt>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x22(%rbp),%rsi
lea    0xea5(%rip),%rdi
call   1040 <scanf@plt>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x31(%rbp),%rsi
lea    0xe87(%rip),%rdi
call   1040 <scanf@plt>
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xe69(%rip),%rdi
call   1040 <scanf@plt>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x13(%rbp),%rsi
lea    -0x22(%rbp),%rdx
lea    -0x31(%rbp),%rcx
lea    -0x40(%rbp),%r8
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x40,%rsp
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb9(%rip),%rbx
lea    0x31(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x22(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x13(%rsp),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%r13
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
lea    0xe60(%rip),%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %r13,%r8
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"String 1: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [11 x i8] c"String 2: \00"
@.str.3 = [11 x i8] c"String 3: \00"
@.str.4 = [11 x i8] c"String 4: \00"
@.str.5 = [16 x i8] c"** \22Output\22 **\0A\00"
@.str.6 = [21 x i8] c"%.3s\0A%.4s\0A%.5s\0A%.6s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8]
%3 = alloca [15 x i8]
%4 = alloca [15 x i8]
%5 = alloca [15 x i8]
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [15 x i8], [15 x i8]* %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* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%10 = getelementptr inbounds [15 x i8], [15 x i8]* %3, 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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%13 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%16 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
%19 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%20 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%21 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%22 = getelementptr inbounds [15 x i8], [15 x i8]* %5, i64 0, i64 0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %19, i8* %20, i8* %21, i8* %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"String 1: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [11 x i8] c"String 2: \00"
@.str.3 = [11 x i8] c"String 3: \00"
@.str.4 = [11 x i8] c"String 4: \00"
@.str.6 = [21 x i8] c"%.3s\0A%.4s\0A%.5s\0A%.6s\0A\00"
@str = [15 x i8] c"** \22Output\22 **\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca [15 x i8]
%3 = alloca [15 x i8]
%4 = alloca [15 x i8]
%5 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [15 x i8], [15 x i8]* %4, i64 0, i64 0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %5, i8* %6, i8* %7, i8* %8)
ret i32 0
}