#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 */
int /*<<< orphan*/ get_wait_time(int, char **, char *);
struct tm *localtime(int /*<<< orphan*/ *);
int param_check(int, char **);
int /*<<< orphan*/ sleep(int);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  struct tm *tm;
  time_t now;
  int rc;
  char now_time[20], wait_time[20];
  rc = param_check(argc, argv);
  if (rc != 0) {
    return -1;
  }
  get_wait_time(argc, argv, wait_time);
  while (1) {
    time(&now);
    tm = localtime(&now);
    strftime(now_time, 20, "%Y%m%d%H%M%S", tm);
    if (strcmp(wait_time, now_time) <= 0) {
      break;
    }
    sleep(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <param_check@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     11ab <main+0x3b>
movl   $0xffffffff,-0x4(%rbp)
jmp    121c <main+0xac>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x60(%rbp),%rdx
call   1070 <get_wait_time@plt>
lea    -0x1c(%rbp),%rdi
call   1060 <time@plt>
lea    -0x1c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x14,%esi
lea    0xe1b(%rip),%rdx
call   1080 <strftime@plt>
lea    -0x60(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jg     1206 <main+0x96>
jmp    1215 <main+0xa5>
mov    $0x1,%edi
call   1090 <sleep@plt>
jmp    11bb <main+0x4b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x50,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
call   1050 <param_check@plt>
mov    $0xffffffff,%r14d
test   %eax,%eax
jne    123d <main+0xcd>
lea    0x10(%rsp),%r14
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1070 <get_wait_time@plt>
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
lea    0xe3e(%rip),%rdx
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x14,%esi
mov    %rax,%rcx
call   1080 <strftime@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
xor    %r14d,%r14d
test   %rax,%rax
jle    123d <main+0xcd>
lea    0xc(%rsp),%rbx
lea    0xe0a(%rip),%r15
lea    0x30(%rsp),%rbp
lea    0x10(%rsp),%r12
mov    $0x1,%edi
call   1090 <sleep@plt>
mov    %rbx,%rdi
call   1060 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %rbp,%rdi
mov    $0x14,%esi
mov    %r15,%rdx
mov    %rax,%rcx
call   1080 <strftime@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jg     1200 <main+0x90>
mov    %r14d,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [13 x i8] c"%Y%m%d%H%M%S\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.tm*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [20 x i8]
%10 = alloca [20 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @param_check(i32 %11, i8** %12)
store i32 %13, i32* %8
%14 = load i32, i32* %8
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %2
store i32 -1, i32* %3
br label %36
17: ; preds = %2
%18 = load i32, i32* %4
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%21 = call i32 @get_wait_time(i32 %18, i8** %19, i8* %20)
br label %22
22: ; preds = %17, %33
%23 = call i32 @time(i32* %7)
%24 = call %struct.tm* @localtime(i32* %7)
store %struct.tm* %24, %struct.tm** %6
%25 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%26 = load %struct.tm*, %struct.tm** %6
%27 = call i32 @strftime(i8* %25, i32 20, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), %struct.tm* %26)
%28 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%29 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%30 = call i64 @strcmp(i8* %28, i8* %29)
%31 = icmp sle i64 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %22
br label %35
33: ; preds = %22
%34 = call i32 @sleep(i32 1)
br label %22
35: ; preds = %32
store i32 0, i32* %3
br label %36
36: ; preds = %35, %16
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [13 x i8] c"%Y%m%d%H%M%S\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca [20 x i8]
%5 = alloca [20 x i8]
%6 = bitcast i32* %3 to i8*
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%9 = tail call i32 @param_check(i32 %0, i8** %1)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %25
11: ; preds = %2
%12 = call i32 @get_wait_time(i32 %0, i8** %1, i8* %8)
%13 = call i32 @time(i32* %3)
%14 = call %struct.tm* @localtime(i32* %3)
%15 = call i32 @strftime(i8* %7, i32 20, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), %struct.tm* %14)
%16 = call i64 @strcmp(i8* %8, i8* %7)
%17 = icmp slt i64 %16, 1
br i1 %17, label %25, label %18
18: ; preds = %11, %18
%19 = call i32 @sleep(i32 1)
%20 = call i32 @time(i32* %3)
%21 = call %struct.tm* @localtime(i32* %3)
%22 = call i32 @strftime(i8* %7, i32 20, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), %struct.tm* %21)
%23 = call i64 @strcmp(i8* %8, i8* %7)
%24 = icmp slt i64 %23, 1
br i1 %24, label %25, label %18
25: ; preds = %18, %11, %2
%26 = phi i32 [ -1, %2 ], [ 0, %11 ], [ 0, %18 ]
ret i32 %26
}