#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 /*<<< orphan*/ system(char *);
int main() {
  char parola1[100];
  char parola2[100];
  int i;
  int uguali;
  printf("Inserire la prima parola ");
  scanf("%s", parola1);
  printf("\nInserire la seconda parola ");
  scanf("%s", parola2);
  i = 0;
  uguali = 1;
  while ((uguali == 1) && (parola1[i] != '\0' || parola2[i] != '\0')) {
    if (parola1[i] != parola2[i]) {
      uguali = 0;
    }
    i++;
  }
  if (uguali == 1) {
    printf("\nLe due parole sono uguali");
  } else {
    printf("\nLe due parole sono diverse");
  }
  printf("\n");
  system("PAUSE");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1050 <scanf@plt>
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
lea    -0xe0(%rbp),%rsi
lea    0xea2(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x0,-0xe4(%rbp)
movl   $0x1,-0xe8(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0xe8(%rbp)
mov    %al,-0xe9(%rbp)
jne    11ea <main+0xba>
movslq -0xe4(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%ecx
mov    $0x1,%al
cmp    $0x0,%ecx
mov    %al,-0xea(%rbp)
jne    11de <main+0xae>
movslq -0xe4(%rbp),%rax
movsbl -0xe0(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
setne  %al
mov    %al,-0xea(%rbp)
mov    -0xea(%rbp),%al
mov    %al,-0xe9(%rbp)
mov    -0xe9(%rbp),%al
test   $0x1,%al
jne    11fd <main+0xcd>
jmp    123e <main+0x10e>
movslq -0xe4(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
movslq -0xe4(%rbp),%rcx
movsbl -0xe0(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
je     122a <main+0xfa>
movl   $0x0,-0xe8(%rbp)
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    1191 <main+0x61>
cmpl   $0x1,-0xe8(%rbp)
jne    125c <main+0x12c>
lea    0xde8(%rip),%rdi
call   1040 <printf@plt>
jmp    1268 <main+0x138>
lea    0xdf2(%rip),%rdi
call   1040 <printf@plt>
lea    0xe02(%rip),%rdi
call   1040 <printf@plt>
lea    0xdf8(%rip),%rdi
call   1030 <system@plt>
mov    -0x4(%rbp),%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xe0,%rsp
lea    0xeb1(%rip),%rdi
call   1050 <printf@plt>
lea    0xebf(%rip),%rbx
lea    0x70(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xeae(%rip),%rdi
call   1050 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
xor    %eax,%eax
lea    0xeb2(%rip),%rdi
lea    0xec6(%rip),%rsi
nop
movzbl 0x70(%rsp,%rax,1),%ecx
movzbl (%rsp,%rax,1),%ebx
mov    %ecx,%edx
or     %bl,%dl
je     11aa <main+0x6a>
add    $0x1,%rax
cmp    %bl,%cl
je     1190 <main+0x50>
mov    %rsi,%rdi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xeb1(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [26 x i8] c"Inserire la prima parola \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [29 x i8] c"\0AInserire la seconda parola \00"
@.str.3 = [27 x i8] c"\0ALe due parole sono uguali\00"
@.str.4 = [28 x i8] c"\0ALe due parole sono diverse\00"
@.str.6 = [6 x i8] c"PAUSE\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 ([26 x i8], [26 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 ([29 x i8], [29 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 = %0, %18
%10 = phi i64 [ 0, %0 ], [ %20, %18 ]
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %10
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
%17 = select i1 %13, i1 %16, i1 false
br i1 %17, label %21, label %18
18: ; preds = %9
%19 = icmp eq i8 %12, %15
%20 = add nuw i64 %10, 1
br i1 %19, label %9, label %21
21: ; preds = %18, %9
%22 = phi i8* [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), %9 ], [ getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), %18 ]
%23 = call i32 @printf(i8* dereferenceable(1) %22)
%24 = call i32 @putchar(i32 10)
%25 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}