#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*/ Com_sprintf(char *, int, char *, int);
int /*<<< orphan*/ Q_strncpyz(char *, char *, int);
void G_admin_duration(int secs, char *duration, int dursize) {
  if (secs > (60 * 60 * 24 * 365 * 50) || secs < 0)
    Q_strncpyz(duration, "PERMANENT", dursize);
  else if (secs >= (60 * 60 * 24 * 365))
    Com_sprintf(duration, dursize, "%1.1f years",
                (secs / (60 * 60 * 24 * 365.0f)));
  else if (secs >= (60 * 60 * 24 * 90))
    Com_sprintf(duration, dursize, "%1.1f weeks",
                (secs / (60 * 60 * 24 * 7.0f)));
  else if (secs >= (60 * 60 * 24))
    Com_sprintf(duration, dursize, "%1.1f days", (secs / (60 * 60 * 24.0f)));
  else if (secs >= (60 * 60))
    Com_sprintf(duration, dursize, "%1.1f hours", (secs / (60 * 60.0f)));
  else if (secs >= 60)
    Com_sprintf(duration, dursize, "%1.1f minutes", (secs / 60.0f));
  else
    Com_sprintf(duration, dursize, "%i seconds", secs);
}


x86 assembly (clang, -O0):
<G_admin_duration>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x5dfc0f00,-0x4(%rbp)
jg     1149 <G_admin_duration+0x29>
cmpl   $0x0,-0x4(%rbp)
jge    1161 <G_admin_duration+0x41>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xebd(%rip),%rsi
call   1040 <Q_strncpyz@plt>
jmp    12af <G_admin_duration+0x18f>
cmpl   $0x1e13380,-0x4(%rbp)
jl     119b <G_admin_duration+0x7b>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xe8e(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%ecx
lea    0xe8d(%rip),%rdx
call   1030 <Com_sprintf@plt>
jmp    12aa <G_admin_duration+0x18a>
cmpl   $0x76a700,-0x4(%rbp)
jl     11d5 <G_admin_duration+0xb5>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xe50(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%ecx
lea    0xe5f(%rip),%rdx
call   1030 <Com_sprintf@plt>
jmp    12a5 <G_admin_duration+0x185>
cmpl   $0x15180,-0x4(%rbp)
jl     120f <G_admin_duration+0xef>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xe12(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%ecx
lea    0xe31(%rip),%rdx
call   1030 <Com_sprintf@plt>
jmp    12a0 <G_admin_duration+0x180>
cmpl   $0xe10,-0x4(%rbp)
jl     1249 <G_admin_duration+0x129>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xdd4(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%ecx
lea    0xe02(%rip),%rdx
call   1030 <Com_sprintf@plt>
jmp    129b <G_admin_duration+0x17b>
cmpl   $0x3c,-0x4(%rbp)
jl     1280 <G_admin_duration+0x160>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xd99(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%ecx
lea    0xdd7(%rip),%rdx
call   1030 <Com_sprintf@plt>
jmp    1296 <G_admin_duration+0x176>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x4(%rbp),%ecx
lea    0xdca(%rip),%rdx
call   1030 <Com_sprintf@plt>
jmp    129b <G_admin_duration+0x17b>
jmp    12a0 <G_admin_duration+0x180>
jmp    12a5 <G_admin_duration+0x185>
jmp    12aa <G_admin_duration+0x18a>
jmp    12af <G_admin_duration+0x18f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<G_admin_duration>:
mov    %rsi,%rax
cmp    $0x5dfc0f01,%edi
jb     113a <G_admin_duration+0x1a>
lea    0xee2(%rip),%rsi
mov    %rax,%rdi
jmp    1040 <Q_strncpyz@plt>
mov    %edi,%ecx
cmp    $0x1e13380,%edi
jb     1160 <G_admin_duration+0x40>
cvtsi2ss %ecx,%xmm0
divss  0xec0(%rip),%xmm0
cvttss2si %xmm0,%ecx
lea    0xec3(%rip),%r8
jmp    11e8 <G_admin_duration+0xc8>
cmp    $0x76a700,%ecx
jb     1181 <G_admin_duration+0x61>
cvtsi2ss %ecx,%xmm0
divss  0xe98(%rip),%xmm0
cvttss2si %xmm0,%ecx
lea    0xeab(%rip),%r8
jmp    11e8 <G_admin_duration+0xc8>
cmp    $0x15180,%ecx
jb     11a2 <G_admin_duration+0x82>
cvtsi2ss %ecx,%xmm0
divss  0xe73(%rip),%xmm0
cvttss2si %xmm0,%ecx
lea    0xe96(%rip),%r8
jmp    11e8 <G_admin_duration+0xc8>
cmp    $0xe10,%ecx
jb     11c3 <G_admin_duration+0xa3>
cvtsi2ss %ecx,%xmm0
divss  0xe4e(%rip),%xmm0
cvttss2si %xmm0,%ecx
lea    0xe80(%rip),%r8
jmp    11e8 <G_admin_duration+0xc8>
cmp    $0x3c,%ecx
jb     11e1 <G_admin_duration+0xc1>
cvtsi2ss %ecx,%xmm0
divss  0xe2c(%rip),%xmm0
cvttss2si %xmm0,%ecx
lea    0xe6e(%rip),%r8
jmp    11e8 <G_admin_duration+0xc8>
lea    0xe73(%rip),%r8
mov    %rax,%rdi
mov    %edx,%esi
mov    %r8,%rdx
jmp    1030 <Com_sprintf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"PERMANENT\00"
@.str.1 = [12 x i8] c"%1.1f years\00"
@.str.2 = [12 x i8] c"%1.1f weeks\00"
@.str.3 = [11 x i8] c"%1.1f days\00"
@.str.4 = [12 x i8] c"%1.1f hours\00"
@.str.5 = [14 x i8] c"%1.1f minutes\00"
@.str.6 = [11 x i8] c"%i seconds\00"
define void @G_admin_duration(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1576800000
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9, %3
%13 = load i8*, i8** %5
%14 = load i32, i32* %6
%15 = call i32 @Q_strncpyz(i8* %13, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %14)
br label %81
16: ; preds = %9
%17 = load i32, i32* %4
%18 = icmp sge i32 %17, 31536000
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = load i8*, i8** %5
%21 = load i32, i32* %6
%22 = load i32, i32* %4
%23 = sitofp i32 %22 to float
%24 = fdiv float %23, 3.153600e+07
%25 = fptosi float %24 to i32
%26 = call i32 @Com_sprintf(i8* %20, i32 %21, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %25)
br label %80
27: ; preds = %16
%28 = load i32, i32* %4
%29 = icmp sge i32 %28, 7776000
br i1 %29, label %30, label %38
30: ; preds = %27
%31 = load i8*, i8** %5
%32 = load i32, i32* %6
%33 = load i32, i32* %4
%34 = sitofp i32 %33 to float
%35 = fdiv float %34, 6.048000e+05
%36 = fptosi float %35 to i32
%37 = call i32 @Com_sprintf(i8* %31, i32 %32, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %36)
br label %79
38: ; preds = %27
%39 = load i32, i32* %4
%40 = icmp sge i32 %39, 86400
br i1 %40, label %41, label %49
41: ; preds = %38
%42 = load i8*, i8** %5
%43 = load i32, i32* %6
%44 = load i32, i32* %4
%45 = sitofp i32 %44 to float
%46 = fdiv float %45, 8.640000e+04
%47 = fptosi float %46 to i32
%48 = call i32 @Com_sprintf(i8* %42, i32 %43, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %47)
br label %78
49: ; preds = %38
%50 = load i32, i32* %4
%51 = icmp sge i32 %50, 3600
br i1 %51, label %52, label %60
52: ; preds = %49
%53 = load i8*, i8** %5
%54 = load i32, i32* %6
%55 = load i32, i32* %4
%56 = sitofp i32 %55 to float
%57 = fdiv float %56, 3.600000e+03
%58 = fptosi float %57 to i32
%59 = call i32 @Com_sprintf(i8* %53, i32 %54, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %58)
br label %77
60: ; preds = %49
%61 = load i32, i32* %4
%62 = icmp sge i32 %61, 60
br i1 %62, label %63, label %71
63: ; preds = %60
%64 = load i8*, i8** %5
%65 = load i32, i32* %6
%66 = load i32, i32* %4
%67 = sitofp i32 %66 to float
%68 = fdiv float %67, 6.000000e+01
%69 = fptosi float %68 to i32
%70 = call i32 @Com_sprintf(i8* %64, i32 %65, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %69)
br label %76
71: ; preds = %60
%72 = load i8*, i8** %5
%73 = load i32, i32* %6
%74 = load i32, i32* %4
%75 = call i32 @Com_sprintf(i8* %72, i32 %73, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %74)
br label %76
76: ; preds = %71, %63
br label %77
77: ; preds = %76, %52
br label %78
78: ; preds = %77, %41
br label %79
79: ; preds = %78, %30
br label %80
80: ; preds = %79, %19
br label %81
81: ; preds = %80, %12
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"PERMANENT\00"
@.str.1 = [12 x i8] c"%1.1f years\00"
@.str.2 = [12 x i8] c"%1.1f weeks\00"
@.str.3 = [11 x i8] c"%1.1f days\00"
@.str.4 = [12 x i8] c"%1.1f hours\00"
@.str.5 = [14 x i8] c"%1.1f minutes\00"
@.str.6 = [11 x i8] c"%i seconds\00"
define void @G_admin_duration(i32 %0, i8* %1, i32 %2) {
%4 = icmp ugt i32 %0, 1576800000
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @Q_strncpyz(i8* %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %44
7: ; preds = %3
%8 = icmp ugt i32 %0, 31535999
br i1 %8, label %9, label %14
9: ; preds = %7
%10 = sitofp i32 %0 to float
%11 = fdiv float %10, 3.153600e+07
%12 = fptosi float %11 to i32
%13 = tail call i32 @Com_sprintf(i8* %1, i32 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %44
14: ; preds = %7
%15 = icmp ugt i32 %0, 7775999
br i1 %15, label %16, label %21
16: ; preds = %14
%17 = sitofp i32 %0 to float
%18 = fdiv float %17, 6.048000e+05
%19 = fptosi float %18 to i32
%20 = tail call i32 @Com_sprintf(i8* %1, i32 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %19)
br label %44
21: ; preds = %14
%22 = icmp ugt i32 %0, 86399
br i1 %22, label %23, label %28
23: ; preds = %21
%24 = sitofp i32 %0 to float
%25 = fdiv float %24, 8.640000e+04
%26 = fptosi float %25 to i32
%27 = tail call i32 @Com_sprintf(i8* %1, i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %26)
br label %44
28: ; preds = %21
%29 = icmp ugt i32 %0, 3599
br i1 %29, label %30, label %35
30: ; preds = %28
%31 = sitofp i32 %0 to float
%32 = fdiv float %31, 3.600000e+03
%33 = fptosi float %32 to i32
%34 = tail call i32 @Com_sprintf(i8* %1, i32 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %33)
br label %44
35: ; preds = %28
%36 = icmp ugt i32 %0, 59
br i1 %36, label %37, label %42
37: ; preds = %35
%38 = sitofp i32 %0 to float
%39 = fdiv float %38, 6.000000e+01
%40 = fptosi float %39 to i32
%41 = tail call i32 @Com_sprintf(i8* %1, i32 %2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %40)
br label %44
42: ; preds = %35
%43 = tail call i32 @Com_sprintf(i8* %1, i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i32 %0)
br label %44
44: ; preds = %9, %23, %37, %42, %30, %16, %5
ret void
}