#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*/ printf(char *, ...);
void printTime32(unsigned char *data) {
  int t = (data[0] << 24) + (data[1] << 16) + (data[2] << 8) + data[3];
  if (t == 31536000) {
    printf("Lease reserved");
  } else {
    printf("%d sec (", t);
    if (t > 7 * 24 * 3600) {
      printf("%dw", t / (7 * 24 * 3600));
      t %= 7 * 24 * 3600;
    }
    if (t > 24 * 3600) {
      printf("%dd", t / (24 * 3600));
      t %= 24 * 3600;
    }
    if (t > 3600) {
      printf("%dh", t / 3600);
      t %= 3600;
    }
    if (t > 60) {
      printf("%dm", t / 60);
      t %= 60;
    }
    if (t > 0)
      printf("%ds", t);
    printf(")");
  }
}


x86 assembly (clang, -O0):
<printTime32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1e13380,-0xc(%rbp)
jne    116d <printTime32+0x5d>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    127c <printTime32+0x16c>
mov    -0xc(%rbp),%esi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x93a80,-0xc(%rbp)
jle    11b4 <printTime32+0xa4>
mov    -0xc(%rbp),%eax
mov    $0x93a80,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    $0x93a80,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmpl   $0x15180,-0xc(%rbp)
jle    11ea <printTime32+0xda>
mov    -0xc(%rbp),%eax
mov    $0x15180,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    $0x15180,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmpl   $0xe10,-0xc(%rbp)
jle    1220 <printTime32+0x110>
mov    -0xc(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmpl   $0x3c,-0xc(%rbp)
jle    1253 <printTime32+0x143>
mov    -0xc(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    126e <printTime32+0x15e>
mov    -0xc(%rbp),%esi
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printTime32>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%ebx
bswap  %ebx
cmp    $0x1e13380,%ebx
jne    1142 <printTime32+0x22>
lea    0xec9(%rip),%rdi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <printf@plt>
lea    0xec6(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x93a81,%ebx
jge    1199 <printTime32+0x79>
cmp    $0x15181,%ebx
jge    11c8 <printTime32+0xa8>
cmp    $0xe11,%ebx
jge    11fe <printTime32+0xde>
cmp    $0x3d,%ebx
jge    1231 <printTime32+0x111>
test   %ebx,%ebx
jle    118b <printTime32+0x6b>
lea    0xea6(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x29,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>
lea    0xe78(%rip),%rdi
mov    %ebx,%eax
imul   $0x6ef5de4d,%rax,%r14
shr    $0x32,%r14
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
imul   $0x93a80,%r14d,%eax
sub    %eax,%ebx
cmp    $0x15181,%ebx
jl     1162 <printTime32+0x42>
lea    0xe4d(%rip),%rdi
mov    %ebx,%eax
mov    $0xc22e4507,%r14d
imul   %rax,%r14
shr    $0x30,%r14
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
imul   $0x15180,%r14d,%eax
sub    %eax,%ebx
cmp    $0xe11,%ebx
jl     116e <printTime32+0x4e>
lea    0xe1b(%rip),%rdi
mov    %ebx,%eax
mov    $0x91a2b3c5,%r14d
imul   %rax,%r14
shr    $0x2b,%r14
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
imul   $0xe10,%r14d,%eax
sub    %eax,%ebx
cmp    $0x3d,%ebx
jl     1177 <printTime32+0x57>
lea    0xdec(%rip),%rdi
movzwl %bx,%eax
imul   $0x8889,%eax,%ebp
shr    $0x15,%ebp
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
imul   $0x3c,%ebp,%eax
sub    %eax,%ebx
movzwl %bx,%ebx
test   %ebx,%ebx
jg     117b <printTime32+0x5b>
jmp    118b <printTime32+0x6b>

LLVM IR (-O0):
@.str = [15 x i8] c"Lease reserved\00"
@.str.1 = [9 x i8] c"%d sec (\00"
@.str.2 = [4 x i8] c"%dw\00"
@.str.3 = [4 x i8] c"%dd\00"
@.str.4 = [4 x i8] c"%dh\00"
@.str.5 = [4 x i8] c"%dm\00"
@.str.6 = [4 x i8] c"%ds\00"
@.str.7 = [2 x i8] c")\00"
define void @printTime32(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl i32 %7, 24
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 16
%14 = add nsw i32 %8, %13
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 2
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = add nsw i32 %14, %19
%21 = load i8*, i8** %2
%22 = getelementptr inbounds i8, i8* %21, i64 3
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = add nsw i32 %20, %24
store i32 %25, i32* %3
%26 = load i32, i32* %3
%27 = icmp eq i32 %26, 31536000
br i1 %27, label %28, label %30
28: ; preds = %1
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %76
30: ; preds = %1
%31 = load i32, i32* %3
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %3
%34 = icmp sgt i32 %33, 604800
br i1 %34, label %35, label %41
35: ; preds = %30
%36 = load i32, i32* %3
%37 = sdiv i32 %36, 604800
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %37)
%39 = load i32, i32* %3
%40 = srem i32 %39, 604800
store i32 %40, i32* %3
br label %41
41: ; preds = %35, %30
%42 = load i32, i32* %3
%43 = icmp sgt i32 %42, 86400
br i1 %43, label %44, label %50
44: ; preds = %41
%45 = load i32, i32* %3
%46 = sdiv i32 %45, 86400
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %46)
%48 = load i32, i32* %3
%49 = srem i32 %48, 86400
store i32 %49, i32* %3
br label %50
50: ; preds = %44, %41
%51 = load i32, i32* %3
%52 = icmp sgt i32 %51, 3600
br i1 %52, label %53, label %59
53: ; preds = %50
%54 = load i32, i32* %3
%55 = sdiv i32 %54, 3600
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %55)
%57 = load i32, i32* %3
%58 = srem i32 %57, 3600
store i32 %58, i32* %3
br label %59
59: ; preds = %53, %50
%60 = load i32, i32* %3
%61 = icmp sgt i32 %60, 60
br i1 %61, label %62, label %68
62: ; preds = %59
%63 = load i32, i32* %3
%64 = sdiv i32 %63, 60
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %64)
%66 = load i32, i32* %3
%67 = srem i32 %66, 60
store i32 %67, i32* %3
br label %68
68: ; preds = %62, %59
%69 = load i32, i32* %3
%70 = icmp sgt i32 %69, 0
br i1 %70, label %71, label %74
71: ; preds = %68
%72 = load i32, i32* %3
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %72)
br label %74
74: ; preds = %71, %68
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %76
76: ; preds = %74, %28
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Lease reserved\00"
@.str.1 = [9 x i8] c"%d sec (\00"
@.str.2 = [4 x i8] c"%dw\00"
@.str.3 = [4 x i8] c"%dd\00"
@.str.4 = [4 x i8] c"%dh\00"
@.str.5 = [4 x i8] c"%dm\00"
@.str.6 = [4 x i8] c"%ds\00"
define void @printTime32(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw i32 %3, 24
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 16
%9 = or i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 8
%14 = or i32 %9, %13
%15 = getelementptr inbounds i8, i8* %0, i64 3
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = or i32 %14, %17
%19 = icmp eq i32 %18, 31536000
br i1 %19, label %20, label %22
20: ; preds = %1
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %60
22: ; preds = %1
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%24 = icmp sgt i32 %18, 604800
br i1 %24, label %25, label %29
25: ; preds = %22
%26 = udiv i32 %18, 604800
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %26)
%28 = urem i32 %18, 604800
br label %29
29: ; preds = %25, %22
%30 = phi i32 [ %28, %25 ], [ %18, %22 ]
%31 = icmp sgt i32 %30, 86400
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = udiv i32 %30, 86400
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %33)
%35 = urem i32 %30, 86400
br label %36
36: ; preds = %32, %29
%37 = phi i32 [ %35, %32 ], [ %30, %29 ]
%38 = icmp sgt i32 %37, 3600
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = udiv i32 %37, 3600
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %40)
%42 = urem i32 %37, 3600
br label %43
43: ; preds = %39, %36
%44 = phi i32 [ %42, %39 ], [ %37, %36 ]
%45 = icmp sgt i32 %44, 60
br i1 %45, label %46, label %53
46: ; preds = %43
%47 = trunc i32 %44 to i16
%48 = udiv i16 %47, 60
%49 = zext i16 %48 to i32
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %49)
%51 = urem i16 %47, 60
%52 = zext i16 %51 to i32
br label %53
53: ; preds = %46, %43
%54 = phi i32 [ %52, %46 ], [ %44, %43 ]
%55 = icmp sgt i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %53
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %54)
br label %58
58: ; preds = %56, %53
%59 = tail call i32 @putchar(i32 41)
br label %60
60: ; preds = %58, %20
ret void
}