#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 str1[200], str2[200], strTot[2 * 200];
  int i, j;
  printf("Inserisci la prima stringa:\n");
  scanf("%s", str1);
  printf("Inserisci la seconda stringa:\n");
  scanf("%s", str2);
  for (i = 0; str1[i] != '\0'; i++)
    strTot[i] = str1[i];
  for (j = 0; str2[j] != '\0'; j++)
    strTot[i + j] = str2[j];
  strTot[i + j] = '\0';
  printf("\n%s", strTot);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xd0(%rbp),%rsi
lea    0xeef(%rip),%rdi
call   1040 <scanf@plt>
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x1a0(%rbp),%rsi
lea    0xece(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x334(%rbp)
movslq -0x334(%rbp),%rax
movsbl -0xd0(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     11c6 <main+0xa6>
movslq -0x334(%rbp),%rax
mov    -0xd0(%rbp,%rax,1),%cl
movslq -0x334(%rbp),%rax
mov    %cl,-0x330(%rbp,%rax,1)
mov    -0x334(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x334(%rbp)
jmp    117e <main+0x5e>
movl   $0x0,-0x338(%rbp)
movslq -0x338(%rbp),%rax
movsbl -0x1a0(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     121f <main+0xff>
movslq -0x338(%rbp),%rax
mov    -0x1a0(%rbp,%rax,1),%cl
mov    -0x334(%rbp),%eax
add    -0x338(%rbp),%eax
cltq
mov    %cl,-0x330(%rbp,%rax,1)
mov    -0x338(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x338(%rbp)
jmp    11d0 <main+0xb0>
mov    -0x334(%rbp),%eax
add    -0x338(%rbp),%eax
cltq
movb   $0x0,-0x330(%rbp,%rax,1)
lea    -0x330(%rbp),%rsi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x330,%rsp
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb6(%rip),%rbx
lea    0xd0(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xd0(%rsp),%dl
xor    %eax,%eax
mov    $0x0,%ecx
test   %dl,%dl
je     11a7 <main+0x77>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %dl,0x1a0(%rsp,%rcx,1)
movzbl 0xd1(%rsp,%rcx,1),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    1190 <main+0x60>
mov    (%rsp),%dl
mov    %ecx,%ecx
test   %dl,%dl
je     11d0 <main+0xa0>
lea    (%rsp,%rcx,1),%rsi
add    $0x1a0,%rsi
xor    %eax,%eax
nopl   (%rax)
mov    %dl,(%rsi,%rax,1)
movzbl 0x1(%rsp,%rax,1),%edx
add    $0x1,%rax
test   %dl,%dl
jne    11c0 <main+0x90>
mov    %eax,%eax
add    %rax,%rcx
movb   $0x0,0x1a0(%rsp,%rcx,1)
lea    0xe1c(%rip),%rdi
lea    0x1a0(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x330,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@.str.3 = [4 x i8] c"\0A%s\00"
@str = [28 x i8] c"Inserisci la prima stringa:\00"
@str.4 = [30 x i8] c"Inserisci la seconda stringa:\00"
define i32 @main() {
%1 = alloca [200 x i8]
%2 = alloca [200 x i8]
%3 = alloca [400 x i8]
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, 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)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.4, 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 = load i8, i8* %4
%12 = icmp eq i8 %11, 0
br i1 %12, label %15, label %21
13: ; preds = %21
%14 = trunc i64 %25 to i32
br label %15
15: ; preds = %13, %0
%16 = phi i32 [ 0, %0 ], [ %14, %13 ]
%17 = load i8, i8* %5
%18 = icmp eq i8 %17, 0
br i1 %18, label %40, label %19
19: ; preds = %15
%20 = zext i32 %16 to i64
br label %29
21: ; preds = %0, %21
%22 = phi i64 [ %25, %21 ], [ 0, %0 ]
%23 = phi i8 [ %27, %21 ], [ %11, %0 ]
%24 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 %22
store i8 %23, i8* %24
%25 = add nuw nsw i64 %22, 1
%26 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 0
br i1 %28, label %13, label %21
29: ; preds = %19, %29
%30 = phi i64 [ 0, %19 ], [ %34, %29 ]
%31 = phi i8 [ %17, %19 ], [ %36, %29 ]
%32 = add nuw nsw i64 %30, %20
%33 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 %32
store i8 %31, i8* %33
%34 = add nuw nsw i64 %30, 1
%35 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 0
br i1 %37, label %38, label %29
38: ; preds = %29
%39 = trunc i64 %34 to i32
br label %40
40: ; preds = %38, %15
%41 = phi i32 [ 0, %15 ], [ %39, %38 ]
%42 = add nuw nsw i32 %41, %16
%43 = zext i32 %42 to i64
%44 = getelementptr inbounds [400 x i8], [400 x i8]* %3, i64 0, i64 %43
store i8 0, i8* %44
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %6)
ret i32 0
}