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

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  while (1) {
    time_t t0 = time(NULL);
    struct tm *t = localtime(&t0);
    char buf[128] = {0};
    strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", t);
    printf("%s\n", buf);
    sleep(60);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x80,%edx
call   1050 <memset@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x20(%rbp),%rcx
mov    $0x80,%esi
lea    0xe44(%rip),%rdx
call   1070 <strftime@plt>
lea    -0xa0(%rbp),%rsi
lea    0xe43(%rip),%rdi
call   1040 <printf@plt>
mov    $0x3c,%edi
call   1080 <sleep@plt>
jmp    1179 <main+0x19>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x98,%rsp
lea    0xc(%rsp),%r14
lea    0xe96(%rip),%r15
lea    0x10(%rsp),%rbx
lea    0xe9c(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
mov    %r14,%rdi
call   1030 <localtime@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    $0x80,%esi
mov    %r15,%rdx
mov    %rax,%rcx
call   1060 <strftime@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    $0x3c,%edi
call   1070 <sleep@plt>
jmp    1180 <main+0x30>

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [18 x i8] c"%Y-%m-%d %H:%M:%S\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.tm*
%8 = alloca [128 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %9
9: ; preds = %2, %9
%10 = call i32 @time(i32* null)
store i32 %10, i32* %6
%11 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %11, %struct.tm** %7
%12 = bitcast [128 x i8]* %8 to i8*
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%14 = load %struct.tm*, %struct.tm** %7
%15 = call i32 @strftime(i8* %13, i32 128, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %14)
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %8, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = call i32 @sleep(i32 60)
br label %9
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [18 x i8] c"%Y-%m-%d %H:%M:%S\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [128 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
br label %7
7: ; preds = %2, %7
%8 = call i32 @time(i32* null)
store i32 %8, i32* %3
%9 = call %struct.tm* @localtime(i32* %3)
%10 = call i32 @strftime(i8* %6, i32 128, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), %struct.tm* %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%12 = call i32 @sleep(i32 60)
br label %7
}