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

/* Variables and functions */
scalar_t__ EPERM;
int adjtime(struct timeval *, struct timeval *);
int /*<<< orphan*/ assert(int);
scalar_t__ errno;
int /*<<< orphan*/ printf(char *, unsigned long, int);
int main() {
  struct timeval a, b;
  int rc;
  a.tv_sec = 0;
  a.tv_usec = 0;
  rc = adjtime(&a, &b);
  assert(!rc || errno == EPERM);
  rc = adjtime(&a, NULL);
  assert(!rc || errno == EPERM);
  rc = adjtime(NULL, &b);
  assert(!rc);
  assert(b.tv_sec < 30);
  assert(b.tv_sec > -30);
  assert(b.tv_usec > -1000000);
  assert(b.tv_usec < 1000000);
  printf("%lu/%d\n", (unsigned long)b.tv_sec, (int)b.tv_usec);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <adjtime@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0x1d(%rbp)
je     1186 <main+0x56>
mov    0x2e6d(%rip),%rax
mov    (%rax),%rax
mov    0x2e53(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <adjtime@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0x1e(%rbp)
je     11cc <main+0x9c>
mov    0x2e27(%rip),%rax
mov    (%rax),%rax
mov    0x2e0d(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x1e(%rbp)
mov    -0x1e(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    -0x18(%rbp),%rsi
call   1040 <adjtime@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0x1e,-0x18(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0xffffffe2,-0x18(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0xfff0bdc0,-0x14(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpl   $0xf4240,-0x14(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movslq -0x18(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xdac(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <adjtime@plt>
test   %eax,%eax
sete   %al
mov    0x2e7b(%rip),%r12
mov    (%r12),%rcx
mov    0x2e60(%rip),%rbx
cmp    (%rbx),%rcx
sete   %cl
or     %al,%cl
movzbl %cl,%edi
call   1050 <assert@plt>
mov    %r15,%rdi
xor    %esi,%esi
call   1040 <adjtime@plt>
test   %eax,%eax
sete   %al
mov    (%r12),%rcx
cmp    (%rbx),%rcx
sete   %cl
or     %al,%cl
movzbl %cl,%edi
call   1050 <assert@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1040 <adjtime@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmpl   $0x1e,0x8(%rsp)
setl   %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmpl   $0xffffffe3,0x8(%rsp)
setge  %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmpl   $0xfff0bdc1,0xc(%rsp)
ff
setge  %dil
call   1050 <assert@plt>
xor    %edi,%edi
cmpl   $0xf4240,0xc(%rsp)
setl   %dil
call   1050 <assert@plt>
movslq 0x8(%rsp),%rsi
mov    0xc(%rsp),%edx
lea    0xdf0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
@errno = global i64 0
@EPERM = global i64 0
@.str = [8 x i8] c"%lu/%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.timeval
%3 = alloca %struct.timeval
%4 = alloca i32
store i32 0, i32* %1
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
store i32 0, i32* %5
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 1
store i32 0, i32* %6
%7 = call i32 @adjtime(%struct.timeval* %2, %struct.timeval* %3)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %0
%11 = load i64, i64* @errno
%12 = load i64, i64* @EPERM
%13 = icmp eq i64 %11, %12
br label %14
14: ; preds = %10, %0
%15 = phi i1 [ true, %0 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = call i32 @adjtime(%struct.timeval* %2, %struct.timeval* null)
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %14
%22 = load i64, i64* @errno
%23 = load i64, i64* @EPERM
%24 = icmp eq i64 %22, %23
br label %25
25: ; preds = %21, %14
%26 = phi i1 [ true, %14 ], [ %24, %21 ]
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = call i32 @adjtime(%struct.timeval* null, %struct.timeval* %3)
store i32 %29, i32* %4
%30 = load i32, i32* %4
%31 = icmp ne i32 %30, 0
%32 = xor i1 %31, true
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
%35 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%36 = load i32, i32* %35
%37 = icmp slt i32 %36, 30
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%41 = load i32, i32* %40
%42 = icmp sgt i32 %41, -30
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%46 = load i32, i32* %45
%47 = icmp sgt i32 %46, -1000000
%48 = zext i1 %47 to i32
%49 = call i32 @assert(i32 %48)
%50 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%51 = load i32, i32* %50
%52 = icmp slt i32 %51, 1000000
%53 = zext i1 %52 to i32
%54 = call i32 @assert(i32 %53)
%55 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%56 = load i32, i32* %55
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%59 = load i32, i32* %58
%60 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 %57, i32 %59)
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
@errno = global i64 0
@EPERM = global i64 0
@.str = [8 x i8] c"%lu/%d\0A\00"
define i32 @main() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.timeval* %2 to i8*
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
store i32 0, i32* %5
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
store i32 0, i32* %6
%7 = call i32 @adjtime(%struct.timeval* %1, %struct.timeval* %2)
%8 = icmp eq i32 %7, 0
%9 = load i64, i64* @errno
%10 = load i64, i64* @EPERM
%11 = icmp eq i64 %9, %10
%12 = select i1 %8, i1 true, i1 %11
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = call i32 @adjtime(%struct.timeval* %1, %struct.timeval* null)
%16 = icmp eq i32 %15, 0
%17 = load i64, i64* @errno
%18 = load i64, i64* @EPERM
%19 = icmp eq i64 %17, %18
%20 = select i1 %16, i1 true, i1 %19
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = call i32 @adjtime(%struct.timeval* null, %struct.timeval* %2)
%24 = icmp eq i32 %23, 0
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%28 = load i32, i32* %27
%29 = icmp slt i32 %28, 30
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = load i32, i32* %27
%33 = icmp sgt i32 %32, -30
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
%37 = load i32, i32* %36
%38 = icmp sgt i32 %37, -1000000
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = load i32, i32* %36
%42 = icmp slt i32 %41, 1000000
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = load i32, i32* %27
%46 = sext i32 %45 to i64
%47 = load i32, i32* %36
%48 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 %46, i32 %47)
ret i32 0
}