#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;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
const char *plugin_status() {
  static char buf[16];
  static int cycle = 0;
  time_t t;
  struct tm *ti;
  if (cycle++ % 60 != 0) {
    return buf;
  }
  time(&t);
  ti = localtime(&t);
  strftime(buf, 16, "%I:%M %p", ti);
  return buf;
}


x86 assembly (clang, -O0):
<plugin_status>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2f22(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2f17(%rip)
mov    $0x3c,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     116a <plugin_status+0x3a>
lea    0x2eef(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a7 <plugin_status+0x77>
lea    -0xc(%rbp),%rdi
call   1040 <time@plt>
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
lea    0x2ec5(%rip),%rdi
mov    $0x10,%esi
lea    0xe69(%rip),%rdx
call   1050 <strftime@plt>
lea    0x2ead(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plugin_status>:
push   %rbx
sub    $0x10,%rsp
mov    0x2f25(%rip),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x2f1c(%rip)
imul   $0xeeeeeeef,%eax,%eax
add    $0x8888888,%eax
ror    $0x2,%eax
cmp    $0x4444444,%eax
ja     1189 <plugin_status+0x59>
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
lea    0x2edb(%rip),%rdi
lea    0xe84(%rip),%rdx
mov    $0x10,%esi
mov    %rax,%rcx
call   1050 <strftime@plt>
lea    0x2ec0(%rip),%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@plugin_status.buf = internal global [16 x i8] zeroinitializer
@plugin_status.cycle = internal global i32 0
@.str = [9 x i8] c"%I:%M %p\00"
define i8* @plugin_status() {
%1 = alloca i8*
%2 = alloca i32
%3 = alloca %struct.tm*
%4 = load i32, i32* @plugin_status.cycle
%5 = add nsw i32 %4, 1
store i32 %5, i32* @plugin_status.cycle
%6 = srem i32 %4, 60
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %0
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @plugin_status.buf, i64 0, i64 0), i8** %1
br label %14
9: ; preds = %0
%10 = call i32 @time(i32* %2)
%11 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %11, %struct.tm** %3
%12 = load %struct.tm*, %struct.tm** %3
%13 = call i32 @strftime(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @plugin_status.buf, i64 0, i64 0), i32 16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %12)
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @plugin_status.buf, i64 0, i64 0), i8** %1
br label %14
14: ; preds = %9, %8
%15 = load i8*, i8** %1
ret i8* %15
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@plugin_status.buf = internal global [16 x i8] zeroinitializer
@plugin_status.cycle = internal unnamed_addr global i32 0
@.str = [9 x i8] c"%I:%M %p\00"
define i8* @plugin_status() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = load i32, i32* @plugin_status.cycle
%4 = add nsw i32 %3, 1
store i32 %4, i32* @plugin_status.cycle
%5 = srem i32 %3, 60
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = call i32 @time(i32* %1)
%9 = call %struct.tm* @localtime(i32* %1)
%10 = call i32 @strftime(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @plugin_status.buf, i64 0, i64 0), i32 16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %struct.tm* %9)
br label %11
11: ; preds = %0, %7
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @plugin_status.buf, i64 0, i64 0)
}