int ned_query(cmd_code, s1, d1, d2, d3)
int cmd_code;
char *s1;
double d1, d2, d3;
{
  char *objname, *refcode;
  int begin_year, end_year;
  double ra_j2000;
  double dec_j2000;
  double radius;
  double epoch;
  char style, calendar;
  char cmd[100 + 1];
  int st;
  switch (cmd_code) {
  case 1:
    objname = s1;
    sprintf(cmd, "name_resolver \"%s\"\n", objname);
    break;
  case 2:
    objname = s1;
    sprintf(cmd, "obj_byname \"%s\"\n", objname);
    break;
  case 3:
    objname = s1;
    radius = d1;
    sprintf(cmd, "obj_nearname \"%s\", %.5f\n", objname, radius);
    break;
  case 4:
    ra_j2000 = d1;
    dec_j2000 = d2;
    radius = d3;
    sprintf(cmd, "obj_nearposn %.8f, %.8f, %.5f\n", ra_j2000, dec_j2000,
            radius);
    break;
  case 5:
    objname = s1;
    style = (int)(d1 + 0.5);
    calendar = (int)(d2 + 0.5);
    epoch = d3;
    sprintf(cmd, "obj_iauformat %s, %c, %c, %.3f\n", objname, style, calendar,
            epoch);
    break;
  case 6:
    refcode = s1;
    sprintf(cmd, "expand_refcode %s\n", refcode);
    break;
  case 7:
    objname = s1;
    begin_year = (int)(d1 + 0.5);
    end_year = (int)(d2 + 0.5);
    sprintf(cmd, "ref_objname \"%s\", %d, %d\n", objname, begin_year, end_year);
    break;
  default:
    break;
  }
  st = send_cmd(cmd);
  return (st);
}


