#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 count(int);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, int *);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stdout;
int main(void) {
  setbuf(stdout, NULL);
  int n;
  printf("Input max size of the arange\n");
  if ((scanf("%i", &n) != 1) || (n <= 0)) {
    printf("Inccorect length");
    return -1;
  } else {
    printf("The number of the useful elements is %i\n", count(n));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <setbuf@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
cmp    $0x1,%eax
jne    1192 <main+0x52>
cmpl   $0x0,-0x8(%rbp)
jg     11ac <main+0x6c>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11cb <main+0x8b>
mov    -0x8(%rbp),%edi
call   1030 <count@plt>
mov    %eax,%esi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1050 <setbuf@plt>
lea    0xed1(%rip),%rdi
call   1040 <puts@plt>
lea    0xe88(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
cmp    $0x1,%eax
jne    11a8 <main+0x58>
mov    0xc(%rsp),%edi
test   %edi,%edi
jle    11a8 <main+0x58>
call   1030 <count@plt>
lea    0xe79(%rip),%rdi
xor    %ebx,%ebx
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    11bb <main+0x6b>
lea    0xe54(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [30 x i8] c"Input max size of the arange\0A\00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [17 x i8] c"Inccorect length\00"
@.str.3 = [41 x i8] c"The number of the useful elements is %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @stdout
%4 = call i32 @setbuf(i32 %3, i32* null)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = icmp ne i32 %6, 1
br i1 %7, label %11, label %8
8: ; preds = %0
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8, %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %18
13: ; preds = %8
%14 = load i32, i32* %2
%15 = call i32 @count(i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %13
store i32 0, i32* %1
br label %18
18: ; preds = %17, %11
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
@stdout = global i32 0
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [17 x i8] c"Inccorect length\00"
@.str.3 = [41 x i8] c"The number of the useful elements is %i\0A\00"
@str = [29 x i8] c"Input max size of the arange\00"
define i32 @main() {
%1 = alloca i32
%2 = load i32, i32* @stdout
%3 = tail call i32 @setbuf(i32 %2, i32* null)
%4 = bitcast i32* %1 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = icmp ne i32 %6, 1
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 1
%10 = select i1 %7, i1 true, i1 %9
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %16
13: ; preds = %0
%14 = call i32 @count(i32 %8)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %13, %11
%17 = phi i32 [ -1, %11 ], [ 0, %13 ]
ret i32 %17
}