#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 */
double fig_ml_hr(double);
int /*<<< orphan*/ get_kg_rate_conc(double *);
int get_problem();
int /*<<< orphan*/ get_rate_drop_factor(double *);
int /*<<< orphan*/ get_units_conc(double *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
void main() {
  int choice;
  printf("\nINTRAVENOUS RATE ASSISTANT");
  while ((choice = get_problem()) != 5) {
    double rate;
    if (choice == 1) {
      get_rate_drop_factor(&rate);
      printf("\nThe drop rate per minute is %.2f", rate);
    } else if (choice == 2) {
      double no_hrs;
      printf("\nEnter number of hours=>");
      scanf("%lf", &no_hrs);
      rate = fig_ml_hr(no_hrs);
      printf("\nThe rate in milliliters per hour is %.2f", rate);
    } else if (choice == 3) {
      get_kg_rate_conc(&rate);
      printf("\nThe rate in milliliters per hour is %.2f", rate);
    } else if (choice == 4) {
      get_units_conc(&rate);
      printf("\nThe rate in milliliters per hour is %.2f", rate);
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <get_problem@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x5,%eax
je     1278 <main+0x108>
cmpl   $0x1,-0x4(%rbp)
jne    11c4 <main+0x54>
lea    -0x10(%rbp),%rdi
call   1080 <get_rate_drop_factor@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xe64(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1273 <main+0x103>
cmpl   $0x2,-0x4(%rbp)
jne    1213 <main+0xa3>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe74(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <scanf@plt>
movsd  -0x18(%rbp),%xmm0
call   1090 <fig_ml_hr@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xe54(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    126e <main+0xfe>
cmpl   $0x3,-0x4(%rbp)
jne    123e <main+0xce>
lea    -0x10(%rbp),%rdi
call   1070 <get_kg_rate_conc@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xe29(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1269 <main+0xf9>
cmpl   $0x4,-0x4(%rbp)
jne    1264 <main+0xf4>
lea    -0x10(%rbp),%rdi
call   1050 <get_units_conc@plt>
movsd  -0x10(%rbp),%xmm0
lea    0xdfe(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1269 <main+0xf9>
jmp    126e <main+0xfe>
jmp    1273 <main+0x103>
jmp    1186 <main+0x16>
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe7b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <get_problem@plt>
cmp    $0x5,%eax
jne    11c1 <main+0x41>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe38(%rip),%r14
lea    0x8(%rsp),%rbx
lea    0xe7a(%rip),%r15
lea    0xe8c(%rip),%r12
lea    0x10(%rsp),%r13
lea    0xe84(%rip),%rbp
jmp    1214 <main+0x94>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1060 <get_units_conc@plt>
movsd  0x8(%rsp),%xmm0
mov    %rbp,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
call   1040 <get_problem@plt>
cmp    $0x5,%eax
je     11a8 <main+0x28>
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     1208 <main+0x88>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
mov    %rbx,%rdi
call   1090 <get_rate_drop_factor@plt>
movsd  0x8(%rsp),%xmm0
lea    0xdf2(%rip),%rdi
jmp    1201 <main+0x81>
nopl   0x0(%rax)
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1070 <scanf@plt>
movsd  0x10(%rsp),%xmm0
call   10a0 <fig_ml_hr@plt>
movsd  %xmm0,0x8(%rsp)
jmp    11fe <main+0x7e>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1080 <get_kg_rate_conc@plt>
jmp    11f8 <main+0x78>

LLVM IR (-O0):
@.str = [28 x i8] c"\0AINTRAVENOUS RATE ASSISTANT\00"
@.str.1 = [34 x i8] c"\0AThe drop rate per minute is %.2f\00"
@.str.2 = [25 x i8] c"\0AEnter number of hours=>\00"
@.str.3 = [4 x i8] c"%lf\00"
@.str.4 = [42 x i8] c"\0AThe rate in milliliters per hour is %.2f\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %42, %0
%6 = call i32 (...) @get_problem()
store i32 %6, i32* %1
%7 = icmp ne i32 %6, 5
br i1 %7, label %8, label %43
8: ; preds = %5
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = call i32 @get_rate_drop_factor(double* %2)
%13 = load double, double* %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %13)
br label %42
15: ; preds = %8
%16 = load i32, i32* %1
%17 = icmp eq i32 %16, 2
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %3)
%21 = load double, double* %3
%22 = call double @fig_ml_hr(double %21)
store double %22, double* %2
%23 = load double, double* %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), double %23)
br label %41
25: ; preds = %15
%26 = load i32, i32* %1
%27 = icmp eq i32 %26, 3
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = call i32 @get_kg_rate_conc(double* %2)
%30 = load double, double* %2
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), double %30)
br label %40
32: ; preds = %25
%33 = load i32, i32* %1
%34 = icmp eq i32 %33, 4
br i1 %34, label %35, label %39
35: ; preds = %32
%36 = call i32 @get_units_conc(double* %2)
%37 = load double, double* %2
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), double %37)
br label %39
39: ; preds = %35, %32
br label %40
40: ; preds = %39, %28
br label %41
41: ; preds = %40, %18
br label %42
42: ; preds = %41, %11
br label %5
43: ; preds = %5
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"\0AINTRAVENOUS RATE ASSISTANT\00"
@.str.1 = [34 x i8] c"\0AThe drop rate per minute is %.2f\00"
@.str.2 = [25 x i8] c"\0AEnter number of hours=>\00"
@.str.3 = [4 x i8] c"%lf\00"
@.str.4 = [42 x i8] c"\0AThe rate in milliliters per hour is %.2f\00"
define void @main() {
%1 = alloca double
%2 = alloca double
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @get_problem()
%5 = icmp eq i32 %4, 5
br i1 %5, label %32, label %6
6: ; preds = %0
%7 = bitcast double* %1 to i8*
%8 = bitcast double* %2 to i8*
br label %9
9: ; preds = %6, %29
%10 = phi i32 [ %4, %6 ], [ %30, %29 ]
switch i32 %10, label %29 [
i32 1, label %11
i32 2, label %15
i32 3, label %21
i32 4, label %25
]
11: ; preds = %9
%12 = call i32 @get_rate_drop_factor(double* %1)
%13 = load double, double* %1
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %13)
br label %29
15: ; preds = %9
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double* %2)
%18 = load double, double* %2
%19 = call double @fig_ml_hr(double %18)
store double %19, double* %1
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), double %19)
br label %29
21: ; preds = %9
%22 = call i32 @get_kg_rate_conc(double* %1)
%23 = load double, double* %1
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), double %23)
br label %29
25: ; preds = %9
%26 = call i32 @get_units_conc(double* %1)
%27 = load double, double* %1
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), double %27)
br label %29
29: ; preds = %9, %15, %25, %21, %11
%30 = call i32 (...) @get_problem()
%31 = icmp eq i32 %30, 5
br i1 %31, label %32, label %9
32: ; preds = %29, %0
%33 = call i32 @putchar(i32 10)
ret void
}