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

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
long last_check_in();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
int /*<<< orphan*/ usleep(int);
void *time_keeper(void *arg) {
  usleep(10000);
  long int t;
  while (1) {
    t = last_check_in();
    if (t > 1000000) {
      printf("1");
      exit(0);
    }
    if (t == -1) {
      break;
    }
    usleep(10000);
  }
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<time_keeper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x2710,%edi
call   1070 <usleep@plt>
mov    $0x0,%al
call   1040 <last_check_in@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0xf4240,-0x18(%rbp)
jle    1192 <time_keeper+0x42>
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
cmpq   $0xffffffffffffffff,-0x18(%rbp)
jne    11a2 <time_keeper+0x52>
jmp    11b1 <time_keeper+0x61>
mov    $0x2710,%edi
call   1070 <usleep@plt>
jmp    1166 <time_keeper+0x16>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_keeper>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x2710,%edi
call   1070 <usleep@plt>
xor    %eax,%eax
call   1040 <last_check_in@plt>
cmp    $0xf4240,%rax
jg     1187 <time_keeper+0x37>
cmp    $0xffffffffffffffff,%rax
jne    1160 <time_keeper+0x10>
xor    %edi,%edi
pop    %rax
jmp    1050 <pthread_exit@plt>
mov    $0x31,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"1\00"
define i8* @time_keeper(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = call i32 @usleep(i32 10000)
br label %6
6: ; preds = %1, %17
%7 = call i64 (...) @last_check_in()
store i64 %7, i64* %4
%8 = load i64, i64* %4
%9 = icmp sgt i64 %8, 1000000
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 0)
unreachable
13: ; preds = %6
%14 = load i64, i64* %4
%15 = icmp eq i64 %14, -1
br i1 %15, label %16, label %17
16: ; preds = %13
br label %19
17: ; preds = %13
%18 = call i32 @usleep(i32 10000)
br label %6
19: ; preds = %16
%20 = call i32 @pthread_exit(i32* null)
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
define noalias i8* @time_keeper(i8* nocapture readnone %0) {
%2 = tail call i32 @usleep(i32 10000)
%3 = tail call i64 (...) @last_check_in()
%4 = icmp sgt i64 %3, 1000000
br i1 %4, label %5, label %8
5: ; preds = %11, %1
%6 = tail call i32 @putchar(i32 49)
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %1, %11
%9 = phi i64 [ %13, %11 ], [ %3, %1 ]
%10 = icmp eq i64 %9, -1
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = tail call i32 @usleep(i32 10000)
%13 = tail call i64 (...) @last_check_in()
%14 = icmp sgt i64 %13, 1000000
br i1 %14, label %5, label %8
15: ; preds = %8
%16 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}