#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 */
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ CLOCK_PROCESS_CPUTIME_ID;
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ CLOCK_THREAD_CPUTIME_ID;
int /*<<< orphan*/ assert(int);
scalar_t__ clock_getres(int /*<<< orphan*/, struct timespec *);
int main() {
  struct timespec ts;
  assert(clock_getres(CLOCK_REALTIME, &ts) == 0);
  assert(clock_getres(CLOCK_MONOTONIC, &ts) == 0);
  assert(clock_getres(CLOCK_PROCESS_CPUTIME_ID, &ts) == 0);
  assert(clock_getres(CLOCK_THREAD_CPUTIME_ID, &ts) == 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1040 <clock_getres@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1040 <clock_getres@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1040 <clock_getres@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1040 <clock_getres@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <clock_getres@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1030 <assert@plt>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1040 <clock_getres@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1030 <assert@plt>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1040 <clock_getres@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1030 <assert@plt>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
call   1040 <clock_getres@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
@CLOCK_MONOTONIC = global i32 0
@CLOCK_PROCESS_CPUTIME_ID = global i32 0
@CLOCK_THREAD_CPUTIME_ID = global i32 0
define i32 @main() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_REALTIME
%3 = call i64 @clock_getres(i32 %2, %struct.timespec* %1)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load i32, i32* @CLOCK_MONOTONIC
%8 = call i64 @clock_getres(i32 %7, %struct.timespec* %1)
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i32, i32* @CLOCK_PROCESS_CPUTIME_ID
%13 = call i64 @clock_getres(i32 %12, %struct.timespec* %1)
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%18 = call i64 @clock_getres(i32 %17, %struct.timespec* %1)
%19 = icmp eq i64 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
ret i32 0
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
@CLOCK_MONOTONIC = global i32 0
@CLOCK_PROCESS_CPUTIME_ID = global i32 0
@CLOCK_THREAD_CPUTIME_ID = global i32 0
define i32 @main() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_REALTIME
%4 = call i64 @clock_getres(i32 %3, %struct.timespec* %1)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = load i32, i32* @CLOCK_MONOTONIC
%9 = call i64 @clock_getres(i32 %8, %struct.timespec* %1)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32, i32* @CLOCK_PROCESS_CPUTIME_ID
%14 = call i64 @clock_getres(i32 %13, %struct.timespec* %1)
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i32, i32* @CLOCK_THREAD_CPUTIME_ID
%19 = call i64 @clock_getres(i32 %18, %struct.timespec* %1)
%20 = icmp eq i64 %19, 0
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
ret i32 0
}