#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 */
long Round_GEOREF(double);
double pow(double, int);
int /*<<< orphan*/ sprintf(char *, char *, long, long, long);
int /*<<< orphan*/ strcat(char *, char *);
void Convert_Minutes_To_String(double minutes, long precision, char *str) {
  double divisor;
  long min;
  divisor = pow(10.0, (5 - precision));
  if (minutes == 60.0)
    minutes = 59.999;
  minutes = minutes * 1000;
  min = Round_GEOREF(minutes / divisor);
  sprintf(str, "%*.*ld", precision, precision, min);
  if (precision == 1)
    strcat(str, "0");
}


x86 assembly (clang, -O0):
<Convert_Minutes_To_String>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    $0x5,%eax
sub    -0x10(%rbp),%rax
mov    %eax,%edi
movsd  0xea0(%rip),%xmm0
call   1040 <pow@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe81(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    119c <Convert_Minutes_To_String+0x5c>
jp     119c <Convert_Minutes_To_String+0x5c>
movsd  0xe79(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xe74(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
call   1030 <Round_GEOREF@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x28(%rbp),%r8
lea    0xe48(%rip),%rsi
call   1060 <sprintf@plt>
cmpq   $0x1,-0x10(%rbp)
jne    11f8 <Convert_Minutes_To_String+0xb8>
mov    -0x18(%rbp),%rdi
lea    0xe34(%rip),%rsi
call   1050 <strcat@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Convert_Minutes_To_String>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movaps %xmm0,(%rsp)
mov    $0x5,%edi
sub    %ebx,%edi
movsd  0xea0(%rip),%xmm0
call   1040 <pow@plt>
movsd  0xe9b(%rip),%xmm1
movapd (%rsp),%xmm3
mulsd  %xmm3,%xmm1
cmpeqsd 0xe91(%rip),%xmm3
movsd  0xe91(%rip),%xmm2
andpd  %xmm3,%xmm2
andnpd %xmm1,%xmm3
orpd   %xmm2,%xmm3
divsd  %xmm0,%xmm3
movapd %xmm3,%xmm0
call   1030 <Round_GEOREF@plt>
lea    0xe79(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %rbx,%rcx
mov    %rax,%r8
call   1060 <sprintf@plt>
cmp    $0x1,%rbx
jne    11d4 <Convert_Minutes_To_String+0x94>
lea    0xe62(%rip),%rsi
mov    %r14,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r14
jmp    1050 <strcat@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%*.*ld\00"
@.str.1 = [2 x i8] c"0\00"
define void @Convert_Minutes_To_String(double %0, i64 %1, i8* %2) {
%4 = alloca double
%5 = alloca i64
%6 = alloca i8*
%7 = alloca double
%8 = alloca i64
store double %0, double* %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%9 = load i64, i64* %5
%10 = sub nsw i64 5, %9
%11 = trunc i64 %10 to i32
%12 = call double @pow(double 1.000000e+01, i32 %11)
store double %12, double* %7
%13 = load double, double* %4
%14 = fcmp oeq double %13, 6.000000e+01
br i1 %14, label %15, label %16
15: ; preds = %3
store double 5.999900e+01, double* %4
br label %16
16: ; preds = %15, %3
%17 = load double, double* %4
%18 = fmul double %17, 1.000000e+03
store double %18, double* %4
%19 = load double, double* %4
%20 = load double, double* %7
%21 = fdiv double %19, %20
%22 = call i64 @Round_GEOREF(double %21)
store i64 %22, i64* %8
%23 = load i8*, i8** %6
%24 = load i64, i64* %5
%25 = load i64, i64* %5
%26 = load i64, i64* %8
%27 = call i32 @sprintf(i8* %23, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %24, i64 %25, i64 %26)
%28 = load i64, i64* %5
%29 = icmp eq i64 %28, 1
br i1 %29, label %30, label %33
30: ; preds = %16
%31 = load i8*, i8** %6
%32 = call i32 @strcat(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %33
33: ; preds = %30, %16
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%*.*ld\00"
@.str.1 = [2 x i8] c"0\00"
define void @Convert_Minutes_To_String(double %0, i64 %1, i8* %2) {
%4 = trunc i64 %1 to i32
%5 = sub i32 5, %4
%6 = tail call double @pow(double 1.000000e+01, i32 %5)
%7 = fcmp oeq double %0, 6.000000e+01
%8 = fmul double %0, 1.000000e+03
%9 = select i1 %7, double 5.999900e+04, double %8
%10 = fdiv double %9, %6
%11 = tail call i64 @Round_GEOREF(double %10)
%12 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %1, i64 %1, i64 %11)
%13 = icmp eq i64 %1, 1
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = tail call i32 @strcat(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %3
ret void
}