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

/* Variables and functions */
bool timeval_normalized(const struct timeval *tv) {
  if (tv->tv_sec < 0)
    return false;
  if (tv->tv_usec < 0)
    return false;
  if (tv->tv_usec >= 1000000)
    return false;
  return true;
}


x86 assembly (clang, -O0):
<timeval_normalized>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jge    1122 <timeval_normalized+0x22>
movl   $0x0,-0x4(%rbp)
jmp    1160 <timeval_normalized+0x60>
mov    -0x10(%rbp),%rax
cmpl   $0x0,0x8(%rax)
jge    113c <timeval_normalized+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    1160 <timeval_normalized+0x60>
mov    -0x10(%rbp),%rax
cmpl   $0xf4240,0x8(%rax)
jl     1159 <timeval_normalized+0x59>
movl   $0x0,-0x4(%rbp)
jmp    1160 <timeval_normalized+0x60>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeval_normalized>:
xor    %eax,%eax
cmpq   $0x0,(%rdi)
js     111a <timeval_normalized+0x1a>
mov    0x8(%rdi),%ecx
test   %ecx,%ecx
js     111a <timeval_normalized+0x1a>
xor    %eax,%eax
cmp    $0xf4240,%ecx
setb   %al
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i32 }
define i32 @timeval_normalized(%struct.timeval* %0) {
%2 = alloca i32
%3 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %3
%4 = load %struct.timeval*, %struct.timeval** %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %22
9: ; preds = %1
%10 = load %struct.timeval*, %struct.timeval** %3
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 1
%12 = load i32, i32* %11
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %9
store i32 0, i32* %2
br label %22
15: ; preds = %9
%16 = load %struct.timeval*, %struct.timeval** %3
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %16, i32 0, i32 1
%18 = load i32, i32* %17
%19 = icmp sge i32 %18, 1000000
br i1 %19, label %20, label %21
20: ; preds = %15
store i32 0, i32* %2
br label %22
21: ; preds = %15
store i32 1, i32* %2
br label %22
22: ; preds = %21, %20, %14, %8
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
%struct.timeval = type { i64, i32 }
define i32 @timeval_normalized(%struct.timeval* nocapture %0) {
%2 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %1
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%7 = load i32, i32* %6
%8 = icmp slt i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %5
%10 = icmp ult i32 %7, 1000000
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %9, %5, %1
%13 = phi i32 [ 0, %1 ], [ 0, %5 ], [ %11, %9 ]
ret i32 %13
}