#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 time_t;
struct tm {
  int dummy;
};
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int _add(char *);
int mktime(struct tm *);
_secs(const struct tm *t) {
  static char buf[15];
  register time_t s;
  register char *p;
  struct tm tmp;
  tmp = *t;
  s = mktime(&tmp);
  for (p = buf + sizeof(buf) - 2; s > 0 && p > buf; s /= 10)
    *p-- = s % 10 + '0';
  return (_add(++p));
}


x86 assembly (clang, -O0):
<_secs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <mktime@plt>
mov    %eax,-0xc(%rbp)
lea    0x2ee9(%rip),%rax
add    $0xd,%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x21(%rbp)
jle    1170 <_secs+0x50>
lea    0x2ecb(%rip),%rax
cmp    %rax,-0x18(%rbp)
seta   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1180 <_secs+0x60>
jmp    11b4 <_secs+0x94>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    1150 <_secs+0x30>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
mov    %rdi,-0x18(%rbp)
call   1030 <_add@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_secs>:
push   %rax
mov    (%rdi),%eax
mov    %eax,(%rsp)
mov    %rsp,%rdi
call   1040 <mktime@plt>
lea    0x2f09(%rip),%rdi
test   %eax,%eax
jle    117b <_secs+0x5b>
mov    $0xcccccccd,%r8d
lea    0x2eeb(%rip),%r9
cs nopw 0x0(%rax,%rax,1)
mov    %eax,%edx
mov    %eax,%eax
imul   %r8,%rax
shr    $0x23,%rax
lea    (%rax,%rax,1),%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %edx,%esi
sub    %ecx,%esi
or     $0x30,%sil
mov    %sil,(%rdi)
add    $0xffffffffffffffff,%rdi
cmp    $0xa,%edx
jb     117b <_secs+0x5b>
cmp    %r9,%rdi
ja     1150 <_secs+0x30>
add    $0x1,%rdi
pop    %rax
jmp    1030 <_add@plt>

LLVM IR (-O0):
%struct.tm = type { i32 }
@_secs.buf = internal global [15 x i8] zeroinitializer
define i32 @_secs(%struct.tm* %0) {
%2 = alloca %struct.tm*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.tm
store %struct.tm* %0, %struct.tm** %2
%6 = load %struct.tm*, %struct.tm** %2
%7 = bitcast %struct.tm* %5 to i8*
%8 = bitcast %struct.tm* %6 to i8*
%9 = call i32 @mktime(%struct.tm* %5)
store i32 %9, i32* %3
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @_secs.buf, i64 1, i64 -2), i8** %4
br label %10
10: ; preds = %25, %1
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i8*, i8** %4
%15 = icmp ugt i8* %14, getelementptr inbounds ([15 x i8], [15 x i8]* @_secs.buf, i64 0, i64 0)
br label %16
16: ; preds = %13, %10
%17 = phi i1 [ false, %10 ], [ %15, %13 ]
br i1 %17, label %18, label %28
18: ; preds = %16
%19 = load i32, i32* %3
%20 = srem i32 %19, 10
%21 = add nsw i32 %20, 48
%22 = trunc i32 %21 to i8
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i32 -1
store i8* %24, i8** %4
store i8 %22, i8* %23
br label %25
25: ; preds = %18
%26 = load i32, i32* %3
%27 = sdiv i32 %26, 10
store i32 %27, i32* %3
br label %10
28: ; preds = %16
%29 = load i8*, i8** %4
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %4
%31 = call i32 @_add(i8* %30)
ret i32 %31
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@_secs.buf = internal global [15 x i8] zeroinitializer
define i32 @_secs(%struct.tm* nocapture %0) {
%2 = alloca %struct.tm
%3 = bitcast %struct.tm* %2 to i8*
%4 = getelementptr %struct.tm, %struct.tm* %0, i64 0, i32 0
%5 = getelementptr inbounds %struct.tm, %struct.tm* %2, i64 0, i32 0
%6 = load i32, i32* %4
store i32 %6, i32* %5
%7 = call i32 @mktime(%struct.tm* %2)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %20
9: ; preds = %1, %9
%10 = phi i8* [ %15, %9 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @_secs.buf, i64 0, i64 13), %1 ]
%11 = phi i32 [ %16, %9 ], [ %7, %1 ]
%12 = urem i32 %11, 10
%13 = trunc i32 %12 to i8
%14 = or i8 %13, 48
%15 = getelementptr inbounds i8, i8* %10, i64 -1
store i8 %14, i8* %10
%16 = udiv i32 %11, 10
%17 = icmp ugt i32 %11, 9
%18 = icmp ugt i8* %15, getelementptr inbounds ([15 x i8], [15 x i8]* @_secs.buf, i64 0, i64 0)
%19 = select i1 %17, i1 %18, i1 false
br i1 %19, label %9, label %20
20: ; preds = %9, %1
%21 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @_secs.buf, i64 0, i64 13), %1 ], [ %15, %9 ]
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = tail call i32 @_add(i8* %22)
ret i32 %23
}