#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*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
size_t strftime(char *, size_t, char *, int /*<<< orphan*/);
scalar_t__ strlen(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void strtim_(char *string, int *maxlen) {
  time_t t = time(NULL);
  size_t s = strftime(string, (size_t)*maxlen, "%c", localtime(&t));
  int i;
  for (i = (int)strlen(string); i < *maxlen; i++)
    *(string + i) = ' ';
}


x86 assembly (clang, -O0):
<strtim_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movslq (%rax),%rax
mov    %rax,-0x30(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    %eax,%ecx
lea    0xe77(%rip),%rdx
call   1060 <strftime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    11c7 <strtim_+0x87>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    119e <strtim_+0x5e>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtim_>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
movslq (%r14),%r15
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
lea    0xe92(%rip),%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %eax,%ecx
call   1060 <strftime@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    %eax,(%r14)
jle    11a0 <strtim_+0x60>
cltq
nopw   0x0(%rax,%rax,1)
movb   $0x20,(%rbx,%rax,1)
add    $0x1,%rax
movslq (%r14),%rcx
cmp    %rcx,%rax
jl     1190 <strtim_+0x50>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define void @strtim_(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i64
%7 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
%8 = call i32 @time(i32* null)
store i32 %8, i32* %5
%9 = load i8*, i8** %3
%10 = load i32*, i32** %4
%11 = load i32, i32* %10
%12 = sext i32 %11 to i64
%13 = call i32 @localtime(i32* %5)
%14 = call i64 @strftime(i8* %9, i64 %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %13)
store i64 %14, i64* %6
%15 = load i8*, i8** %3
%16 = call i64 @strlen(i8* %15)
%17 = trunc i64 %16 to i32
store i32 %17, i32* %7
br label %18
18: ; preds = %28, %2
%19 = load i32, i32* %7
%20 = load i32*, i32** %4
%21 = load i32, i32* %20
%22 = icmp slt i32 %19, %21
br i1 %22, label %23, label %31
23: ; preds = %18
%24 = load i8*, i8** %3
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
store i8 32, i8* %27
br label %28
28: ; preds = %23
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
br label %18
31: ; preds = %18
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @strtim_(i8* %0, i32* nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %3
%6 = load i32, i32* %1
%7 = sext i32 %6 to i64
%8 = call i32 @localtime(i32* %3)
%9 = call i64 @strftime(i8* %0, i64 %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i64 @strlen(i8* dereferenceable(1) %0)
%11 = trunc i64 %10 to i32
%12 = load i32, i32* %1
%13 = icmp sgt i32 %12, %11
br i1 %13, label %14, label %24
14: ; preds = %2
%15 = shl i64 %10, 32
%16 = ashr exact i64 %15, 32
br label %17
17: ; preds = %14, %17
%18 = phi i64 [ %16, %14 ], [ %20, %17 ]
%19 = getelementptr inbounds i8, i8* %0, i64 %18
store i8 32, i8* %19
%20 = add nsw i64 %18, 1
%21 = load i32, i32* %1
%22 = sext i32 %21 to i64
%23 = icmp slt i64 %20, %22
br i1 %23, label %17, label %24
24: ; preds = %17, %2
ret void
}