#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*/ needle(int);
int /*<<< orphan*/ printf(char *);
int scanf(char *, int *);
int /*<<< orphan*/ trunk(int);
int main(void) {
  int n;
  printf("Input needle height please, should be MIN - MAX\n>>");
  while ((scanf("%d", &n) == 1) && (n < 4 || n > 10))
    printf("Sorry number should be MIN - MAX! Please try again =)\n");
  printf("Thanks!\n");
  trunk(n / 2);
  needle(n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0x9(%rbp)
jne    119a <main+0x5a>
mov    $0x1,%al
cmpl   $0x4,-0x8(%rbp)
mov    %al,-0xa(%rbp)
jl     1194 <main+0x54>
cmpl   $0xa,-0x8(%rbp)
setg   %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    11aa <main+0x6a>
jmp    11bb <main+0x7b>
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
jmp    115b <main+0x1b>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <trunk@plt>
mov    -0x8(%rbp),%edi
call   1060 <needle@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
lea    0xec7(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    11b4 <main+0x64>
lea    0xebc(%rip),%r14
lea    0xeaa(%rip),%r15
lea    0xc(%rsp),%rbx
xchg   %ax,%ax
mov    0xc(%rsp),%eax
add    $0xfffffff5,%eax
cmp    $0xfffffff8,%eax
ja     11b4 <main+0x64>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
je     1190 <main+0x40>
lea    0xe7b(%rip),%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%eax
mov    %eax,%edi
shr    $0x1f,%edi
add    %eax,%edi
sar    %edi
call   1050 <trunk@plt>
mov    0xc(%rsp),%edi
call   1070 <needle@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Input needle height please, should be MIN - MAX\0A>>\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [55 x i8] c"Sorry number should be MIN - MAX! Please try again =)\0A\00"
@.str.3 = [9 x i8] c"Thanks!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %17, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 4
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 10
br label %13
13: ; preds = %10, %7
%14 = phi i1 [ true, %7 ], [ %12, %10 ]
br label %15
15: ; preds = %13, %4
%16 = phi i1 [ false, %4 ], [ %14, %13 ]
br i1 %16, label %17, label %19
17: ; preds = %15
%18 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
br label %4
19: ; preds = %15
%20 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%21 = load i32, i32* %2
%22 = sdiv i32 %21, 2
%23 = call i32 @trunk(i32 %22)
%24 = load i32, i32* %2
%25 = call i32 @needle(i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [51 x i8] c"Input needle height please, should be MIN - MAX\0A>>\00"
@.str.1 = [3 x i8] c"%d\00"
@str = [8 x i8] c"Thanks!\00"
@str.4 = [54 x i8] c"Sorry number should be MIN - MAX! Please try again =)\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %14
6: ; preds = %0, %10
%7 = load i32, i32* %1
%8 = add i32 %7, -11
%9 = icmp ult i32 %8, -7
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str.4, 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 = icmp eq i32 %12, 1
br i1 %13, label %6, label %14
14: ; preds = %6, %10, %0
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%16 = load i32, i32* %1
%17 = sdiv i32 %16, 2
%18 = call i32 @trunk(i32 %17)
%19 = load i32, i32* %1
%20 = call i32 @needle(i32 %19)
ret i32 0
}