#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 {
  scalar_t__ tv_sec;
  int tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, scalar_t__, int);
void validate_clock(struct timespec *clock_info) {
  if (clock_info->tv_sec != 0 || clock_info->tv_nsec != 1) {
    printf("Error: We expect a 1ns resolution timer. %li s %li ns resolution "
           "instead.\n",
           clock_info->tv_sec, clock_info->tv_nsec);
  }
}


x86 assembly (clang, -O0):
<validate_clock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1138 <validate_clock+0x28>
mov    -0x8(%rbp),%rax
cmpl   $0x1,0x8(%rax)
je     1152 <validate_clock+0x42>
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edx
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_clock>:
mov    (%rdi),%rsi
mov    0x8(%rdi),%edx
test   %rsi,%rsi
jne    1121 <validate_clock+0x11>
cmp    $0x1,%edx
jne    1121 <validate_clock+0x11>
ret
lea    0xed8(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.timespec = type { i64, i32 }
@.str = [75 x i8] c"Error: We expect a 1ns resolution timer. %li s %li ns resolution instead.\0A\00"
define void @validate_clock(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %2
%3 = load %struct.timespec*, %struct.timespec** %2
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
%5 = load i64, i64* %4
%6 = icmp ne i64 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %1
%8 = load %struct.timespec*, %struct.timespec** %2
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 1
%10 = load i32, i32* %9
%11 = icmp ne i32 %10, 1
br i1 %11, label %12, label %20
12: ; preds = %7, %1
%13 = load %struct.timespec*, %struct.timespec** %2
%14 = getelementptr inbounds %struct.timespec, %struct.timespec* %13, i32 0, i32 0
%15 = load i64, i64* %14
%16 = load %struct.timespec*, %struct.timespec** %2
%17 = getelementptr inbounds %struct.timespec, %struct.timespec* %16, i32 0, i32 1
%18 = load i32, i32* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i64 %15, i32 %18)
br label %20
20: ; preds = %12, %7
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i64, i32 }
@.str = [75 x i8] c"Error: We expect a 1ns resolution timer. %li s %li ns resolution instead.\0A\00"
define void @validate_clock(%struct.timespec* nocapture %0) {
%2 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%3 = load i64, i64* %2
%4 = icmp eq i64 %3, 0
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 1
%8 = select i1 %4, i1 %7, i1 false
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = tail call i32 @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i64 %3, i32 %6)
br label %11
11: ; preds = %1, %9
ret void
}