#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*/ abort();
double height_to_pressure(float);
int /*<<< orphan*/ input_float(float *);
float pressure_to_height(float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ vis5d_get_ctx_vertical(int, int *, float *);
int /*<<< orphan*/ vis5d_get_size(int, int /*<<< orphan*/, int /*<<< orphan*/,
                                  int /*<<< orphan*/, int /*<<< orphan*/, int *,
                                  int /*<<< orphan*/, int /*<<< orphan*/,
                                  int /*<<< orphan*/);
void prompt_for_vertical_args(int index, int vcs, float vertargs[]) {
  int current_vcs;
  int maxnl, i;
  float pressure;
  vis5d_get_size(index, 0, 0, 0, 0, &maxnl, 0, 0, 0);
  vis5d_get_ctx_vertical(index, &current_vcs, vertargs);
  switch (vcs) {
  case 0:
    printf("Generic linear vertical coordinate system:\n");
    printf("  Bottom Bound (%g): ", vertargs[0]);
    input_float(&vertargs[0]);
    printf("  Level Increment (%g): ", vertargs[1]);
    input_float(&vertargs[1]);
    break;
  case 1:
    printf("Linear, equally spaced levels in km:\n");
    printf("  Bottom Bound (km) (%g): ", vertargs[0]);
    input_float(&vertargs[0]);
    printf("  Level Increment (km) (%g): ", vertargs[1]);
    input_float(&vertargs[1]);
    break;
  case 2:
    printf("Linear, non-equally spaced levels in km:\n");
    for (i = 0; i < maxnl; i++) {
      printf("  Level %d Height (km) (%g): ", i, vertargs[i]);
      input_float(&vertargs[i]);
    }
    break;
  case 3:
    printf("Linear, non-equally spaced levels in mb:\n");
    for (i = 0; i < maxnl; i++) {
      printf("  Level %d Pressure (km) (%g): ", i,
             height_to_pressure(vertargs[i]));
      input_float(&pressure);
      vertargs[i] = pressure_to_height(pressure);
    }
    break;
  default:
    abort();
  }
}


x86 assembly (clang, -O0):
<prompt_for_vertical_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    %rsp,%rax
movl   $0x0,0x10(%rax)
movl   $0x0,0x8(%rax)
movl   $0x0,(%rax)
xor    %r8d,%r8d
lea    -0x18(%rbp),%r9
mov    %r8d,%esi
mov    %r8d,%edx
mov    %r8d,%ecx
call   1060 <vis5d_get_size@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rsi
call   1030 <vis5d_get_ctx_vertical@plt>
mov    -0x8(%rbp),%eax
mov    %rax,-0x28(%rbp)
sub    $0x3,%rax
ja     1389 <prompt_for_vertical_args+0x219>
mov    -0x28(%rbp),%rax
lea    0xe23(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe35(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1080 <input_float@plt>
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe27(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
add    $0x4,%rdi
call   1080 <input_float@plt>
jmp    1390 <prompt_for_vertical_args+0x220>
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe2c(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1080 <input_float@plt>
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe23(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
add    $0x4,%rdi
call   1080 <input_float@plt>
jmp    1390 <prompt_for_vertical_args+0x220>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1307 <prompt_for_vertical_args+0x197>
mov    -0x1c(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe16(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rdi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1080 <input_float@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12b7 <prompt_for_vertical_args+0x147>
jmp    1390 <prompt_for_vertical_args+0x220>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1384 <prompt_for_vertical_args+0x214>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1090 <height_to_pressure@plt>
mov    -0x2c(%rbp),%esi
lea    0xded(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    -0x20(%rbp),%rdi
call   1080 <input_float@plt>
movss  -0x20(%rbp),%xmm0
call   1070 <pressure_to_height@plt>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1321 <prompt_for_vertical_args+0x1b1>
jmp    1390 <prompt_for_vertical_args+0x220>
mov    $0x0,%al
call   1040 <abort@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prompt_for_vertical_args>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r15
mov    %esi,%ebx
mov    %edi,%ebp
sub    $0x8,%rsp
lea    0xc(%rsp),%r9
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
push   $0x0
push   $0x0
push   $0x0
call   1070 <vis5d_get_size@plt>
add    $0x20,%rsp
lea    0xc(%rsp),%rsi
mov    %ebp,%edi
mov    %r15,%rdx
call   1030 <vis5d_get_ctx_vertical@plt>
cmp    $0x3,%ebx
ja     131b <prompt_for_vertical_args+0x19b>
lea    0xe53(%rip),%r14
lea    0xe36(%rip),%r12
lea    0xf4c(%rip),%rdi
mov    %ebx,%eax
lea    0xe16(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe60(%rip),%r14
lea    0xe3e(%rip),%r12
lea    0xf00(%rip),%rdi
call   1050 <puts@plt>
movss  (%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    %r15,%rdi
call   1090 <input_float@plt>
movss  0x4(%r15),%xmm0
add    $0x4,%r15
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    %r15,%rdi
call   1090 <input_float@plt>
jmp    130e <prompt_for_vertical_args+0x18e>
lea    0xe8b(%rip),%rdi
call   1050 <puts@plt>
cmpl   $0x0,0x4(%rsp)
jle    130e <prompt_for_vertical_args+0x18e>
xor    %ebx,%ebx
lea    0xe0b(%rip),%r14
nopl   (%rax)
movss  (%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1060 <printf@plt>
mov    %r15,%rdi
call   1090 <input_float@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     1270 <prompt_for_vertical_args+0xf0>
jmp    130e <prompt_for_vertical_args+0x18e>
lea    0xe0e(%rip),%rdi
call   1050 <puts@plt>
cmpl   $0x0,0x4(%rsp)
jle    130e <prompt_for_vertical_args+0x18e>
xor    %ebx,%ebx
lea    0xdd9(%rip),%r14
lea    0x8(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movss  (%r15,%rbx,4),%xmm0
call   10a0 <height_to_pressure@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1060 <printf@plt>
mov    %r12,%rdi
call   1090 <input_float@plt>
movss  0x8(%rsp),%xmm0
call   1080 <pressure_to_height@plt>
movss  %xmm0,(%r15,%rbx,4)
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
cmp    %rax,%rbx
jl     12d0 <prompt_for_vertical_args+0x150>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"Generic linear vertical coordinate system:\0A\00"
@.str.1 = [22 x i8] c" Bottom Bound (%g): \00"
@.str.2 = [25 x i8] c" Level Increment (%g): \00"
@.str.3 = [38 x i8] c"Linear, equally spaced levels in km:\0A\00"
@.str.4 = [27 x i8] c" Bottom Bound (km) (%g): \00"
@.str.5 = [30 x i8] c" Level Increment (km) (%g): \00"
@.str.6 = [42 x i8] c"Linear, non-equally spaced levels in km:\0A\00"
@.str.7 = [30 x i8] c" Level %d Height (km) (%g): \00"
@.str.8 = [42 x i8] c"Linear, non-equally spaced levels in mb:\0A\00"
@.str.9 = [32 x i8] c" Level %d Pressure (km) (%g): \00"
define void @prompt_for_vertical_args(i32 %0, i32 %1, float* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca float*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca float
store i32 %0, i32* %4
store i32 %1, i32* %5
store float* %2, float** %6
%11 = load i32, i32* %4
%12 = call i32 @vis5d_get_size(i32 %11, i32 0, i32 0, i32 0, i32 0, i32* %8, i32 0, i32 0, i32 0)
%13 = load i32, i32* %4
%14 = load float*, float** %6
%15 = call i32 @vis5d_get_ctx_vertical(i32 %13, i32* %7, float* %14)
%16 = load i32, i32* %5
switch i32 %16, label %103 [
i32 0, label %17
i32 1, label %35
i32 2, label %53
i32 3, label %77
]
17: ; preds = %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%19 = load float*, float** %6
%20 = getelementptr inbounds float, float* %19, i64 0
%21 = load float, float* %20
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), double %22)
%24 = load float*, float** %6
%25 = getelementptr inbounds float, float* %24, i64 0
%26 = call i32 @input_float(float* %25)
%27 = load float*, float** %6
%28 = getelementptr inbounds float, float* %27, i64 1
%29 = load float, float* %28
%30 = fpext float %29 to double
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), double %30)
%32 = load float*, float** %6
%33 = getelementptr inbounds float, float* %32, i64 1
%34 = call i32 @input_float(float* %33)
br label %105
35: ; preds = %3
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%37 = load float*, float** %6
%38 = getelementptr inbounds float, float* %37, i64 0
%39 = load float, float* %38
%40 = fpext float %39 to double
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), double %40)
%42 = load float*, float** %6
%43 = getelementptr inbounds float, float* %42, i64 0
%44 = call i32 @input_float(float* %43)
%45 = load float*, float** %6
%46 = getelementptr inbounds float, float* %45, i64 1
%47 = load float, float* %46
%48 = fpext float %47 to double
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), double %48)
%50 = load float*, float** %6
%51 = getelementptr inbounds float, float* %50, i64 1
%52 = call i32 @input_float(float* %51)
br label %105
53: ; preds = %3
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %9
br label %55
55: ; preds = %73, %53
%56 = load i32, i32* %9
%57 = load i32, i32* %8
%58 = icmp slt i32 %56, %57
br i1 %58, label %59, label %76
59: ; preds = %55
%60 = load i32, i32* %9
%61 = load float*, float** %6
%62 = load i32, i32* %9
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds float, float* %61, i64 %63
%65 = load float, float* %64
%66 = fpext float %65 to double
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i32 %60, double %66)
%68 = load float*, float** %6
%69 = load i32, i32* %9
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds float, float* %68, i64 %70
%72 = call i32 @input_float(float* %71)
br label %73
73: ; preds = %59
%74 = load i32, i32* %9
%75 = add nsw i32 %74, 1
store i32 %75, i32* %9
br label %55
76: ; preds = %55
br label %105
77: ; preds = %3
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %9
br label %79
79: ; preds = %99, %77
%80 = load i32, i32* %9
%81 = load i32, i32* %8
%82 = icmp slt i32 %80, %81
br i1 %82, label %83, label %102
83: ; preds = %79
%84 = load i32, i32* %9
%85 = load float*, float** %6
%86 = load i32, i32* %9
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds float, float* %85, i64 %87
%89 = load float, float* %88
%90 = call double @height_to_pressure(float %89)
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i32 %84, double %90)
%92 = call i32 @input_float(float* %10)
%93 = load float, float* %10
%94 = call float @pressure_to_height(float %93)
%95 = load float*, float** %6
%96 = load i32, i32* %9
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds float, float* %95, i64 %97
store float %94, float* %98
br label %99
99: ; preds = %83
%100 = load i32, i32* %9
%101 = add nsw i32 %100, 1
store i32 %101, i32* %9
br label %79
102: ; preds = %79
br label %105
103: ; preds = %3
%104 = call i32 (...) @abort()
unreachable
105: ; preds = %102, %76, %35, %17
ret void
}

LLVM IR (-O2):
@.str.1 = [22 x i8] c" Bottom Bound (%g): \00"
@.str.2 = [25 x i8] c" Level Increment (%g): \00"
@.str.4 = [27 x i8] c" Bottom Bound (km) (%g): \00"
@.str.5 = [30 x i8] c" Level Increment (km) (%g): \00"
@.str.7 = [30 x i8] c" Level %d Height (km) (%g): \00"
@.str.9 = [32 x i8] c" Level %d Pressure (km) (%g): \00"
@str = [41 x i8] c"Linear, non-equally spaced levels in mb:\00"
@str.10 = [41 x i8] c"Linear, non-equally spaced levels in km:\00"
@str.11 = [37 x i8] c"Linear, equally spaced levels in km:\00"
@str.12 = [43 x i8] c"Generic linear vertical coordinate system:\00"
define void @prompt_for_vertical_args(i32 %0, i32 %1, float* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = bitcast float* %6 to i8*
%10 = call i32 @vis5d_get_size(i32 %0, i32 0, i32 0, i32 0, i32 0, i32* %5, i32 0, i32 0, i32 0)
%11 = call i32 @vis5d_get_ctx_vertical(i32 %0, i32* %4, float* %2)
switch i32 %1, label %47 [
i32 0, label %49
i32 1, label %12
i32 2, label %13
i32 3, label %29
]
12: ; preds = %3
br label %49
13: ; preds = %3
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.10, i64 0, i64 0))
%15 = load i32, i32* %5
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %63
17: ; preds = %13, %17
%18 = phi i64 [ %25, %17 ], [ 0, %13 ]
%19 = getelementptr inbounds float, float* %2, i64 %18
%20 = load float, float* %19
%21 = fpext float %20 to double
%22 = trunc i64 %18 to i32
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i32 %22, double %21)
%24 = call i32 @input_float(float* %19)
%25 = add nuw nsw i64 %18, 1
%26 = load i32, i32* %5
%27 = sext i32 %26 to i64
%28 = icmp slt i64 %25, %27
br i1 %28, label %17, label %63
29: ; preds = %3
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%31 = load i32, i32* %5
%32 = icmp sgt i32 %31, 0
br i1 %32, label %33, label %63
33: ; preds = %29, %33
%34 = phi i64 [ %43, %33 ], [ 0, %29 ]
%35 = getelementptr inbounds float, float* %2, i64 %34
%36 = load float, float* %35
%37 = call double @height_to_pressure(float %36)
%38 = trunc i64 %34 to i32
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i32 %38, double %37)
%40 = call i32 @input_float(float* %6)
%41 = load float, float* %6
%42 = call float @pressure_to_height(float %41)
store float %42, float* %35
%43 = add nuw nsw i64 %34, 1
%44 = load i32, i32* %5
%45 = sext i32 %44 to i64
%46 = icmp slt i64 %43, %45
br i1 %46, label %33, label %63
47: ; preds = %3
%48 = call i32 (...) @abort()
unreachable
49: ; preds = %3, %12
%50 = phi i8* [ getelementptr inbounds ([37 x i8], [37 x i8]* @str.11, i64 0, i64 0), %12 ], [ getelementptr inbounds ([43 x i8], [43 x i8]* @str.12, i64 0, i64 0), %3 ]
%51 = phi i8* [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), %12 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), %3 ]
%52 = phi i8* [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), %12 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), %3 ]
%53 = call i32 @puts(i8* dereferenceable(1) %50)
%54 = load float, float* %2
%55 = fpext float %54 to double
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %51, double %55)
%57 = call i32 @input_float(float* %2)
%58 = getelementptr inbounds float, float* %2, i64 1
%59 = load float, float* %58
%60 = fpext float %59 to double
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %52, double %60)
%62 = call i32 @input_float(float* %58)
br label %63
63: ; preds = %33, %17, %49, %29, %13
ret void
}