#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_AVPHYS_PAGES;
int /*<<< orphan*/ _SC_PAGESIZE;
int /*<<< orphan*/ _SC_PHYS_PAGES;
int get_avphys_pages();
int get_phys_pages();
int /*<<< orphan*/ printf(char *, int);
int sysconf(int /*<<< orphan*/);
int main(void) {
  printf("sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) = 0x%lX\n",
         sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE));
  printf("sysconf(_SC_AVPHYS_PAGES) * sysconf(_SC_PAGESIZE) = 0x%lX\n",
         sysconf(_SC_AVPHYS_PAGES) * sysconf(_SC_PAGESIZE));
  printf("get_phys_pages() * sysconf(_SC_PAGESIZE) = 0x%lX\n",
         get_phys_pages() * sysconf(_SC_PAGESIZE));
  printf("get_avphys_pages() * sysconf(_SC_PAGESIZE) = 0x%lX\n",
         get_avphys_pages() * sysconf(_SC_PAGESIZE));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
call   1060 <sysconf@plt>
mov    %eax,-0x10(%rbp)
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
call   1060 <sysconf@plt>
mov    -0x10(%rbp),%esi
imul   %eax,%esi
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%edi
call   1060 <sysconf@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
call   1060 <sysconf@plt>
mov    -0xc(%rbp),%esi
imul   %eax,%esi
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <get_phys_pages@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
call   1060 <sysconf@plt>
mov    -0x8(%rbp),%esi
imul   %eax,%esi
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <get_avphys_pages@plt>
mov    %eax,-0x4(%rbp)
mov    0x2dfb(%rip),%rax
mov    (%rax),%edi
call   1060 <sysconf@plt>
mov    -0x4(%rbp),%esi
imul   %eax,%esi
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1060 <sysconf@plt>
mov    %eax,%ebx
mov    0x2e85(%rip),%r14
mov    (%r14),%edi
call   1060 <sysconf@plt>
imul   %eax,%ebx
lea    0xe93(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
call   1060 <sysconf@plt>
mov    %eax,%ebx
mov    (%r14),%edi
call   1060 <sysconf@plt>
imul   %eax,%ebx
lea    0xea3(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <get_phys_pages@plt>
mov    %eax,%ebx
mov    (%r14),%edi
call   1060 <sysconf@plt>
imul   %eax,%ebx
lea    0xebc(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <get_avphys_pages@plt>
mov    %eax,%ebx
mov    (%r14),%edi
call   1060 <sysconf@plt>
imul   %eax,%ebx
lea    0xecc(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [57 x i8] c"sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) = 0x%lX\0A\00"
@_SC_PHYS_PAGES = global i32 0
@_SC_PAGESIZE = global i32 0
@.str.1 = [59 x i8] c"sysconf(_SC_AVPHYS_PAGES) * sysconf(_SC_PAGESIZE) = 0x%lX\0A\00"
@_SC_AVPHYS_PAGES = global i32 0
@.str.2 = [50 x i8] c"get_phys_pages() * sysconf(_SC_PAGESIZE) = 0x%lX\0A\00"
@.str.3 = [52 x i8] c"get_avphys_pages() * sysconf(_SC_PAGESIZE) = 0x%lX\0A\00"
define i32 @main() {
%1 = load i32, i32* @_SC_PHYS_PAGES
%2 = call i32 @sysconf(i32 %1)
%3 = load i32, i32* @_SC_PAGESIZE
%4 = call i32 @sysconf(i32 %3)
%5 = mul nsw i32 %2, %4
%6 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @_SC_AVPHYS_PAGES
%8 = call i32 @sysconf(i32 %7)
%9 = load i32, i32* @_SC_PAGESIZE
%10 = call i32 @sysconf(i32 %9)
%11 = mul nsw i32 %8, %10
%12 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = call i32 (...) @get_phys_pages()
%14 = load i32, i32* @_SC_PAGESIZE
%15 = call i32 @sysconf(i32 %14)
%16 = mul nsw i32 %13, %15
%17 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = call i32 (...) @get_avphys_pages()
%19 = load i32, i32* @_SC_PAGESIZE
%20 = call i32 @sysconf(i32 %19)
%21 = mul nsw i32 %18, %20
%22 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [57 x i8] c"sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) = 0x%lX\0A\00"
@_SC_PHYS_PAGES = global i32 0
@_SC_PAGESIZE = global i32 0
@.str.1 = [59 x i8] c"sysconf(_SC_AVPHYS_PAGES) * sysconf(_SC_PAGESIZE) = 0x%lX\0A\00"
@_SC_AVPHYS_PAGES = global i32 0
@.str.2 = [50 x i8] c"get_phys_pages() * sysconf(_SC_PAGESIZE) = 0x%lX\0A\00"
@.str.3 = [52 x i8] c"get_avphys_pages() * sysconf(_SC_PAGESIZE) = 0x%lX\0A\00"
define i32 @main() {
%1 = load i32, i32* @_SC_PHYS_PAGES
%2 = tail call i32 @sysconf(i32 %1)
%3 = load i32, i32* @_SC_PAGESIZE
%4 = tail call i32 @sysconf(i32 %3)
%5 = mul nsw i32 %4, %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @_SC_AVPHYS_PAGES
%8 = tail call i32 @sysconf(i32 %7)
%9 = load i32, i32* @_SC_PAGESIZE
%10 = tail call i32 @sysconf(i32 %9)
%11 = mul nsw i32 %10, %8
%12 = tail call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = tail call i32 (...) @get_phys_pages()
%14 = load i32, i32* @_SC_PAGESIZE
%15 = tail call i32 @sysconf(i32 %14)
%16 = mul nsw i32 %15, %13
%17 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = tail call i32 (...) @get_avphys_pages()
%19 = load i32, i32* @_SC_PAGESIZE
%20 = tail call i32 @sysconf(i32 %19)
%21 = mul nsw i32 %20, %18
%22 = tail call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0), i32 %21)
ret i32 0
}