#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, ...);
void inputData(int *coeff_a, int *coeff_b, int *coeff_c, int *initial,
               int *final, int *rectNum) {
  printf("Enter integer coefficients [a b c]: ");
  scanf("%d %d %d", coeff_a, coeff_b, coeff_c);
  printf("Enter the initial value of x: ");
  scanf("%d", initial);
  do {
    printf("Enter the final value of x: ");
    scanf("%d", final);
    if (*final <= *initial)
      printf("\nError! Final must be greater than initial!!\n\n");
  } while (*final <= *initial);
  do {
    printf("\nPlease enter the number of approximating rectangles: ");
    scanf("%d", rectNum);
    if (*rectNum <= 0)
      printf("\nError! Number of rectangles must be positive!!\n");
  } while (*rectNum <= 0);
  return;
}


x86 assembly (clang, -O0):
<inputData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jg     11c0 <inputData+0xa0>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
jmp    11c5 <inputData+0xa5>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jle    1184 <inputData+0x64>
jmp    11dc <inputData+0xbc>
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x30(%rbp),%rax
cmpl   $0x0,(%rax)
jg     1213 <inputData+0xf3>
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
jmp    1218 <inputData+0xf8>
mov    -0x30(%rbp),%rax
cmpl   $0x0,(%rax)
jle    11dc <inputData+0xbc>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inputData>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r14
mov    %r8,%rbx
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbp
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
mov    %rbp,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
lea    0xea8(%rip),%r12
mov    %r12,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xeb6(%rip),%r13
lea    0xf33(%rip),%rbp
jmp    11a4 <inputData+0x74>
cmp    %ecx,%eax
jg     11d1 <inputData+0xa1>
mov    %r13,%rdi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    (%rbx),%eax
mov    (%r15),%ecx
cmp    %ecx,%eax
jg     11a0 <inputData+0x70>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    (%rbx),%eax
mov    (%r15),%ecx
jmp    11a0 <inputData+0x70>
lea    0xe92(%rip),%r15
lea    0xe4c(%rip),%rbp
lea    0xebb(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,(%r14)
jg     1219 <inputData+0xe9>
mov    %rbx,%rdi
call   1030 <puts@plt>
cmpl   $0x0,(%r14)
jle    11f0 <inputData+0xc0>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Enter integer coefficients [a b c]: \00"
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [31 x i8] c"Enter the initial value of x: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [29 x i8] c"Enter the final value of x: \00"
@.str.5 = [47 x i8] c"\0AError! Final must be greater than initial!!\0A\0A\00"
@.str.6 = [55 x i8] c"\0APlease enter the number of approximating rectangles: \00"
@.str.7 = [49 x i8] c"\0AError! Number of rectangles must be positive!!\0A\00"
define void @inputData(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5) {
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
store i32* %0, i32** %7
store i32* %1, i32** %8
store i32* %2, i32** %9
store i32* %3, i32** %10
store i32* %4, i32** %11
store i32* %5, i32** %12
%13 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%14 = load i32*, i32** %7
%15 = load i32*, i32** %8
%16 = load i32*, i32** %9
%17 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %14, i32* %15, i32* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%19 = load i32*, i32** %10
%20 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %19)
br label %21
21: ; preds = %33, %6
%22 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%23 = load i32*, i32** %11
%24 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %23)
%25 = load i32*, i32** %11
%26 = load i32, i32* %25
%27 = load i32*, i32** %10
%28 = load i32, i32* %27
%29 = icmp sle i32 %26, %28
br i1 %29, label %30, label %32
30: ; preds = %21
%31 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0))
br label %32
32: ; preds = %30, %21
br label %33
33: ; preds = %32
%34 = load i32*, i32** %11
%35 = load i32, i32* %34
%36 = load i32*, i32** %10
%37 = load i32, i32* %36
%38 = icmp sle i32 %35, %37
br i1 %38, label %21, label %39
39: ; preds = %33
br label %40
40: ; preds = %50, %39
%41 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.6, i64 0, i64 0))
%42 = load i32*, i32** %12
%43 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %42)
%44 = load i32*, i32** %12
%45 = load i32, i32* %44
%46 = icmp sle i32 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %40
%48 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0))
br label %49
49: ; preds = %47, %40
br label %50
50: ; preds = %49
%51 = load i32*, i32** %12
%52 = load i32, i32* %51
%53 = icmp sle i32 %52, 0
br i1 %53, label %40, label %54
54: ; preds = %50
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"Enter integer coefficients [a b c]: \00"
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [31 x i8] c"Enter the initial value of x: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [29 x i8] c"Enter the final value of x: \00"
@.str.6 = [55 x i8] c"\0APlease enter the number of approximating rectangles: \00"
@str = [48 x i8] c"\0AError! Number of rectangles must be positive!!\00"
@str.8 = [46 x i8] c"\0AError! Final must be greater than initial!!\0A\00"
define void @inputData(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5) {
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %0, i32* %1, i32* %2)
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
br label %11
11: ; preds = %21, %6
%12 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%13 = tail call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%14 = load i32, i32* %4
%15 = load i32, i32* %3
%16 = icmp sgt i32 %14, %15
br i1 %16, label %21, label %17
17: ; preds = %11
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.8, i64 0, i64 0))
%19 = load i32, i32* %4
%20 = load i32, i32* %3
br label %21
21: ; preds = %11, %17
%22 = phi i32 [ %15, %11 ], [ %20, %17 ]
%23 = phi i32 [ %14, %11 ], [ %19, %17 ]
%24 = icmp sgt i32 %23, %22
br i1 %24, label %25, label %11
25: ; preds = %21, %30
%26 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.6, i64 0, i64 0))
%27 = tail call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%28 = load i32, i32* %5
%29 = icmp slt i32 %28, 1
br i1 %29, label %30, label %34
30: ; preds = %25
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%32 = load i32, i32* %5
%33 = icmp slt i32 %32, 1
br i1 %33, label %25, label %34
34: ; preds = %25, %30
ret void
}