#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*/ Genesis(int **);
int /*<<< orphan*/ Giocabile(int **, int);
int /*<<< orphan*/ Print(int **);
int /*<<< orphan*/ Replace(int **, int);
int /*<<< orphan*/ Win(int **);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int scelta, count = 0, mat[4][4];
  Genesis(mat);
  do {
    Print(mat);
    do {
      printf("Inserisci il numero che vuoi spostare: ");
      scanf("%d", &scelta);
    } while (!Giocabile(mat, scelta));
    count++;
    Replace(mat, scelta);
  } while (!Win(mat));
  printf("\n   You Win!\n");
  Print(mat);
  printf("\nHai completato il puzzle in %d mosse.", count);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x50(%rbp),%rdi
call   1030 <Genesis@plt>
lea    -0x50(%rbp),%rdi
call   1090 <Print@plt>
lea    0xe61(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe7b(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1080 <Giocabile@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1198 <main+0x28>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1060 <Replace@plt>
lea    -0x50(%rbp),%rdi
call   1050 <Win@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    118f <main+0x1f>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
call   1090 <Print@plt>
mov    -0xc(%rbp),%esi
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x50,%rsp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <Genesis@plt>
lea    0xe60(%rip),%r15
lea    0xe81(%rip),%r12
lea    0xc(%rsp),%rbp
xor    %r14d,%r14d
nop
mov    %rbx,%rdi
call   10a0 <Print@plt>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1080 <scanf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1090 <Giocabile@plt>
test   %eax,%eax
je     11c0 <main+0x40>
add    $0x1,%r14d
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1070 <Replace@plt>
mov    %rbx,%rdi
call   1060 <Win@plt>
test   %eax,%eax
je     11b0 <main+0x30>
lea    0xe4a(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rdi
call   10a0 <Print@plt>
lea    0xe0d(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Inserisci il numero che vuoi spostare: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"\0A You Win!\0A\00"
@.str.3 = [39 x i8] c"\0AHai completato il puzzle in %d mosse.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [4 x [4 x i32]]
store i32 0, i32* %1
store i32 0, i32* %3
%5 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %4, i64 0, i64 0
%6 = bitcast [4 x i32]* %5 to i32**
%7 = call i32 @Genesis(i32** %6)
br label %8
8: ; preds = %29, %0
%9 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %4, i64 0, i64 0
%10 = bitcast [4 x i32]* %9 to i32**
%11 = call i32 @Print(i32** %10)
br label %12
12: ; preds = %15, %8
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %15
15: ; preds = %12
%16 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %4, i64 0, i64 0
%17 = bitcast [4 x i32]* %16 to i32**
%18 = load i32, i32* %2
%19 = call i32 @Giocabile(i32** %17, i32 %18)
%20 = icmp ne i32 %19, 0
%21 = xor i1 %20, true
br i1 %21, label %12, label %22
22: ; preds = %15
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
%25 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %4, i64 0, i64 0
%26 = bitcast [4 x i32]* %25 to i32**
%27 = load i32, i32* %2
%28 = call i32 @Replace(i32** %26, i32 %27)
br label %29
29: ; preds = %22
%30 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %4, i64 0, i64 0
%31 = bitcast [4 x i32]* %30 to i32**
%32 = call i32 @Win(i32** %31)
%33 = icmp ne i32 %32, 0
%34 = xor i1 %33, true
br i1 %34, label %8, label %35
35: ; preds = %29
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%37 = getelementptr inbounds [4 x [4 x i32]], [4 x [4 x i32]]* %4, i64 0, i64 0
%38 = bitcast [4 x i32]* %37 to i32**
%39 = call i32 @Print(i32** %38)
%40 = load i32, i32* %3
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %40)
%42 = load i32, i32* %1
ret i32 %42
}

LLVM IR (-O2):
@.str = [40 x i8] c"Inserisci il numero che vuoi spostare: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [39 x i8] c"\0AHai completato il puzzle in %d mosse.\00"
@str = [13 x i8] c"\0A You Win!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x [4 x i32]]
%3 = bitcast i32* %1 to i8*
%4 = bitcast [4 x [4 x i32]]* %2 to i8*
%5 = bitcast [4 x [4 x i32]]* %2 to i32**
%6 = call i32 @Genesis(i32** %5)
br label %7
7: ; preds = %16, %0
%8 = phi i32 [ 0, %0 ], [ %17, %16 ]
%9 = call i32 @Print(i32** %5)
br label %10
10: ; preds = %10, %7
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%13 = load i32, i32* %1
%14 = call i32 @Giocabile(i32** %5, i32 %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %10, label %16
16: ; preds = %10
%17 = add nuw nsw i32 %8, 1
%18 = load i32, i32* %1
%19 = call i32 @Replace(i32** %5, i32 %18)
%20 = call i32 @Win(i32** %5)
%21 = icmp eq i32 %20, 0
br i1 %21, label %7, label %22
22: ; preds = %16
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%24 = call i32 @Print(i32** %5)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %17)
ret i32 0
}