#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 EOF;
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *);
int scanf(char *, ...);
void fetchInput(double *principal, double *annual_input, int *num_payments) {
  printf("Enter the principal of the loan: ");
  int value = scanf("%lf", principal);
  if (value == EOF || value == 0) {
    assert(false);
  }
  printf("Enter the annual interest rate: ");
  value = scanf("%lf", annual_input);
  if (value == EOF || value == 0) {
    assert(false);
  }
  printf("Enter the total number of payments: ");
  value = scanf("%d", num_payments);
  if (value == EOF || value == 0) {
    assert(false);
  }
}


x86 assembly (clang, -O0):
<fetchInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2e79(%rip),%rcx
cmp    (%rcx),%eax
je     1181 <fetchInput+0x51>
cmpl   $0x0,-0x1c(%rbp)
jne    1188 <fetchInput+0x58>
xor    %edi,%edi
call   1040 <assert@plt>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2e35(%rip),%rcx
cmp    (%rcx),%eax
je     11c5 <fetchInput+0x95>
cmpl   $0x0,-0x1c(%rbp)
jne    11cc <fetchInput+0x9c>
xor    %edi,%edi
call   1040 <assert@plt>
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2df1(%rip),%rcx
cmp    (%rcx),%eax
je     1209 <fetchInput+0xd9>
cmpl   $0x0,-0x1c(%rbp)
jne    1210 <fetchInput+0xe0>
xor    %edi,%edi
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fetchInput>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x2e86(%rip),%rbx
test   %eax,%eax
je     116a <fetchInput+0x3a>
cmp    (%rbx),%eax
jne    1171 <fetchInput+0x41>
xor    %edi,%edi
call   1040 <assert@plt>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9e(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
test   %eax,%eax
je     1196 <fetchInput+0x66>
cmp    (%rbx),%eax
jne    119d <fetchInput+0x6d>
xor    %edi,%edi
call   1040 <assert@plt>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
test   %eax,%eax
je     11c8 <fetchInput+0x98>
cmp    (%rbx),%eax
je     11c8 <fetchInput+0x98>
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %edi,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <assert@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"Enter the principal of the loan: \00"
@.str.1 = [4 x i8] c"%lf\00"
@EOF = global i32 0
@.str.2 = [33 x i8] c"Enter the annual interest rate: \00"
@.str.3 = [37 x i8] c"Enter the total number of payments: \00"
@.str.4 = [3 x i8] c"%d\00"
define void @fetchInput(double* %0, double* %1, i32* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32*
%7 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store i32* %2, i32** %6
%8 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%9 = load double*, double** %4
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %9)
store i32 %10, i32* %7
%11 = load i32, i32* %7
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %17, label %14
14: ; preds = %3
%15 = load i32, i32* %7
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14, %3
%18 = call i32 @assert(i32 0)
br label %19
19: ; preds = %17, %14
%20 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%21 = load double*, double** %5
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %21)
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = load i32, i32* @EOF
%25 = icmp eq i32 %23, %24
br i1 %25, label %29, label %26
26: ; preds = %19
%27 = load i32, i32* %7
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26, %19
%30 = call i32 @assert(i32 0)
br label %31
31: ; preds = %29, %26
%32 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%33 = load i32*, i32** %6
%34 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %33)
store i32 %34, i32* %7
%35 = load i32, i32* %7
%36 = load i32, i32* @EOF
%37 = icmp eq i32 %35, %36
br i1 %37, label %41, label %38
38: ; preds = %31
%39 = load i32, i32* %7
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %38, %31
%42 = call i32 @assert(i32 0)
br label %43
43: ; preds = %41, %38
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"Enter the principal of the loan: \00"
@.str.1 = [4 x i8] c"%lf\00"
@EOF = global i32 0
@.str.2 = [33 x i8] c"Enter the annual interest rate: \00"
@.str.3 = [37 x i8] c"Enter the total number of payments: \00"
@.str.4 = [3 x i8] c"%d\00"
define void @fetchInput(double* %0, double* %1, i32* %2) {
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %0)
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
%8 = icmp eq i32 %5, 0
%9 = or i1 %8, %7
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = tail call i32 @assert(i32 0)
br label %12
12: ; preds = %3, %10
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%14 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%15 = load i32, i32* @EOF
%16 = icmp eq i32 %14, %15
%17 = icmp eq i32 %14, 0
%18 = or i1 %17, %16
br i1 %18, label %19, label %21
19: ; preds = %12
%20 = tail call i32 @assert(i32 0)
br label %21
21: ; preds = %12, %19
%22 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%23 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %2)
%24 = load i32, i32* @EOF
%25 = icmp eq i32 %23, %24
%26 = icmp eq i32 %23, 0
%27 = or i1 %26, %25
br i1 %27, label %28, label %30
28: ; preds = %21
%29 = tail call i32 @assert(i32 0)
br label %30
30: ; preds = %21, %28
ret void
}