#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(int argc, char **argv) {
  char a[30], b[30], c[60];
  int d, e, f;
  printf("Please enter a string up to 30 characters:");
  scanf(" %[0-9, ,A-z]s", a);
  printf("The string entered was : %s \n", a);
  d = strlen(a);
  printf("%d\n", d);
  printf("Please enter another string up to 30 characters:");
  scanf(" %[0-9, ,A-z]s", b);
  printf("The string entered was : %s \n", b);
  e = strlen(b);
  printf("%d\n", e);
  strcpy(c, a);
  strcat(c, b);
  printf("the string combined is : %s \n", c);
  f = strlen(c);
  printf("%d", f);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xea9(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x30(%rbp),%rsi
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x94(%rbp)
mov    -0x94(%rbp),%esi
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x50(%rbp),%rsi
lea    0xe56(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x50(%rbp),%rsi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x50(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x98(%rbp)
mov    -0x98(%rbp),%esi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x90(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x90(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1070 <strcat@plt>
lea    -0x90(%rbp),%rsi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x90(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x9c(%rbp)
mov    -0x9c(%rbp),%esi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2d6f(%rip),%rax
mov    (%rax),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0xe98(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb5(%rip),%r14
lea    0x20(%rsp),%r13
mov    %r14,%rdi
mov    %r13,%rsi
call   1060 <scanf@plt>
lea    0xead(%rip),%r15
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r13,%rdi
call   1040 <strlen@plt>
lea    0xeaf(%rip),%r12
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rsp,%rbp
mov    %r14,%rdi
mov    %rbp,%rsi
call   1060 <scanf@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rdi
call   1040 <strlen@plt>
mov    %r12,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1070 <strcat@plt>
lea    0xe79(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xe7e(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2da3(%rip),%rax
mov    (%rax),%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Please enter a string up to 30 characters:\00"
@.str.1 = [15 x i8] c" %[0-9, ,A-z]s\00"
@.str.2 = [30 x i8] c"The string entered was : %s \0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [49 x i8] c"Please enter another string up to 30 characters:\00"
@.str.5 = [30 x i8] c"the string combined is : %s \0A\00"
@.str.6 = [3 x i8] c"%d\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [30 x i8]
%7 = alloca [30 x i8]
%8 = alloca [60 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%14 = call i32 @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%18 = call i32 @strlen(i8* %17)
store i32 %18, i32* %9
%19 = load i32, i32* %9
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0))
%22 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%23 = call i32 @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %24)
%26 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%27 = call i32 @strlen(i8* %26)
store i32 %27, i32* %10
%28 = load i32, i32* %10
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds [60 x i8], [60 x i8]* %8, i64 0, i64 0
%31 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%32 = call i32 @strcpy(i8* %30, i8* %31)
%33 = getelementptr inbounds [60 x i8], [60 x i8]* %8, i64 0, i64 0
%34 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%35 = call i32 @strcat(i8* %33, i8* %34)
%36 = getelementptr inbounds [60 x i8], [60 x i8]* %8, i64 0, i64 0
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %36)
%38 = getelementptr inbounds [60 x i8], [60 x i8]* %8, i64 0, i64 0
%39 = call i32 @strlen(i8* %38)
store i32 %39, i32* %11
%40 = load i32, i32* %11
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %40)
%42 = load i32, i32* @EXIT_SUCCESS
ret i32 %42
}

LLVM IR (-O2):
@.str = [43 x i8] c"Please enter a string up to 30 characters:\00"
@.str.1 = [15 x i8] c" %[0-9, ,A-z]s\00"
@.str.2 = [30 x i8] c"The string entered was : %s \0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [49 x i8] c"Please enter another string up to 30 characters:\00"
@.str.5 = [30 x i8] c"the string combined is : %s \0A\00"
@.str.6 = [3 x i8] c"%d\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [30 x i8]
%4 = alloca [30 x i8]
%5 = alloca [60 x i8]
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [60 x i8], [60 x i8]* %5, i64 0, i64 0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%12 = call i32 @strlen(i8* %6)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%17 = call i32 @strlen(i8* %7)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %17)
%19 = call i32 @strcpy(i8* %8, i8* %6)
%20 = call i32 @strcat(i8* %8, i8* %7)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %8)
%22 = call i32 @strlen(i8* %8)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %22)
%24 = load i32, i32* @EXIT_SUCCESS
ret i32 %24
}