#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() {
  int x;
  int flag;
  char P1[100];
  char P2[100];
  printf(" Inserire la prima parola:");
  scanf("%s", P1);
  printf(" Inserire la seconda parola: ");
  scanf("%s", P2);
  x = 0;
  flag = 1;
  while (((P1[x] != '\0') || (P2[x] != '\0')) && (flag == 1)) {
    if (P1[x] != P2[x]) {
      flag = 0;
    } else {
      x++;
    }
  }
  if (flag == 1) {
    printf("Uguali");
  } else {
    printf("Diverse");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xed2(%rip),%rdi
call   1040 <scanf@plt>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
lea    -0xe0(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movslq -0x8(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x0,%eax
jne    11aa <main+0x8a>
movslq -0x8(%rbp),%rax
movsbl -0xe0(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xe1(%rbp)
je     11b7 <main+0x97>
cmpl   $0x1,-0xc(%rbp)
sete   %al
mov    %al,-0xe1(%rbp)
mov    -0xe1(%rbp),%al
test   $0x1,%al
jne    11ca <main+0xaa>
jmp    1201 <main+0xe1>
movslq -0x8(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
movslq -0x8(%rbp),%rcx
movsbl -0xe0(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
je     11f3 <main+0xd3>
movl   $0x0,-0xc(%rbp)
jmp    11fc <main+0xdc>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117b <main+0x5b>
cmpl   $0x1,-0xc(%rbp)
jne    121c <main+0xfc>
lea    0xe2a(%rip),%rdi
call   1030 <printf@plt>
jmp    1228 <main+0x108>
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xe0,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xee0(%rip),%rbx
lea    0x70(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    $0x1,%eax
xor    %edi,%edi
xor    %esi,%esi
jmp    117d <main+0x5d>
nopw   0x0(%rax,%rax,1)
xor    %esi,%esi
cmp    %cl,%bl
sete   %sil
cmovne %edi,%eax
add    %edx,%esi
mov    %esi,%edx
movzbl 0x70(%rsp,%rdx,1),%ebx
test   %bl,%bl
je     11a0 <main+0x80>
cmp    $0x1,%eax
jne    11bb <main+0x9b>
movzbl (%rsp,%rdx,1),%ecx
jmp    1170 <main+0x50>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rsp,%rdx,1),%ecx
test   %cl,%cl
je     11ad <main+0x8d>
cmp    $0x1,%eax
je     1170 <main+0x50>
cmp    $0x1,%eax
jne    11bb <main+0x9b>
lea    0xe83(%rip),%rdi
jmp    11c2 <main+0xa2>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [27 x i8] c" Inserire la prima parola:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [30 x i8] c" Inserire la seconda parola: \00"
@.str.3 = [7 x i8] c"Uguali\00"
@.str.4 = [8 x i8] c"Diverse\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, 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)
br label %9
9: ; preds = %27, %0
%10 = phi i32 [ 0, %0 ], [ %31, %27 ]
%11 = phi i32 [ 1, %0 ], [ %32, %27 ]
%12 = zext i32 %10 to i64
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %22
16: ; preds = %9
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %12
%18 = load i8, i8* %17
%19 = icmp ne i8 %18, 0
%20 = icmp eq i32 %11, 1
%21 = select i1 %19, i1 %20, i1 false
br i1 %21, label %27, label %33
22: ; preds = %9
%23 = icmp eq i32 %11, 1
br i1 %23, label %24, label %34
24: ; preds = %22
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %12
%26 = load i8, i8* %25
br label %27
27: ; preds = %24, %16
%28 = phi i8 [ %26, %24 ], [ %18, %16 ]
%29 = icmp eq i8 %14, %28
%30 = zext i1 %29 to i32
%31 = add nuw nsw i32 %10, %30
%32 = select i1 %29, i32 %11, i32 0
br label %9
33: ; preds = %16
br i1 %20, label %35, label %34
34: ; preds = %22, %33
br label %35
35: ; preds = %33, %34
%36 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %34 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), %33 ]
%37 = call i32 @printf(i8* dereferenceable(1) %36)
ret i32 0
}