#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*/ _SC_CLK_TCK;
int /*<<< orphan*/ _SC_PAGESIZE;
scalar_t__ __libc_getpagesize();
int /*<<< orphan*/ assert(int);
scalar_t__ do_check(char *, size_t);
int ffs(size_t);
size_t sysconf(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  unsigned int err = 0;
  assert(sysconf(_SC_PAGESIZE) == ((size_t)__libc_getpagesize()));
  assert(((size_t)__libc_getpagesize()) ==
         (1 << (ffs(((size_t)__libc_getpagesize())) - 1)));
  err += do_check("PAGE_SIZE", sysconf(_SC_PAGESIZE));
  err += do_check("CLK_TCK", sysconf(_SC_CLK_TCK));
  return err;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
call   1060 <sysconf@plt>
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1050 <__libc_getpagesize@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x0,%al
call   1050 <__libc_getpagesize@plt>
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1050 <__libc_getpagesize@plt>
mov    %rax,%rdi
call   1040 <ffs@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
sub    $0x1,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    0x2e05(%rip),%rax
mov    (%rax),%edi
call   1060 <sysconf@plt>
mov    %rax,%rsi
lea    0xe0c(%rip),%rdi
call   1070 <do_check@plt>
mov    %rax,%rcx
mov    -0x14(%rbp),%eax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
call   1060 <sysconf@plt>
mov    %rax,%rsi
lea    0xded(%rip),%rdi
call   1070 <do_check@plt>
mov    %rax,%rcx
mov    -0x14(%rbp),%eax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2e9d(%rip),%r14
mov    (%r14),%edi
call   1050 <sysconf@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <__libc_getpagesize@plt>
xor    %edi,%edi
cmp    %rax,%rbx
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
call   1040 <__libc_getpagesize@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <__libc_getpagesize@plt>
bsf    %rax,%rcx
mov    $0x1,%eax
shl    %cl,%eax
cltq
xor    %edi,%edi
cmp    %rax,%rbx
sete   %dil
call   1030 <assert@plt>
mov    (%r14),%edi
call   1050 <sysconf@plt>
lea    0xe5a(%rip),%rdi
mov    %rax,%rsi
call   1060 <do_check@plt>
mov    %rax,%rbx
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
call   1050 <sysconf@plt>
lea    0xe44(%rip),%rdi
mov    %rax,%rsi
call   1060 <do_check@plt>
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@_SC_PAGESIZE = global i32 0
@.str = [10 x i8] c"PAGE_SIZE\00"
@.str.1 = [8 x i8] c"CLK_TCK\00"
@_SC_CLK_TCK = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* @_SC_PAGESIZE
%8 = call i64 @sysconf(i32 %7)
%9 = call i64 (...) @__libc_getpagesize()
%10 = icmp eq i64 %8, %9
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i64 (...) @__libc_getpagesize()
%14 = call i64 (...) @__libc_getpagesize()
%15 = call i32 @ffs(i64 %14)
%16 = sub nsw i32 %15, 1
%17 = shl i32 1, %16
%18 = sext i32 %17 to i64
%19 = icmp eq i64 %13, %18
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load i32, i32* @_SC_PAGESIZE
%23 = call i64 @sysconf(i32 %22)
%24 = call i64 @do_check(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 %23)
%25 = load i32, i32* %6
%26 = zext i32 %25 to i64
%27 = add nsw i64 %26, %24
%28 = trunc i64 %27 to i32
store i32 %28, i32* %6
%29 = load i32, i32* @_SC_CLK_TCK
%30 = call i64 @sysconf(i32 %29)
%31 = call i64 @do_check(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i64 %30)
%32 = load i32, i32* %6
%33 = zext i32 %32 to i64
%34 = add nsw i64 %33, %31
%35 = trunc i64 %34 to i32
store i32 %35, i32* %6
%36 = load i32, i32* %6
ret i32 %36
}

LLVM IR (-O2):
@_SC_PAGESIZE = global i32 0
@.str = [10 x i8] c"PAGE_SIZE\00"
@.str.1 = [8 x i8] c"CLK_TCK\00"
@_SC_CLK_TCK = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @_SC_PAGESIZE
%4 = tail call i64 @sysconf(i32 %3)
%5 = tail call i64 (...) @__libc_getpagesize()
%6 = icmp eq i64 %4, %5
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i64 (...) @__libc_getpagesize()
%10 = tail call i64 (...) @__libc_getpagesize()
%11 = tail call i64 @llvm.cttz.i64(i64 %10, i1 true)
%12 = trunc i64 %11 to i32
%13 = shl nuw i32 1, %12
%14 = sext i32 %13 to i64
%15 = icmp eq i64 %9, %14
%16 = zext i1 %15 to i32
%17 = tail call i32 @assert(i32 %16)
%18 = load i32, i32* @_SC_PAGESIZE
%19 = tail call i64 @sysconf(i32 %18)
%20 = tail call i64 @do_check(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64 %19)
%21 = load i32, i32* @_SC_CLK_TCK
%22 = tail call i64 @sysconf(i32 %21)
%23 = tail call i64 @do_check(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i64 %22)
%24 = add i64 %23, %20
%25 = trunc i64 %24 to i32
ret i32 %25
}