#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;
  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");
  while (aStart <= aEnd) {
    float result = calculateValue(aStart);
    if (isnan(result)) {
      printf("a = %d\t\tNo solution for this value\n", aStart);
    } else {
      printf("a = %d\t\t%.2f\n", aStart, result);
    }
    aStart += aStep;
  }
  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    1222 <main+0xe2>
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     121b <main+0xdb>
mov    -0x8(%rbp),%edi
call   1030 <calculateValue@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
call   1050 <isnan@plt>
cmp    $0x0,%rax
je     11f3 <main+0xb3>
mov    -0x8(%rbp),%esi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    120d <main+0xcd>
mov    -0x8(%rbp),%esi
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe9e(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11b0 <main+0x70>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x10(%rsp)
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8e(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1070 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    0xc(%rsp),%eax
jle    11a3 <main+0x53>
lea    0xf08(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
jmp    121d <main+0xcd>
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rsp),%edi
xor    %eax,%eax
cmp    0xc(%rsp),%edi
jg     121d <main+0xcd>
lea    0xe6b(%rip),%r14
lea    0xe40(%rip),%rbx
jmp    11f6 <main+0xa6>
nopl   0x0(%rax,%rax,1)
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x8(%rsp),%edi
add    0x10(%rsp),%edi
mov    %edi,0x8(%rsp)
cmp    0xc(%rsp),%edi
jg     121b <main+0xcb>
call   1040 <calculateValue@plt>
movss  %xmm0,0x14(%rsp)
call   1060 <isnan@plt>
mov    0x8(%rsp),%esi
test   %rax,%rax
je     11d0 <main+0x80>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11e4 <main+0x94>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
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 float
store i32 0, i32* %1
store i32 0, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([87 x i8], [87 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = icmp sgt i32 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %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 %38
13: ; preds = %0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %15
15: ; preds = %33, %13
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %37
19: ; preds = %15
%20 = load i32, i32* %2
%21 = call float @calculateValue(i32 %20)
store float %21, float* %5
%22 = load float, float* %5
%23 = call i64 @isnan(float %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %19
%26 = load i32, i32* %2
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %26)
br label %33
28: ; preds = %19
%29 = load i32, i32* %2
%30 = load float, float* %5
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %29, double %31)
br label %33
33: ; preds = %28, %25
%34 = load i32, i32* %4
%35 = load i32, i32* %2
%36 = add nsw i32 %35, %34
store i32 %36, i32* %2
br label %15
37: ; preds = %15
store i32 0, i32* %1
br label %38
38: ; preds = %37, %11
%39 = load i32, i32* %1
ret i32 %39
}

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 %36
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 %36, label %19
19: ; preds = %14, %30
%20 = phi i32 [ %33, %30 ], [ %16, %14 ]
%21 = call float @calculateValue(i32 %20)
%22 = call i64 @isnan(float %21)
%23 = icmp eq i64 %22, 0
%24 = load i32, i32* %1
br i1 %23, label %27, label %25
25: ; preds = %19
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %24)
br label %30
27: ; preds = %19
%28 = fpext float %21 to double
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %24, double %28)
br label %30
30: ; preds = %27, %25
%31 = load i32, i32* %3
%32 = load i32, i32* %1
%33 = add nsw i32 %32, %31
store i32 %33, i32* %1
%34 = load i32, i32* %2
%35 = icmp sgt i32 %33, %34
br i1 %35, label %36, label %19
36: ; preds = %30, %14, %12
%37 = phi i32 [ 1, %12 ], [ 0, %14 ], [ 0, %30 ]
ret i32 %37
}