#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*/ gets(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
void compair() {
  char str1[10], str2[15];
  printf("Enter the first string: ");
  gets(str1);
  printf("Enter the second string: ");
  gets(str2);
  if ((strcmp(str1, str2)) == 0) {
    printf("String are same\n");
  } else {
    printf("String are not same\n");
  }
}


x86 assembly (clang, -O0):
<compair>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    -0xa(%rbp),%rdi
call   1050 <gets@plt>
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
lea    -0x19(%rbp),%rdi
call   1050 <gets@plt>
lea    -0xa(%rbp),%rdi
lea    -0x19(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    118a <compair+0x5a>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
jmp    1196 <compair+0x66>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compair>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
lea    0xf(%rsp),%r14
mov    %r14,%rdi
call   1060 <gets@plt>
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
lea    0x19(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
lea    0xeb9(%rip),%rax
lea    0xe9e(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Enter the first string: \00"
@.str.1 = [26 x i8] c"Enter the second string: \00"
@.str.2 = [17 x i8] c"String are same\0A\00"
@.str.3 = [21 x i8] c"String are not same\0A\00"
define void @compair() {
%1 = alloca [10 x i8]
%2 = alloca [15 x i8]
%3 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%8 = call i32 @gets(i8* %7)
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%10 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%11 = call i64 @strcmp(i8* %9, i8* %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %17
15: ; preds = %0
%16 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
br label %17
17: ; preds = %15, %13
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Enter the first string: \00"
@.str.1 = [26 x i8] c"Enter the second string: \00"
@str = [20 x i8] c"String are not same\00"
@str.4 = [16 x i8] c"String are same\00"
define void @compair() {
%1 = alloca [10 x i8]
%2 = alloca [15 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @gets(i8* %3)
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @gets(i8* %4)
%9 = call i64 @strcmp(i8* %3, i8* %4)
%10 = icmp eq i64 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0)
%12 = call i32 @puts(i8* dereferenceable(1) %11)
ret void
}