#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int strcmp(char *, char *);
int main(void) {
  char stringa1[10];
  char stringa2[10];
  int confronto;
  memset(stringa1, 0, 10);
  memset(stringa2, 0, 10);
  printf("%s", "\nPrego inserire il valore della stringa1: ");
  fgets(stringa1, 10, stdin);
  printf("%s", "\nPrego inserire il valore della stringa2: ");
  fgets(stringa2, 10, stdin);
  puts("");
  confronto = strcmp(stringa1, stringa2);
  if (confronto == 0) {
    puts("Le stringhe sono della stessa lunghezza");
  } else if (confronto >= 1) {
    puts("La stringa1 e' maggiore della stringa2");
  } else if (confronto <= -1) {
    puts("La stringa2 e' maggiore della stringa1");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <memset@plt>
lea    0xe7a(%rip),%rdi
lea    0xe76(%rip),%rsi
call   1040 <printf@plt>
lea    -0xe(%rbp),%rdi
mov    0x2e4b(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1060 <fgets@plt>
lea    0xe50(%rip),%rdi
lea    0xe77(%rip),%rsi
call   1040 <printf@plt>
lea    -0x18(%rbp),%rdi
mov    0x2e21(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1060 <fgets@plt>
lea    0xe53(%rip),%rdi
call   1030 <puts@plt>
lea    -0xe(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <strcmp@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    120a <main+0xba>
lea    0xe59(%rip),%rdi
call   1030 <puts@plt>
jmp    1245 <main+0xf5>
cmpl   $0x1,-0x1c(%rbp)
jl     1225 <main+0xd5>
lea    0xe66(%rip),%rdi
call   1030 <puts@plt>
jmp    1240 <main+0xf0>
cmpl   $0xffffffff,-0x1c(%rbp)
jg     123b <main+0xeb>
lea    0xe72(%rip),%rdi
call   1030 <puts@plt>
jmp    1240 <main+0xf0>
jmp    1245 <main+0xf5>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <memset@plt>
lea    0x4(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <memset@plt>
lea    0xe66(%rip),%r12
lea    0xe62(%rip),%rsi
mov    %r12,%rdi
call   1050 <printf@plt>
mov    0x2e38(%rip),%rbx
mov    (%rbx),%edx
mov    %r14,%rdi
mov    $0xa,%esi
call   1070 <fgets@plt>
lea    0xe68(%rip),%rsi
mov    %r12,%rdi
call   1050 <printf@plt>
mov    (%rbx),%edx
mov    %r15,%rdi
mov    $0xa,%esi
call   1070 <fgets@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
lea    0xe86(%rip),%rax
lea    0xea6(%rip),%rcx
cmovg  %rax,%rcx
lea    0xe4c(%rip),%rdi
cmovne %rcx,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [43 x i8] c"\0APrego inserire il valore della stringa1: \00"
@stdin = global i32 0
@.str.2 = [43 x i8] c"\0APrego inserire il valore della stringa2: \00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [40 x i8] c"Le stringhe sono della stessa lunghezza\00"
@.str.5 = [39 x i8] c"La stringa1 e' maggiore della stringa2\00"
@.str.6 = [39 x i8] c"La stringa2 e' maggiore della stringa1\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca [10 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 10)
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%8 = call i32 @memset(i8* %7, i32 0, i32 10)
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%11 = load i32, i32* @stdin
%12 = call i32 @fgets(i8* %10, i32 10, i32 %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%15 = load i32, i32* @stdin
%16 = call i32 @fgets(i8* %14, i32 10, i32 %15)
%17 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%20 = call i32 @strcmp(i8* %18, i8* %19)
store i32 %20, i32* %4
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %0
%24 = call i32 @puts(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0))
br label %37
25: ; preds = %0
%26 = load i32, i32* %4
%27 = icmp sge i32 %26, 1
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 @puts(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
br label %36
30: ; preds = %25
%31 = load i32, i32* %4
%32 = icmp sle i32 %31, -1
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call i32 @puts(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0))
br label %35
35: ; preds = %33, %30
br label %36
36: ; preds = %35, %28
br label %37
37: ; preds = %36, %23
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [43 x i8] c"\0APrego inserire il valore della stringa1: \00"
@stdin = global i32 0
@.str.2 = [43 x i8] c"\0APrego inserire il valore della stringa2: \00"
@.str.4 = [40 x i8] c"Le stringhe sono della stessa lunghezza\00"
@.str.5 = [39 x i8] c"La stringa1 e' maggiore della stringa2\00"
@.str.6 = [39 x i8] c"La stringa2 e' maggiore della stringa1\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = call i32 @memset(i8* %3, i32 0, i32 10)
%6 = call i32 @memset(i8* %4, i32 0, i32 10)
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %3, i32 10, i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* @stdin
%12 = call i32 @fgets(i8* %4, i32 10, i32 %11)
%13 = call i32 @putchar(i32 10)
%14 = call i32 @strcmp(i8* %3, i8* %4)
%15 = icmp eq i32 %14, 0
%16 = icmp sgt i32 %14, 0
%17 = select i1 %16, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0)
%18 = select i1 %15, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8* %17
%19 = call i32 @puts(i8* dereferenceable(1) %18)
ret i32 0
}