#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 */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, int, int, int, int);
const char *timestr_full(long dtime) {
  static char buf[32];
  int days, hours, minutes, seconds;
  days = dtime / 86400;
  dtime %= 86400;
  hours = dtime / 3600;
  dtime %= 3600;
  minutes = dtime / 60;
  seconds = dtime % 60;
  snprintf(buf, sizeof(buf), "%3dd %2d:%02d:%02d", days, hours, minutes,
           seconds);
  return buf;
}


x86 assembly (clang, -O0):
<timestr_full>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x15180,%ecx
cqto
idiv   %rcx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x15180,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xe10,%ecx
cqto
idiv   %rcx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xe10,%ecx
cqto
idiv   %rcx
mov    %rdx,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x3c,%ecx
cqto
idiv   %rcx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x3c,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    -0x18(%rbp),%eax
lea    0x2ea5(%rip),%rdi
mov    $0x20,%esi
lea    0xe59(%rip),%rdx
mov    %eax,(%rsp)
call   1030 <snprintf@plt>
lea    0x2e8a(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timestr_full>:
push   %rbx
sub    $0x10,%rsp
movabs $0x1845c8a0ce512957,%rcx
c8 45 18
mov    %rdi,%rax
imul   %rcx
mov    %rdx,%rcx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0xd,%rcx
add    %rax,%rcx
imul   $0x15180,%rcx,%rax
sub    %rax,%rdi
movslq %edi,%rax
imul   $0xffffffff91a2b3c5,%rax,%r8
shr    $0x20,%r8
add    %eax,%r8d
mov    %r8d,%edx
shr    $0x1f,%edx
sar    $0xb,%r8d
add    %edx,%r8d
imul   $0xe10,%r8d,%edx
sub    %edx,%eax
movswl %ax,%edx
imul   $0xffff8889,%edx,%edx
shr    $0x10,%edx
add    %eax,%edx
movzwl %dx,%edx
movswl %dx,%esi
shr    $0xf,%edx
sar    $0x5,%esi
add    %edx,%esi
movswl %si,%r9d
imul   $0x3c,%esi,%edx
sub    %edx,%eax
cwtl
mov    %eax,(%rsp)
lea    0x2ea9(%rip),%rbx
lea    0xe62(%rip),%rdx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@timestr_full.buf = internal global [32 x i8] zeroinitializer
@.str = [19 x i8] c"%3dd %2d:%02d:%02d\00"
define i8* @timestr_full(i64 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i64 %0, i64* %2
%7 = load i64, i64* %2
%8 = sdiv i64 %7, 86400
%9 = trunc i64 %8 to i32
store i32 %9, i32* %3
%10 = load i64, i64* %2
%11 = srem i64 %10, 86400
store i64 %11, i64* %2
%12 = load i64, i64* %2
%13 = sdiv i64 %12, 3600
%14 = trunc i64 %13 to i32
store i32 %14, i32* %4
%15 = load i64, i64* %2
%16 = srem i64 %15, 3600
store i64 %16, i64* %2
%17 = load i64, i64* %2
%18 = sdiv i64 %17, 60
%19 = trunc i64 %18 to i32
store i32 %19, i32* %5
%20 = load i64, i64* %2
%21 = srem i64 %20, 60
%22 = trunc i64 %21 to i32
store i32 %22, i32* %6
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = load i32, i32* %5
%26 = load i32, i32* %6
%27 = call i32 @snprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @timestr_full.buf, i64 0, i64 0), i32 32, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %23, i32 %24, i32 %25, i32 %26)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @timestr_full.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@timestr_full.buf = internal global [32 x i8] zeroinitializer
@.str = [19 x i8] c"%3dd %2d:%02d:%02d\00"
define i8* @timestr_full(i64 %0) {
%2 = sdiv i64 %0, 86400
%3 = trunc i64 %2 to i32
%4 = srem i64 %0, 86400
%5 = trunc i64 %4 to i32
%6 = sdiv i32 %5, 3600
%7 = srem i32 %5, 3600
%8 = trunc i32 %7 to i16
%9 = sdiv i16 %8, 60
%10 = sext i16 %9 to i32
%11 = srem i16 %8, 60
%12 = sext i16 %11 to i32
%13 = tail call i32 @snprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @timestr_full.buf, i64 0, i64 0), i32 32, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %6, i32 %10, i32 %12)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @timestr_full.buf, i64 0, i64 0)
}