#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 p1[100];
  char p2[100];
  int i;
  int uguali;
  printf("Inserisci la prima parola: ");
  scanf("%s", p1);
  printf("Inserisci la seconda parola: ");
  scanf("%s", p2);
  i = 0;
  uguali = 0;
  while (uguali == 0 && (p1[i] != '\0' || p2[i] != '\0')) {
    if (p1[i] == p2[i]) {
      uguali = 1;
    }
    i++;
  }
  if (uguali == 1) {
    printf("Sono uguali");
  } else {
    printf("Non sono uguali");
  }
  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    0xec3(%rip),%rdi
call   1050 <scanf@plt>
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
lea    -0xe0(%rbp),%rsi
lea    0xea4(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x0,-0xe4(%rbp)
movl   $0x0,-0xe8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-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
jne    122a <main+0xfa>
movl   $0x1,-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    0xdeb(%rip),%rdi
call   1040 <printf@plt>
jmp    1268 <main+0x138>
lea    0xde6(%rip),%rdi
call   1040 <printf@plt>
lea    0xdea(%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    0xec1(%rip),%rdi
call   1040 <printf@plt>
lea    0xed1(%rip),%rbx
lea    0x70(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xec0(%rip),%rdi
call   1040 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
xor    %eax,%eax
lea    0xed1(%rip),%rdi
lea    0xebe(%rip),%rsi
nop
movzbl 0x70(%rsp,%rax,1),%ecx
movzbl (%rsp,%rax,1),%ebx
mov    %ecx,%edx
or     %bl,%dl
je     119a <main+0x6a>
add    $0x1,%rax
cmp    %bl,%cl
jne    1180 <main+0x50>
mov    %rsi,%rdi
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Inserisci la prima parola: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [30 x i8] c"Inserisci la seconda parola: \00"
@.str.3 = [12 x i8] c"Sono uguali\00"
@.str.4 = [16 x i8] c"Non sono uguali\00"
@.str.5 = [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 ([28 x i8], [28 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 ([30 x i8], [30 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 0, i32* %5
br label %12
12: ; preds = %46, %0
%13 = load i32, i32* %5
%14 = icmp eq i32 %13, 0
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 eq i32 %38, %43
br i1 %44, label %45, label %46
45: ; preds = %33
store i32 1, 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 ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %56
54: ; preds = %49
%55 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %56
56: ; preds = %54, %52
%57 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%58 = load i32, i32* %1
ret i32 %58
}

LLVM IR (-O2):
@.str = [28 x i8] c"Inserisci la prima parola: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [30 x i8] c"Inserisci la seconda parola: \00"
@.str.3 = [12 x i8] c"Sono uguali\00"
@.str.4 = [16 x i8] c"Non sono uguali\00"
@.str.5 = [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 ([28 x i8], [28 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 = %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 %21, label %9
21: ; preds = %9, %18
%22 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), %18 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), %9 ]
%23 = call i32 @printf(i8* dereferenceable(1) %22)
%24 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}