#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 *a, int *b, int *c, int *init, int *final, int *rectNum) {
  printf("Enter integer coefficients [a b c]: ");
  scanf("%d %d %d", a, b, c);
  printf("Enter the initial value of x: ");
  scanf("%d", init);
  *final = *init - 1;
  while (*final <= *init) {
    printf("Enter the final value of x: ");
    scanf("%d", final);
    if (*final <= *init)
      printf("\nError! Final must be greater than initial!!\n");
  }
  while (*rectNum <= 0) {
    printf("Please enter the number of approximating rectangles: ");
    scanf("%d", rectNum);
    if (*rectNum <= 0)
      printf("\nError! Number of rectangles must be positive!!\n");
  }
  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>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jg     11e6 <inputData+0xc6>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jg     11e1 <inputData+0xc1>
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
jmp    1193 <inputData+0x73>
jmp    11eb <inputData+0xcb>
mov    -0x30(%rbp),%rax
cmpl   $0x0,(%rax)
jg     1234 <inputData+0x114>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x30(%rbp),%rax
cmpl   $0x0,(%rax)
jg     122f <inputData+0x10f>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
jmp    11eb <inputData+0xcb>
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),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    (%r15),%eax
add    $0xffffffff,%eax
mov    %eax,(%rbx)
cmp    (%r15),%eax
jle    11f8 <inputData+0xc8>
cmpl   $0x0,(%r14)
jg     11e9 <inputData+0xb9>
lea    0xec3(%rip),%r15
lea    0xe7d(%rip),%rbp
lea    0xeeb(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,(%r14)
jg     11e9 <inputData+0xb9>
mov    %rbx,%rdi
call   1030 <puts@plt>
cmpl   $0x0,(%r14)
jle    11c0 <inputData+0x90>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe4e(%rip),%r12
lea    0xe25(%rip),%r13
lea    0xec3(%rip),%rbp
jmp    1214 <inputData+0xe4>
nop
cmp    %ecx,%eax
jg     119a <inputData+0x6a>
mov    %r12,%rdi
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    (%rbx),%eax
mov    (%r15),%ecx
cmp    %ecx,%eax
jg     1210 <inputData+0xe0>
mov    %rbp,%rdi
call   1030 <puts@plt>
mov    (%rbx),%eax
mov    (%r15),%ecx
jmp    1210 <inputData+0xe0>

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 = [46 x i8] c"\0AError! Final must be greater than initial!!\0A\00"
@.str.6 = [54 x i8] c"Please 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)
%21 = load i32*, i32** %10
%22 = load i32, i32* %21
%23 = sub nsw i32 %22, 1
%24 = load i32*, i32** %11
store i32 %23, i32* %24
br label %25
25: ; preds = %42, %6
%26 = load i32*, i32** %11
%27 = load i32, i32* %26
%28 = load i32*, i32** %10
%29 = load i32, i32* %28
%30 = icmp sle i32 %27, %29
br i1 %30, label %31, label %43
31: ; preds = %25
%32 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%33 = load i32*, i32** %11
%34 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %33)
%35 = load i32*, i32** %11
%36 = load i32, i32* %35
%37 = load i32*, i32** %10
%38 = load i32, i32* %37
%39 = icmp sle i32 %36, %38
br i1 %39, label %40, label %42
40: ; preds = %31
%41 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0))
br label %42
42: ; preds = %40, %31
br label %25
43: ; preds = %25
br label %44
44: ; preds = %57, %43
%45 = load i32*, i32** %12
%46 = load i32, i32* %45
%47 = icmp sle i32 %46, 0
br i1 %47, label %48, label %58
48: ; preds = %44
%49 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0))
%50 = load i32*, i32** %12
%51 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %50)
%52 = load i32*, i32** %12
%53 = load i32, i32* %52
%54 = icmp sle i32 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %48
%56 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0))
br label %57
57: ; preds = %55, %48
br label %44
58: ; preds = %44
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 = [54 x i8] c"Please enter the number of approximating rectangles: \00"
@str = [48 x i8] c"\0AError! Number of rectangles must be positive!!\00"
@str.8 = [45 x i8] c"\0AError! Final must be greater than initial!!\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)
%11 = load i32, i32* %3
%12 = add nsw i32 %11, -1
store i32 %12, i32* %4
%13 = load i32, i32* %3
%14 = icmp sgt i32 %12, %13
br i1 %14, label %15, label %18
15: ; preds = %28, %6
%16 = load i32, i32* %5
%17 = icmp slt i32 %16, 1
br i1 %17, label %32, label %41
18: ; preds = %6, %28
%19 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%20 = tail call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%21 = load i32, i32* %4
%22 = load i32, i32* %3
%23 = icmp sgt i32 %21, %22
br i1 %23, label %28, label %24
24: ; preds = %18
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.8, i64 0, i64 0))
%26 = load i32, i32* %4
%27 = load i32, i32* %3
br label %28
28: ; preds = %24, %18
%29 = phi i32 [ %27, %24 ], [ %22, %18 ]
%30 = phi i32 [ %26, %24 ], [ %21, %18 ]
%31 = icmp sgt i32 %30, %29
br i1 %31, label %15, label %18
32: ; preds = %15, %37
%33 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0))
%34 = tail call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %5)
%35 = load i32, i32* %5
%36 = icmp slt i32 %35, 1
br i1 %36, label %37, label %41
37: ; preds = %32
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%39 = load i32, i32* %5
%40 = icmp slt i32 %39, 1
br i1 %40, label %32, label %41
41: ; preds = %32, %37, %15
ret void
}