#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 *, ...);
char *strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int main(void) {
  char str1[] = "hello", str2[20];
  printf("Enter any two strings respectively: \n");
  strcpy(str2, str1);
  printf("str2: %s\n", str2);
  printf("string cancatnetation: %s\n", strcat(str1, str2));
  printf("length of str3: %d\n", strlen(str1));
  if (strcmp(str1, str2) == 0)
    printf("Both are same\n");
  else
    printf("Not same\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe9b(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xe95(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    -0xa(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rsi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xa(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1070 <strcat@plt>
mov    %rax,%rsi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xa(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%esi
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xa(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    1201 <main+0xb1>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    120f <main+0xbf>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movw   $0x6f,0xc(%rsp)
movl   $0x6c6c6568,0x8(%rsp)
6c
lea    0xec2(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%r14
lea    0x8(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xe68(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <strcat@plt>
lea    0xe56(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    0xe58(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
lea    0xe7c(%rip),%rax
lea    0xe6c(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.str1 = [6 x i8] c"hello\00"
@.str = [38 x i8] c"Enter any two strings respectively: \0A\00"
@.str.1 = [10 x i8] c"str2: %s\0A\00"
@.str.2 = [27 x i8] c"string cancatnetation: %s\0A\00"
@.str.3 = [20 x i8] c"length of str3: %d\0A\00"
@.str.4 = [15 x i8] c"Both are same\0A\00"
@.str.5 = [10 x i8] c"Not same\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8]
%3 = alloca [20 x i8]
store i32 0, i32* %1
%4 = bitcast [6 x i8]* %2 to i8*
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%8 = call i32 @strcpy(i8* %6, i8* %7)
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%13 = call i8* @strcat(i8* %11, i8* %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%16 = call i32 @strlen(i8* %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%20 = call i64 @strcmp(i8* %18, i8* %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %0
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
br label %26
24: ; preds = %0
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %26
26: ; preds = %24, %22
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
@__const.main.str1 = [6 x i8] c"hello\00"
@.str.1 = [10 x i8] c"str2: %s\0A\00"
@.str.2 = [27 x i8] c"string cancatnetation: %s\0A\00"
@.str.3 = [20 x i8] c"length of str3: %d\0A\00"
@str = [37 x i8] c"Enter any two strings respectively: \00"
@str.6 = [9 x i8] c"Not same\00"
@str.7 = [14 x i8] c"Both are same\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%6 = call i32 @strcpy(i8* %4, i8* %3)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%8 = call i8* @strcat(i8* %3, i8* %4)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%10 = call i32 @strlen(i8* %3)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = call i64 @strcmp(i8* %3, i8* %4)
%13 = icmp eq i64 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.6, i64 0, i64 0)
%15 = call i32 @puts(i8* dereferenceable(1) %14)
ret i32 0
}