#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 getchar();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int sqrt(int);
int /*<<< orphan*/ sscanf(char *, char *, float *);
main(int argc, char *argv[]) {
  int band, junk;
  float tint, delnu, dels, deli;
  char line[1000];
  printf("Enter the band of the observation (L, C, X, etc.):  ");
  band = getchar();
  while ((junk = getchar()) != '\n')
    ;
  switch (band) {
  case 'l':
  case 'L':
    dels = 0.38;
    break;
  case 'c':
  case 'C':
    dels = 0.35;
    break;
  case 'x':
  case 'X':
    dels = 0.29;
    break;
  case 'u':
  case 'U':
    dels = 1.14;
    break;
  case 'k':
  case 'K':
    dels = 2.0;
    break;
  default:
    printf("\nThat band is not supported.  Exiting program\n\n");
    return 0;
  }
  printf("\nEnter the bandwidth in MHz:  ");
  gets(line);
  sscanf(line, "%f", &delnu);
  printf("The bandwidth is %6.1f MHz.\n\n", delnu);
  printf("Enter the integration time in seconds:  ");
  gets(line);
  sscanf(line, "%f", &tint);
  printf("The integration time is %5.0f sec.\n\n", tint);
  deli = 1000 * 1 * dels / sqrt(2 * 27 * (27 - 1) * tint * delnu / 2);
  printf("The theoretical noise with this setup is %f mJy/beam.\n\n", deli);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xf84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xa,%eax
je     1199 <main+0x49>
jmp    1181 <main+0x31>
mov    -0x14(%rbp),%eax
add    $0xffffffbd,%eax
mov    %eax,%ecx
mov    %rcx,-0x418(%rbp)
sub    $0x35,%eax
ja     1222 <main+0xd2>
mov    -0x418(%rbp),%rax
lea    0xe5d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0xe40(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    123c <main+0xec>
movss  0xe2a(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    123c <main+0xec>
movss  0xe14(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    123c <main+0xec>
movss  0xdfe(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    123c <main+0xec>
movss  0xde8(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    123c <main+0xec>
lea    0xf00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    133b <main+0x1eb>
lea    0xf16(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x410(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x410(%rbp),%rdi
lea    0xf14(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1060 <sscanf@plt>
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xefe(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xf0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x410(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x410(%rbp),%rdi
lea    0xecc(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1060 <sscanf@plt>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xefd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0xd44(%rip),%xmm0
mulss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x41c(%rbp)
ff
movss  0xd2b(%rip),%xmm0
mulss  -0x1c(%rbp),%xmm0
mulss  -0x20(%rbp),%xmm0
movss  0xd05(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1070 <sqrt@plt>
movss  -0x41c(%rbp),%xmm0
ff
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeba(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3f8,%rsp
lea    0xf83(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%eax
jne    1190 <main+0x30>
add    $0xffffffbd,%ebx
cmp    $0x35,%ebx
ja     12cc <main+0x16c>
movss  0xe50(%rip),%xmm0
lea    0xe65(%rip),%rax
movslq (%rax,%rbx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
movss  0xe48(%rip),%xmm0
jmp    11e6 <main+0x86>
movss  0xe32(%rip),%xmm0
jmp    11e6 <main+0x86>
movss  0xe2c(%rip),%xmm0
jmp    11e6 <main+0x86>
movss  0xe26(%rip),%xmm0
movss  %xmm0,0xc(%rsp)
lea    0xf36(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
lea    0xf3a(%rip),%r14
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <sscanf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xf1c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xf2c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1060 <gets@plt>
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <sscanf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xf25(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
mulss  0xd92(%rip),%xmm0
mulss  0x4(%rsp),%xmm0
mulss  0xd88(%rip),%xmm0
cvttss2si %xmm0,%edi
call   1080 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0xc(%rsp),%xmm1
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xeff(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x3f8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xf1c(%rip),%rdi
call   1030 <puts@plt>
jmp    12bf <main+0x15f>

LLVM IR (-O0):
@.str = [53 x i8] c"Enter the band of the observation (L, C, X, etc.): \00"
@.str.1 = [48 x i8] c"\0AThat band is not supported. Exiting program\0A\0A\00"
@.str.2 = [31 x i8] c"\0AEnter the bandwidth in MHz: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [30 x i8] c"The bandwidth is %6.1f MHz.\0A\0A\00"
@.str.5 = [41 x i8] c"Enter the integration time in seconds: \00"
@.str.6 = [37 x i8] c"The integration time is %5.0f sec.\0A\0A\00"
@.str.7 = [56 x i8] c"The theoretical noise with this setup is %f mJy/beam.\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca [1000 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%14 = call i32 (...) @getchar()
store i32 %14, i32* %6
br label %15
15: ; preds = %18, %2
%16 = call i32 (...) @getchar()
store i32 %16, i32* %7
%17 = icmp ne i32 %16, 10
br i1 %17, label %18, label %19
18: ; preds = %15
br label %15
19: ; preds = %15
%20 = load i32, i32* %6
switch i32 %20, label %26 [
i32 108, label %21
i32 76, label %21
i32 99, label %22
i32 67, label %22
i32 120, label %23
i32 88, label %23
i32 117, label %24
i32 85, label %24
i32 107, label %25
i32 75, label %25
]
21: ; preds = %19, %19
store float 0x3FD851EB80000000, float* %10
br label %28
22: ; preds = %19, %19
store float 0x3FD6666660000000, float* %10
br label %28
23: ; preds = %19, %19
store float 0x3FD28F5C20000000, float* %10
br label %28
24: ; preds = %19, %19
store float 0x3FF23D70A0000000, float* %10
br label %28
25: ; preds = %19, %19
store float 2.000000e+00, float* %10
br label %28
26: ; preds = %19
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %59
28: ; preds = %25, %24, %23, %22, %21
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%30 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%31 = call i32 @gets(i8* %30)
%32 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%33 = call i32 @sscanf(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %9)
%34 = load float, float* %9
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), double %35)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%38 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%39 = call i32 @gets(i8* %38)
%40 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%41 = call i32 @sscanf(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %8)
%42 = load float, float* %8
%43 = fpext float %42 to double
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), double %43)
%45 = load float, float* %10
%46 = fmul float 1.000000e+03, %45
%47 = load float, float* %8
%48 = fmul float 1.404000e+03, %47
%49 = load float, float* %9
%50 = fmul float %48, %49
%51 = fdiv float %50, 2.000000e+00
%52 = fptosi float %51 to i32
%53 = call i32 @sqrt(i32 %52)
%54 = sitofp i32 %53 to float
%55 = fdiv float %46, %54
store float %55, float* %11
%56 = load float, float* %11
%57 = fpext float %56 to double
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.7, i64 0, i64 0), double %57)
store i32 0, i32* %3
br label %59
59: ; preds = %28, %26
%60 = load i32, i32* %3
ret i32 %60
}

LLVM IR (-O2):
@.str = [53 x i8] c"Enter the band of the observation (L, C, X, etc.): \00"
@.str.2 = [31 x i8] c"\0AEnter the bandwidth in MHz: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [30 x i8] c"The bandwidth is %6.1f MHz.\0A\0A\00"
@.str.5 = [41 x i8] c"Enter the integration time in seconds: \00"
@.str.6 = [37 x i8] c"The integration time is %5.0f sec.\0A\0A\00"
@.str.7 = [56 x i8] c"The theoretical noise with this setup is %f mJy/beam.\0A\0A\00"
@str = [47 x i8] c"\0AThat band is not supported. Exiting program\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca [1000 x i8]
%6 = bitcast float* %3 to i8*
%7 = bitcast float* %4 to i8*
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 (...) @getchar()
br label %11
11: ; preds = %11, %2
%12 = tail call i32 (...) @getchar()
%13 = icmp eq i32 %12, 10
br i1 %13, label %14, label %11
14: ; preds = %11
switch i32 %10, label %19 [
i32 108, label %21
i32 76, label %21
i32 99, label %15
i32 67, label %15
i32 120, label %16
i32 88, label %16
i32 117, label %17
i32 85, label %17
i32 107, label %18
i32 75, label %18
]
15: ; preds = %14, %14
br label %21
16: ; preds = %14, %14
br label %21
17: ; preds = %14, %14
br label %21
18: ; preds = %14, %14
br label %21
19: ; preds = %14
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
br label %46
21: ; preds = %14, %14, %18, %17, %16, %15
%22 = phi float [ 2.000000e+03, %18 ], [ 1.140000e+03, %17 ], [ 2.900000e+02, %16 ], [ 3.500000e+02, %15 ], [ 3.800000e+02, %14 ], [ 3.800000e+02, %14 ]
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 @gets(i8* %8)
%25 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %4)
%26 = load float, float* %4
%27 = fpext float %26 to double
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), double %27)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0))
%30 = call i32 @gets(i8* %8)
%31 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %3)
%32 = load float, float* %3
%33 = fpext float %32 to double
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0), double %33)
%35 = load float, float* %3
%36 = fmul float %35, 1.404000e+03
%37 = load float, float* %4
%38 = fmul float %36, %37
%39 = fmul float %38, 5.000000e-01
%40 = fptosi float %39 to i32
%41 = call i32 @sqrt(i32 %40)
%42 = sitofp i32 %41 to float
%43 = fdiv float %22, %42
%44 = fpext float %43 to double
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.7, i64 0, i64 0), double %44)
br label %46
46: ; preds = %21, %19
ret i32 0
}