#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*/ populate_same_diff_str_v2(char *, char *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  while (1) {
    char input1[1000] = {0}, input2[1000] = {0}, diff[1000 * 2] = {0},
         same[1000] = {0};
    printf("\n Press Ctrl+C to exit ");
    printf("\n Enter first input string, max Len %d ", 1000);
    scanf("%s", input1);
    printf("\n Enter second input string, max Len %d ", 1000);
    scanf("%s", input2);
    populate_same_diff_str_v2(input1, input2, same, diff);
    printf("\n Same String is %s", same);
    printf("\n Diff String is %s", diff);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x13a0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x3f0(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1040 <memset@plt>
lea    -0x7e0(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1040 <memset@plt>
lea    -0xfb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x7d0,%edx
call   1040 <memset@plt>
lea    -0x13a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1040 <memset@plt>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe65(%rip),%rdi
mov    $0x3e8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x3f0(%rbp),%rsi
lea    0xead(%rip),%rdi
call   1050 <scanf@plt>
lea    0xe67(%rip),%rdi
mov    $0x3e8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x7e0(%rbp),%rsi
lea    0xe87(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x3f0(%rbp),%rdi
lea    -0x7e0(%rbp),%rsi
lea    -0x13a0(%rbp),%rdx
lea    -0xfb0(%rbp),%rcx
call   1060 <populate_same_diff_str_v2@plt>
lea    -0x13a0(%rbp),%rsi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xfb0(%rbp),%rsi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1152 <main+0x12>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x13a8,%rsp
lea    0x7e0(%rsp),%r14
lea    0x3f0(%rsp),%r15
lea    0xbd0(%rsp),%r12
mov    %rsp,%rbx
lea    0xf07(%rip),%r13
lea    0xf03(%rip),%rbp
nopw   0x0(%rax,%rax,1)
mov    $0x3e8,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    $0x3e8,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    $0x7d0,%edx
mov    %r12,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    $0x3e8,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xe3d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe47(%rip),%rdi
mov    $0x3e8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
lea    0xe51(%rip),%rdi
mov    $0x3e8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %r12,%rcx
call   1060 <populate_same_diff_str_v2@plt>
lea    0xe4b(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1180 <main+0x40>

LLVM IR (-O0):
@.str = [24 x i8] c"\0A Press Ctrl+C to exit \00"
@.str.1 = [40 x i8] c"\0A Enter first input string, max Len %d \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [41 x i8] c"\0A Enter second input string, max Len %d \00"
@.str.4 = [20 x i8] c"\0A Same String is %s\00"
@.str.5 = [20 x i8] c"\0A Diff String is %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1000 x i8]
%3 = alloca [1000 x i8]
%4 = alloca [2000 x i8]
%5 = alloca [1000 x i8]
store i32 0, i32* %1
br label %6
6: ; preds = %0, %6
%7 = bitcast [1000 x i8]* %2 to i8*
%8 = bitcast [1000 x i8]* %3 to i8*
%9 = bitcast [2000 x i8]* %4 to i8*
%10 = bitcast [1000 x i8]* %5 to i8*
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 1000)
%13 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i32 1000)
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%19 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%20 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%21 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 0
%22 = call i32 @populate_same_diff_str_v2(i8* %18, i8* %19, i8* %20, i8* %21)
%23 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds [2000 x i8], [2000 x i8]* %4, i64 0, i64 0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %25)
br label %6
}

LLVM IR (-O2):
@.str = [24 x i8] c"\0A Press Ctrl+C to exit \00"
@.str.1 = [40 x i8] c"\0A Enter first input string, max Len %d \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [41 x i8] c"\0A Enter second input string, max Len %d \00"
@.str.4 = [20 x i8] c"\0A Same String is %s\00"
@.str.5 = [20 x i8] c"\0A Diff String is %s\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = alloca [1000 x i8]
%3 = alloca [2000 x i8]
%4 = alloca [1000 x i8]
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [2000 x i8], [2000 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
br label %9
9: ; preds = %0, %9
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 1000)
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i32 1000)
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%15 = call i32 @populate_same_diff_str_v2(i8* %5, i8* %6, i8* %8, i8* %7)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %8)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i8* %7)
br label %9
}