#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ pdms(double);
int /*<<< orphan*/ phms(double);
int /*<<< orphan*/ printf(char *);
int sscanf(char *, char *, double *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  double deg;
  if (argc < 2) {
    printf("Quickly convert RA/DEC from degrees to XX:MM:SS.SSS form \n");
    printf("  radec2xms [RA] [DEC]\n");
    return 1;
  }
  if (argc > 1) {
    if (sscanf(argv[1], "%lf", &deg) != 1) {
      fprintf(stderr, "invalid arg %s\n", argv[1]);
      return 1;
    }
    phms(deg);
  }
  if (argc > 2) {
    if (sscanf(argv[2], "%lf", &deg) != 1) {
      fprintf(stderr, "invalid arg %s\n", argv[2]);
      return 1;
    }
    printf("\t");
    pdms(deg);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1194 <main+0x44>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    126f <main+0x11f>
cmpl   $0x1,-0x8(%rbp)
jle    11f2 <main+0xa2>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea6(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
je     11e8 <main+0x98>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe80(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    126f <main+0x11f>
movsd  -0x18(%rbp),%xmm0
call   1070 <phms@plt>
cmpl   $0x2,-0x8(%rbp)
jle    125c <main+0x10c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe48(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
je     1246 <main+0xf6>
mov    0x2dbc(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xe22(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    126f <main+0x11f>
lea    0xe1a(%rip),%rdi
call   1030 <printf@plt>
movsd  -0x18(%rbp),%xmm0
call   1060 <pdms@plt>
lea    0xdd6(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x1,%edi
jg     1185 <main+0x25>
lea    0xea5(%rip),%rdi
call   1040 <puts@plt>
lea    0xed3(%rip),%rdi
call   1040 <puts@plt>
jmp    1213 <main+0xb3>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
lea    0xe6b(%rip),%rsi
mov    %rsp,%rdx
call   1060 <sscanf@plt>
cmp    $0x1,%eax
jne    11eb <main+0x8b>
movsd  (%rsp),%xmm0
call   1080 <phms@plt>
cmp    $0x3,%ebp
jb     11dd <main+0x7d>
mov    0x10(%rbx),%rdi
lea    0xe44(%rip),%rsi
mov    %rsp,%rdx
call   1060 <sscanf@plt>
cmp    $0x1,%eax
jne    11fa <main+0x9a>
mov    $0x9,%edi
call   1030 <putchar@plt>
movsd  (%rsp),%xmm0
call   1070 <pdms@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
jmp    1218 <main+0xb8>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
jmp    1207 <main+0xa7>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbx),%rdx
lea    0xdf6(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [59 x i8] c"Quickly convert RA/DEC from degrees to XX:MM:SS.SSS form \0A\00"
@.str.1 = [24 x i8] c" radec2xms [RA] [DEC]\0A\00"
@.str.2 = [4 x i8] c"%lf\00"
@stderr = global i32 0
@.str.3 = [16 x i8] c"invalid arg %s\0A\00"
@.str.4 = [2 x i8] c"\09\00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %51
12: ; preds = %2
%13 = load i32, i32* %4
%14 = icmp sgt i32 %13, 1
br i1 %14, label %15, label %30
15: ; preds = %12
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @sscanf(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %6)
%20 = icmp ne i32 %19, 1
br i1 %20, label %21, label %27
21: ; preds = %15
%22 = load i32, i32* @stderr
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %25)
store i32 1, i32* %3
br label %51
27: ; preds = %15
%28 = load double, double* %6
%29 = call i32 @phms(double %28)
br label %30
30: ; preds = %27, %12
%31 = load i32, i32* %4
%32 = icmp sgt i32 %31, 2
br i1 %32, label %33, label %49
33: ; preds = %30
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = call i32 @sscanf(i8* %36, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %6)
%38 = icmp ne i32 %37, 1
br i1 %38, label %39, label %45
39: ; preds = %33
%40 = load i32, i32* @stderr
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 2
%43 = load i8*, i8** %42
%44 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %43)
store i32 1, i32* %3
br label %51
45: ; preds = %33
%46 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%47 = load double, double* %6
%48 = call i32 @pdms(double %47)
br label %49
49: ; preds = %45, %30
%50 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %51
51: ; preds = %49, %39, %21, %9
%52 = load i32, i32* %3
ret i32 %52
}

LLVM IR (-O2):
@.str.2 = [4 x i8] c"%lf\00"
@stderr = global i32 0
@.str.3 = [16 x i8] c"invalid arg %s\0A\00"
@str = [58 x i8] c"Quickly convert RA/DEC from degrees to XX:MM:SS.SSS form \00"
@str.6 = [23 x i8] c" radec2xms [RA] [DEC]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.6, i64 0, i64 0))
br label %37
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %3)
%13 = icmp eq i32 %12, 1
br i1 %13, label %18, label %14
14: ; preds = %9
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %10
%17 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %16)
br label %37
18: ; preds = %9
%19 = load double, double* %3
%20 = call i32 @phms(double %19)
%21 = icmp ugt i32 %0, 2
br i1 %21, label %22, label %35
22: ; preds = %18
%23 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = load i8*, i8** %23
%25 = call i32 @sscanf(i8* %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double* %3)
%26 = icmp eq i32 %25, 1
br i1 %26, label %31, label %27
27: ; preds = %22
%28 = load i32, i32* @stderr
%29 = load i8*, i8** %23
%30 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %29)
br label %37
31: ; preds = %22
%32 = call i32 @putchar(i32 9)
%33 = load double, double* %3
%34 = call i32 @pdms(double %33)
br label %35
35: ; preds = %31, %18
%36 = call i32 @putchar(i32 10)
br label %37
37: ; preds = %35, %27, %14, %6
%38 = phi i32 [ 1, %6 ], [ 1, %14 ], [ 1, %27 ], [ 0, %35 ]
ret i32 %38
}