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

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sync();
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int i = 0;
  time_t t;
  struct tm *tm;
  while (1) {
    i++;
    sync();
    sleep(2);
    if (i % 30)
      continue;
    t = time(NULL);
    tm = localtime(&t);
    if (tm->tm_hour > 8)
      break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <sync@plt>
mov    $0x2,%edi
call   1060 <sleep@plt>
mov    -0x8(%rbp),%eax
mov    $0x1e,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1189 <main+0x49>
jmp    1156 <main+0x16>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpl   $0x8,(%rax)
jle    11b4 <main+0x74>
jmp    11b9 <main+0x79>
jmp    1156 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    $0xffffffff,%r12d
mov    $0x1,%ebx
mov    $0x88888889,%r15d
lea    0xc(%rsp),%r14
jmp    1177 <main+0x37>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xffffffff,%r12d
add    $0x1,%ebx
mov    %ebx,%eax
imul   %r15,%rax
shr    $0x24,%rax
mov    %eax,%ebp
shl    $0x5,%ebp
sub    %eax,%ebp
sub    %eax,%ebp
xor    %eax,%eax
call   1050 <sync@plt>
mov    $0x2,%edi
call   1060 <sleep@plt>
add    %r12d,%ebp
jne    1170 <main+0x30>
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0xc(%rsp)
mov    %r14,%rdi
call   1030 <localtime@plt>
cmpl   $0x9,(%rax)
jl     1170 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.tm*
store i32 0, i32* %1
store i32 0, i32* %2
br label %5
5: ; preds = %0, %13, %22
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 1
store i32 %7, i32* %2
%8 = call i32 (...) @sync()
%9 = call i32 @sleep(i32 2)
%10 = load i32, i32* %2
%11 = srem i32 %10, 30
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %5
br label %5
14: ; preds = %5
%15 = call i32 @time(i32* null)
store i32 %15, i32* %3
%16 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %16, %struct.tm** %4
%17 = load %struct.tm*, %struct.tm** %4
%18 = getelementptr inbounds %struct.tm, %struct.tm* %17, i32 0, i32 0
%19 = load i32, i32* %18
%20 = icmp sgt i32 %19, 8
br i1 %20, label %21, label %22
21: ; preds = %14
br label %23
22: ; preds = %14
br label %5
23: ; preds = %21
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %10, %0
%4 = phi i32 [ 0, %0 ], [ %5, %10 ]
%5 = add nuw nsw i32 %4, 1
%6 = call i32 (...) @sync()
%7 = call i32 @sleep(i32 2)
%8 = urem i32 %5, 30
%9 = icmp eq i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %3, %11
br label %3
11: ; preds = %3
%12 = call i32 @time(i32* null)
store i32 %12, i32* %1
%13 = call %struct.tm* @localtime(i32* %1)
%14 = getelementptr inbounds %struct.tm, %struct.tm* %13, i64 0, i32 0
%15 = load i32, i32* %14
%16 = icmp sgt i32 %15, 8
br i1 %16, label %17, label %10
17: ; preds = %11
ret i32 0
}