x86 assembly (clang, -O0):
<ned_query>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0xe0(%rbp)
sub    $0x6,%eax
ja     1319 <ned_query+0x1f9>
mov    -0xe0(%rbp),%rax
lea    0xea1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0xd0(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xe9a(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    131e <ned_query+0x1fe>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0xd0(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xe88(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    131e <ned_query+0x1fe>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
lea    -0xd0(%rbp),%rdi
mov    -0x30(%rbp),%rdx
movsd  -0x58(%rbp),%xmm0
lea    0xe64(%rip),%rsi
mov    $0x1,%al
call   1030 <sprintf@plt>
jmp    131e <ned_query+0x1fe>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
lea    -0xd0(%rbp),%rdi
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
lea    0xe36(%rip),%rsi
mov    $0x3,%al
call   1030 <sprintf@plt>
jmp    131e <ned_query+0x1fe>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
movsd  0xdb8(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %al,-0x61(%rbp)
movsd  0xda4(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %al,-0x62(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
lea    -0xd0(%rbp),%rdi
mov    -0x30(%rbp),%rdx
movsbl -0x61(%rbp),%ecx
movsbl -0x62(%rbp),%r8d
movsd  -0x60(%rbp),%xmm0
lea    0xdef(%rip),%rsi
mov    $0x1,%al
call   1030 <sprintf@plt>
jmp    131e <ned_query+0x1fe>
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0xd0(%rbp),%rdi
mov    -0x38(%rbp),%rdx
lea    0xde9(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    131e <ned_query+0x1fe>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
movsd  0xd2c(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x3c(%rbp)
movsd  0xd18(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x40(%rbp)
lea    -0xd0(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    -0x3c(%rbp),%ecx
mov    -0x40(%rbp),%r8d
lea    0xda7(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    131e <ned_query+0x1fe>
jmp    131e <ned_query+0x1fe>
lea    -0xd0(%rbp),%rdi
mov    $0x0,%al
call   1040 <send_cmd@plt>
mov    %eax,-0xd4(%rbp)
mov    -0xd4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ned_query>:
sub    $0x68,%rsp
add    $0xffffffff,%edi
cmp    $0x6,%edi
ja     11f1 <ned_query+0xd1>
mov    %rsi,%rdx
lea    0xece(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xeda(%rip),%rsi
jmp    11bb <ned_query+0x9b>
lea    0xee5(%rip),%rsi
jmp    11bb <ned_query+0x9b>
lea    0xeed(%rip),%rsi
mov    %rsp,%rdi
mov    $0x1,%al
call   1030 <sprintf@plt>
jmp    11f1 <ned_query+0xd1>
lea    0xef0(%rip),%rsi
mov    %rsp,%rdi
mov    $0x3,%al
call   1030 <sprintf@plt>
jmp    11f1 <ned_query+0xd1>
movsd  0xe7a(%rip),%xmm3
addsd  %xmm3,%xmm0
cvttsd2si %xmm0,%eax
addsd  %xmm3,%xmm1
cvttsd2si %xmm1,%esi
movsbl %al,%ecx
movsbl %sil,%r8d
lea    0xedd(%rip),%rsi
mov    %rsp,%rdi
movapd %xmm2,%xmm0
mov    $0x1,%al
call   1030 <sprintf@plt>
jmp    11f1 <ned_query+0xd1>
lea    0xee6(%rip),%rsi
mov    %rsp,%rdi
xor    %eax,%eax
call   1030 <sprintf@plt>
jmp    11f1 <ned_query+0xd1>
movsd  0xe31(%rip),%xmm2
addsd  %xmm2,%xmm0
cvttsd2si %xmm0,%ecx
addsd  %xmm2,%xmm1
cvttsd2si %xmm1,%r8d
lea    0xecd(%rip),%rsi
mov    %rsp,%rdi
xor    %eax,%eax
call   1030 <sprintf@plt>
mov    %rsp,%rdi
xor    %eax,%eax
call   1040 <send_cmd@plt>
add    $0x68,%rsp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"name_resolver \22%s\22\0A\00"
@.str.1 = [17 x i8] c"obj_byname \22%s\22\0A\00"
@.str.2 = [25 x i8] c"obj_nearname \22%s\22, %.5f\0A\00"
@.str.3 = [31 x i8] c"obj_nearposn %.8f, %.8f, %.5f\0A\00"
@.str.4 = [32 x i8] c"obj_iauformat %s, %c, %c, %.3f\0A\00"
@.str.5 = [19 x i8] c"expand_refcode %s\0A\00"
@.str.6 = [26 x i8] c"ref_objname \22%s\22, %d, %d\0A\00"
define i32 @ned_query(i32 %0, i8* %1, double %2, double %3, double %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca i8
%20 = alloca i8
%21 = alloca [101 x i8]
%22 = alloca i32
store i32 %0, i32* %6
store i8* %1, i8** %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%23 = load i32, i32* %6
switch i32 %23, label %87 [
i32 1, label %24
i32 2, label %29
i32 3, label %34
i32 4, label %41
i32 5, label %50
i32 6, label %69
i32 7, label %74
]
24: ; preds = %5
%25 = load i8*, i8** %7
store i8* %25, i8** %11
%26 = getelementptr inbounds [101 x i8], [101 x i8]* %21, i64 0, i64 0
%27 = load i8*, i8** %11
%28 = call i32 (i8*, i8*, ...) @sprintf(i8* %26, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %27)
br label %88
29: ; preds = %5
%30 = load i8*, i8** %7
store i8* %30, i8** %11
%31 = getelementptr inbounds [101 x i8], [101 x i8]* %21, i64 0, i64 0
%32 = load i8*, i8** %11
%33 = call i32 (i8*, i8*, ...) @sprintf(i8* %31, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %32)
br label %88
34: ; preds = %5
%35 = load i8*, i8** %7
store i8* %35, i8** %11
%36 = load double, double* %8
store double %36, double* %17
%37 = getelementptr inbounds [101 x i8], [101 x i8]* %21, i64 0, i64 0
%38 = load i8*, i8** %11
%39 = load double, double* %17
%40 = call i32 (i8*, i8*, ...) @sprintf(i8* %37, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %38, double %39)
br label %88
41: ; preds = %5
%42 = load double, double* %8
store double %42, double* %15
%43 = load double, double* %9
store double %43, double* %16
%44 = load double, double* %10
store double %44, double* %17
%45 = getelementptr inbounds [101 x i8], [101 x i8]* %21, i64 0, i64 0
%46 = load double, double* %15
%47 = load double, double* %16
%48 = load double, double* %17
%49 = call i32 (i8*, i8*, ...) @sprintf(i8* %45, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), double %46, double %47, double %48)
br label %88
50: ; preds = %5
%51 = load i8*, i8** %7
store i8* %51, i8** %11
%52 = load double, double* %8
%53 = fadd double %52, 5.000000e-01
%54 = fptosi double %53 to i32
%55 = trunc i32 %54 to i8
store i8 %55, i8* %19
%56 = load double, double* %9
%57 = fadd double %56, 5.000000e-01
%58 = fptosi double %57 to i32
%59 = trunc i32 %58 to i8
store i8 %59, i8* %20
%60 = load double, double* %10
store double %60, double* %18
%61 = getelementptr inbounds [101 x i8], [101 x i8]* %21, i64 0, i64 0
%62 = load i8*, i8** %11
%63 = load i8, i8* %19
%64 = sext i8 %63 to i32
%65 = load i8, i8* %20
%66 = sext i8 %65 to i32
%67 = load double, double* %18
%68 = call i32 (i8*, i8*, ...) @sprintf(i8* %61, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %62, i32 %64, i32 %66, double %67)
br label %88
69: ; preds = %5
%70 = load i8*, i8** %7
store i8* %70, i8** %12
%71 = getelementptr inbounds [101 x i8], [101 x i8]* %21, i64 0, i64 0
%72 = load i8*, i8** %12
%73 = call i32 (i8*, i8*, ...) @sprintf(i8* %71, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %72)
br label %88
74: ; preds = %5
%75 = load i8*, i8** %7
store i8* %75, i8** %11
%76 = load double, double* %8
%77 = fadd double %76, 5.000000e-01
%78 = fptosi double %77 to i32
store i32 %78, i32* %13
%79 = load double, double* %9
%80 = fadd double %79, 5.000000e-01
%81 = fptosi double %80 to i32
store i32 %81, i32* %14
%82 = getelementptr inbounds [101 x i8], [101 x i8]* %21, i64 0, i64 0
%83 = load i8*, i8** %11
%84 = load i32, i32* %13
%85 = load i32, i32* %14
%86 = call i32 (i8*, i8*, ...) @sprintf(i8* %82, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %83, i32 %84, i32 %85)
br label %88
87: ; preds = %5
br label %88
88: ; preds = %87, %74, %69, %50, %41, %34, %29, %24
%89 = getelementptr inbounds [101 x i8], [101 x i8]* %21, i64 0, i64 0
%90 = call i32 (i8*, ...) bitcast (i32 (...)* @send_cmd to i32 (i8*, ...)*)(i8* %89)
store i32 %90, i32* %22
%91 = load i32, i32* %22
ret i32 %91
}

LLVM IR (-O2):
@.str = [20 x i8] c"name_resolver \22%s\22\0A\00"
@.str.1 = [17 x i8] c"obj_byname \22%s\22\0A\00"
@.str.2 = [25 x i8] c"obj_nearname \22%s\22, %.5f\0A\00"
@.str.3 = [31 x i8] c"obj_nearposn %.8f, %.8f, %.5f\0A\00"
@.str.4 = [32 x i8] c"obj_iauformat %s, %c, %c, %.3f\0A\00"
@.str.5 = [19 x i8] c"expand_refcode %s\0A\00"
@.str.6 = [26 x i8] c"ref_objname \22%s\22, %d, %d\0A\00"
define i32 @ned_query(i32 %0, i8* %1, double %2, double %3, double %4) {
%6 = alloca [101 x i8]
%7 = getelementptr inbounds [101 x i8], [101 x i8]* %6, i64 0, i64 0
switch i32 %0, label %34 [
i32 1, label %8
i32 2, label %10
i32 3, label %12
i32 4, label %14
i32 5, label %16
i32 6, label %26
i32 7, label %28
]
8: ; preds = %5
%9 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %34
10: ; preds = %5
%11 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %34
12: ; preds = %5
%13 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %1, double %2)
br label %34
14: ; preds = %5
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), double %2, double %3, double %4)
br label %34
16: ; preds = %5
%17 = fadd double %2, 5.000000e-01
%18 = fptosi double %17 to i32
%19 = fadd double %3, 5.000000e-01
%20 = fptosi double %19 to i32
%21 = shl i32 %18, 24
%22 = ashr exact i32 %21, 24
%23 = shl i32 %20, 24
%24 = ashr exact i32 %23, 24
%25 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %1, i32 %22, i32 %24, double %4)
br label %34
26: ; preds = %5
%27 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %1)
br label %34
28: ; preds = %5
%29 = fadd double %2, 5.000000e-01
%30 = fptosi double %29 to i32
%31 = fadd double %3, 5.000000e-01
%32 = fptosi double %31 to i32
%33 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %1, i32 %30, i32 %32)
br label %34
34: ; preds = %5, %28, %26, %16, %14, %12, %10, %8
%35 = call i32 (i8*, ...) bitcast (i32 (...)* @send_cmd to i32 (i8*, ...)*)(i8* %7)
ret i32 %35
}