#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 */
float calculateValue(int);
scalar_t__ isnan(float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main() {
  int aStart, aEnd, aStep = 0;
  int i;
  printf("Please, specify a(min), a(max) and a(step) values (space separated) "
         "and press <Enter>\n");
  scanf("%d %d %d", &aStart, &aEnd, &aStep);
  if (aStart > aEnd) {
    printf("Incorrect range\n");
    return 1;
  }
  printf("Value\t\tResult\n");
  for (i = aStart; i <= aEnd; i = i + aStep) {
    float result = calculateValue(i);
    if (isnan(result)) {
      printf("a = %d\t\tNo solution for this value\n", i);
    } else {
      printf("a = %d\t\t%.2f\n", i, result);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeec(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11a2 <main+0x62>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    122d <main+0xed>
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1226 <main+0xe6>
mov    -0x14(%rbp),%edi
call   1030 <calculateValue@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
call   1050 <isnan@plt>
cmp    $0x0,%rax
je     11f9 <main+0xb9>
mov    -0x14(%rbp),%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1213 <main+0xd3>
mov    -0x14(%rbp),%esi
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe98(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1218 <main+0xd8>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11b6 <main+0x76>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0x4(%rsp)
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8c(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
lea    0x4(%rsp),%rcx
call   1070 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    (%rsp),%eax
jle    11a2 <main+0x52>
lea    0xf09(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
jmp    1216 <main+0xc6>
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%ebx
xor    %eax,%eax
cmp    (%rsp),%ebx
jg     1216 <main+0xc6>
lea    0xe6d(%rip),%r14
lea    0xe42(%rip),%r15
jmp    11ef <main+0x9f>
nopl   0x0(%rax)
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1050 <printf@plt>
add    0x4(%rsp),%ebx
cmp    (%rsp),%ebx
jg     1214 <main+0xc4>
mov    %ebx,%edi
call   1040 <calculateValue@plt>
movss  %xmm0,0xc(%rsp)
call   1060 <isnan@plt>
test   %rax,%rax
je     11d0 <main+0x80>
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11e6 <main+0x96>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [87 x i8] c"Please, specify a(min), a(max) and a(step) values (space separated) and press <Enter>\0A\00"
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [17 x i8] c"Incorrect range\0A\00"
@.str.3 = [15 x i8] c"Value\09\09Result\0A\00"
@.str.4 = [36 x i8] c"a = %d\09\09No solution for this value\0A\00"
@.str.5 = [14 x i8] c"a = %d\09\09%.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
store i32 0, i32* %1
store i32 0, i32* %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = icmp sgt i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = 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 %41
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%16 = load i32, i32* %2
store i32 %16, i32* %5
br label %17
17: ; preds = %36, %14
%18 = load i32, i32* %5
%19 = load i32, i32* %3
%20 = icmp sle i32 %18, %19
br i1 %20, label %21, label %40
21: ; preds = %17
%22 = load i32, i32* %5
%23 = call float @calculateValue(i32 %22)
store float %23, float* %6
%24 = load float, float* %6
%25 = call i64 @isnan(float %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %21
%28 = load i32, i32* %5
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %28)
br label %35
30: ; preds = %21
%31 = load i32, i32* %5
%32 = load float, float* %6
%33 = fpext float %32 to double
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %31, double %33)
br label %35
35: ; preds = %30, %27
br label %36
36: ; preds = %35
%37 = load i32, i32* %5
%38 = load i32, i32* %4
%39 = add nsw i32 %37, %38
store i32 %39, i32* %5
br label %17
40: ; preds = %17
store i32 0, i32* %1
br label %41
41: ; preds = %40, %12
%42 = load i32, i32* %1
ret i32 %42
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.4 = [36 x i8] c"a = %d\09\09No solution for this value\0A\00"
@.str.5 = [14 x i8] c"a = %d\09\09%.2f\0A\00"
@str = [86 x i8] c"Please, specify a(min), a(max) and a(step) values (space separated) and press <Enter>\00"
@str.6 = [14 x i8] c"Value\09\09Result\00"
@str.7 = [16 x i8] c"Incorrect range\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([86 x i8], [86 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = icmp sgt i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.7, i64 0, i64 0))
br label %34
14: ; preds = %0
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.6, i64 0, i64 0))
%16 = load i32, i32* %1
%17 = load i32, i32* %2
%18 = icmp sgt i32 %16, %17
br i1 %18, label %34, label %19
19: ; preds = %14, %29
%20 = phi i32 [ %31, %29 ], [ %16, %14 ]
%21 = call float @calculateValue(i32 %20)
%22 = call i64 @isnan(float %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %19
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %20)
br label %29
26: ; preds = %19
%27 = fpext float %21 to double
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %20, double %27)
br label %29
29: ; preds = %26, %24
%30 = load i32, i32* %3
%31 = add nsw i32 %30, %20
%32 = load i32, i32* %2
%33 = icmp sgt i32 %31, %32
br i1 %33, label %34, label %19
34: ; preds = %29, %14, %12
%35 = phi i32 [ 1, %12 ], [ 0, %14 ], [ 0, %29 ]
ret i32 %35
}