#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 */
unsigned int inputScanf();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stampaMosseHanoi(unsigned int, unsigned int, unsigned int,
                                    unsigned int);
int main(void) {
  unsigned int numeroDischi;
  unsigned int pioloIniziale;
  unsigned int pioloFinale;
  unsigned int pioloTemporaneo;
  do {
    printf("%s", "Inserire numero di dischi da spostare (minimo 3): ");
    numeroDischi = inputScanf();
  } while (numeroDischi < 3);
  do {
    printf("%s", "Inserire numero di piolo iniziale: ");
    pioloIniziale = inputScanf();
    printf("%s", "Inserire numero di piolo finale: ");
    pioloFinale = inputScanf();
    printf("%s", "Inserire numero di piolo da usare come temporaneo: ");
    pioloTemporaneo = inputScanf();
  } while (pioloIniziale == pioloFinale || pioloIniziale == pioloTemporaneo ||
           pioloFinale == pioloTemporaneo);
  stampaMosseHanoi(numeroDischi, pioloIniziale, pioloFinale, pioloTemporaneo);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xeb6(%rip),%rsi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <inputScanf@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jb     113f <main+0xf>
jmp    116b <main+0x3b>
lea    0xe8e(%rip),%rdi
lea    0xebd(%rip),%rsi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <inputScanf@plt>
mov    %eax,-0xc(%rbp)
lea    0xe71(%rip),%rdi
lea    0xec4(%rip),%rsi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <inputScanf@plt>
mov    %eax,-0x10(%rbp)
lea    0xe54(%rip),%rdi
lea    0xec9(%rip),%rsi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <inputScanf@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%al
cmp    -0x10(%rbp),%ecx
mov    %al,-0x15(%rbp)
je     11f0 <main+0xc0>
mov    -0xc(%rbp),%ecx
mov    $0x1,%al
cmp    -0x14(%rbp),%ecx
mov    %al,-0x15(%rbp)
je     11f0 <main+0xc0>
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    116b <main+0x3b>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1050 <stampaMosseHanoi@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%r14
lea    0xeba(%rip),%rbp
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbp,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <inputScanf@plt>
cmp    $0x3,%eax
jb     1150 <main+0x20>
mov    %eax,%ebx
lea    0xe90(%rip),%r14
lea    0xee3(%rip),%r12
lea    0xefe(%rip),%r13
xchg   %ax,%ax
mov    %r14,%rdi
lea    0xeac(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <inputScanf@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %r12,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <inputScanf@plt>
mov    %eax,%r15d
mov    %r14,%rdi
mov    %r13,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <inputScanf@plt>
cmp    %r15d,%ebp
je     1180 <main+0x50>
cmp    %eax,%ebp
je     1180 <main+0x50>
cmp    %eax,%r15d
je     1180 <main+0x50>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %eax,%ecx
call   1050 <stampaMosseHanoi@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [51 x i8] c"Inserire numero di dischi da spostare (minimo 3): \00"
@.str.2 = [36 x i8] c"Inserire numero di piolo iniziale: \00"
@.str.3 = [34 x i8] c"Inserire numero di piolo finale: \00"
@.str.4 = [52 x i8] c"Inserire numero di piolo da usare come temporaneo: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %9, %0
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (...) @inputScanf()
store i32 %8, i32* %2
br label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = icmp ult i32 %10, 3
br i1 %11, label %6, label %12
12: ; preds = %9
br label %13
13: ; preds = %32, %12
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 (...) @inputScanf()
store i32 %15, i32* %3
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 (...) @inputScanf()
store i32 %17, i32* %4
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 (...) @inputScanf()
store i32 %19, i32* %5
br label %20
20: ; preds = %13
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = icmp eq i32 %21, %22
br i1 %23, label %32, label %24
24: ; preds = %20
%25 = load i32, i32* %3
%26 = load i32, i32* %5
%27 = icmp eq i32 %25, %26
br i1 %27, label %32, label %28
28: ; preds = %24
%29 = load i32, i32* %4
%30 = load i32, i32* %5
%31 = icmp eq i32 %29, %30
br label %32
32: ; preds = %28, %24, %20
%33 = phi i1 [ true, %24 ], [ true, %20 ], [ %31, %28 ]
br i1 %33, label %13, label %34
34: ; preds = %32
%35 = load i32, i32* %2
%36 = load i32, i32* %3
%37 = load i32, i32* %4
%38 = load i32, i32* %5
%39 = call i32 @stampaMosseHanoi(i32 %35, i32 %36, i32 %37, i32 %38)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [51 x i8] c"Inserire numero di dischi da spostare (minimo 3): \00"
@.str.2 = [36 x i8] c"Inserire numero di piolo iniziale: \00"
@.str.3 = [34 x i8] c"Inserire numero di piolo finale: \00"
@.str.4 = [52 x i8] c"Inserire numero di piolo da usare come temporaneo: \00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (...) @inputScanf()
%4 = icmp ult i32 %3, 3
br i1 %4, label %1, label %5
5: ; preds = %1, %5
%6 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 (...) @inputScanf()
%8 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%9 = tail call i32 (...) @inputScanf()
%10 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
%11 = tail call i32 (...) @inputScanf()
%12 = icmp eq i32 %7, %9
%13 = icmp eq i32 %7, %11
%14 = select i1 %12, i1 true, i1 %13
%15 = icmp eq i32 %9, %11
%16 = select i1 %14, i1 true, i1 %15
br i1 %16, label %5, label %17
17: ; preds = %5
%18 = tail call i32 @stampaMosseHanoi(i32 %3, i32 %7, i32 %9, i32 %11)
ret i32 0
}