#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 */
scalar_t__ abs(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int re_x, re_y;
  int regina_x, regina_y;
  printf("In scacco oppure no?");
  printf("Inserisci coordinata x del re: ");
  scanf("%d", &re_x);
  printf("Inserisci coordinata y del re: ");
  scanf("%d", &re_y);
  printf("Inserisci coordinata x del regina: ");
  scanf("%d", &regina_x);
  printf("Inserisci coordinata y del regina: ");
  scanf("%d", &regina_y);
  if (re_x == regina_x) {
    printf("Il re è in scacco!");
  } else if (re_y == regina_y) {
    printf("Il re è in scacco!");
  } else if (abs(re_x - regina_x) == abs(re_y - regina_y)) {
    printf("Il re è in scacco!");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeca(%rip),%rdi
call   1040 <printf@plt>
lea    0xebb(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xece(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9f(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xed6(%rip),%rdi
call   1040 <printf@plt>
lea    0xe83(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11d8 <main+0xa8>
lea    0xed2(%rip),%rdi
call   1040 <printf@plt>
jmp    1235 <main+0x105>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    11f5 <main+0xc5>
lea    0xeb5(%rip),%rdi
call   1040 <printf@plt>
jmp    1230 <main+0x100>
mov    -0x8(%rbp),%edi
sub    -0x10(%rbp),%edi
call   1030 <abs@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
sub    -0x14(%rbp),%edi
call   1030 <abs@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jne    122b <main+0xfb>
lea    0xe7a(%rip),%rdi
call   1040 <printf@plt>
jmp    1230 <main+0x100>
jmp    1235 <main+0x105>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
call   1040 <printf@plt>
lea    0xee1(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xed0(%rip),%rdi
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xed7(%rip),%rdi
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xee2(%rip),%rdi
call   1040 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
sub    0x8(%rsp),%edi
je     11d6 <main+0xa6>
mov    0x4(%rsp),%eax
cmp    (%rsp),%eax
je     11d6 <main+0xa6>
call   1030 <abs@plt>
mov    %rax,%rbx
mov    0x4(%rsp),%edi
sub    (%rsp),%edi
call   1030 <abs@plt>
cmp    %rax,%rbx
jne    11e2 <main+0xb2>
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"In scacco oppure no?\00"
@.str.1 = [32 x i8] c"Inserisci coordinata x del re: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [32 x i8] c"Inserisci coordinata y del re: \00"
@.str.4 = [36 x i8] c"Inserisci coordinata x del regina: \00"
@.str.5 = [36 x i8] c"Inserisci coordinata y del regina: \00"
@.str.6 = [20 x i8] c"Il re \C3\A8 in scacco!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%9 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%11 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%13 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%15 = load i32, i32* %2
%16 = load i32, i32* %4
%17 = icmp eq i32 %15, %16
br i1 %17, label %18, label %20
18: ; preds = %0
%19 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %40
20: ; preds = %0
%21 = load i32, i32* %3
%22 = load i32, i32* %5
%23 = icmp eq i32 %21, %22
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %39
26: ; preds = %20
%27 = load i32, i32* %2
%28 = load i32, i32* %4
%29 = sub nsw i32 %27, %28
%30 = call i64 @abs(i32 %29)
%31 = load i32, i32* %3
%32 = load i32, i32* %5
%33 = sub nsw i32 %31, %32
%34 = call i64 @abs(i32 %33)
%35 = icmp eq i64 %30, %34
br i1 %35, label %36, label %38
36: ; preds = %26
%37 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %38
38: ; preds = %36, %26
br label %39
39: ; preds = %38, %24
br label %40
40: ; preds = %39, %18
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"In scacco oppure no?\00"
@.str.1 = [32 x i8] c"Inserisci coordinata x del re: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [32 x i8] c"Inserisci coordinata y del re: \00"
@.str.4 = [36 x i8] c"Inserisci coordinata x del regina: \00"
@.str.5 = [36 x i8] c"Inserisci coordinata y del regina: \00"
@.str.6 = [20 x i8] c"Il re \C3\A8 in scacco!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%16 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%18 = load i32, i32* %1
%19 = load i32, i32* %3
%20 = icmp eq i32 %18, %19
br i1 %20, label %33, label %21
21: ; preds = %0
%22 = load i32, i32* %2
%23 = load i32, i32* %4
%24 = icmp eq i32 %22, %23
br i1 %24, label %33, label %25
25: ; preds = %21
%26 = sub nsw i32 %18, %19
%27 = call i64 @abs(i32 %26)
%28 = load i32, i32* %2
%29 = load i32, i32* %4
%30 = sub nsw i32 %28, %29
%31 = call i64 @abs(i32 %30)
%32 = icmp eq i64 %27, %31
br i1 %32, label %33, label %35
33: ; preds = %25, %21, %0
%34 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %35
35: ; preds = %33, %25
ret i32 0
}