#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 */
typedef int /*<<< orphan*/ os_name;
typedef int /*<<< orphan*/ machine_arch;
typedef int /*<<< orphan*/ hostname;

/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ execvp(char *, char **);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char *, char *, unsigned int,
                          unsigned int);
int /*<<< orphan*/ system_arch(char *, int);
unsigned int system_available_cpus();
int /*<<< orphan*/ system_hostname(char *, int);
int /*<<< orphan*/ system_os(char *, int);
unsigned int system_phys_memory();
int main(int argc, char *argv[]) {
  char hostname[100];
  system_hostname(hostname, sizeof(hostname));
  unsigned int nofCpus = system_available_cpus();
  unsigned int nofPhysMem = system_phys_memory();
  char os_name[100];
  system_os(os_name, sizeof(os_name));
  char machine_arch[100];
  system_arch(machine_arch, sizeof(machine_arch));
  printf("{ "
         "\"arch\": \"%s\", "
         "\"os\": \"%s\", "
         "\"host\": \"%s\", "
         "\"cpus\": %d, "
         "\"physical_memory\": %d "
         "}\n",
         machine_arch, os_name, hostname, nofCpus, nofPhysMem);
  execvp(argv[1], &argv[1]);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
mov    $0x64,%esi
call   1040 <system_hostname@plt>
mov    $0x0,%al
call   1060 <system_available_cpus@plt>
mov    %eax,-0x84(%rbp)
mov    $0x0,%al
call   1080 <system_phys_memory@plt>
mov    %eax,-0x88(%rbp)
lea    -0xf0(%rbp),%rdi
mov    $0x64,%esi
call   1030 <system_os@plt>
lea    -0x160(%rbp),%rdi
mov    $0x64,%esi
call   10a0 <system_arch@plt>
lea    -0x160(%rbp),%rsi
lea    -0xf0(%rbp),%rdx
lea    -0x80(%rbp),%rcx
mov    -0x84(%rbp),%r8d
mov    -0x88(%rbp),%r9d
lea    0xdf6(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1070 <execvp@plt>
mov    0x2db5(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x148,%rsp
mov    %rsi,%rbx
lea    0xe0(%rsp),%r14
mov    %r14,%rdi
mov    $0x64,%esi
call   1040 <system_hostname@plt>
xor    %eax,%eax
call   1060 <system_available_cpus@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1080 <system_phys_memory@plt>
mov    %eax,%r13d
lea    0x70(%rsp),%r12
mov    %r12,%rdi
mov    $0x64,%esi
call   1030 <system_os@plt>
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    $0x64,%esi
call   10a0 <system_arch@plt>
lea    0xe1a(%rip),%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
mov    %r14,%rcx
mov    %r15d,%r8d
mov    %r13d,%r9d
call   1050 <printf@plt>
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
mov    %rbx,%rsi
call   1070 <execvp@plt>
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [79 x i8] c"{ \22arch\22: \22%s\22, \22os\22: \22%s\22, \22host\22: \22%s\22, \22cpus\22: %d, \22physical_memory\22: %d }\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [100 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca [100 x i8]
%10 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%12 = call i32 @system_hostname(i8* %11, i32 100)
%13 = call i32 (...) @system_available_cpus()
store i32 %13, i32* %7
%14 = call i32 (...) @system_phys_memory()
store i32 %14, i32* %8
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%16 = call i32 @system_os(i8* %15, i32 100)
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%18 = call i32 @system_arch(i8* %17, i32 100)
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0), i8* %19, i8* %20, i8* %21, i32 %22, i32 %23)
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = call i32 @execvp(i8* %27, i8** %29)
%31 = load i32, i32* @EXIT_SUCCESS
%32 = call i32 @exit(i32 %31)
unreachable
}

LLVM IR (-O2):
@.str = [79 x i8] c"{ \22arch\22: \22%s\22, \22os\22: \22%s\22, \22host\22: \22%s\22, \22cpus\22: %d, \22physical_memory\22: %d }\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = call i32 @system_hostname(i8* %6, i32 100)
%8 = call i32 (...) @system_available_cpus()
%9 = call i32 (...) @system_phys_memory()
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%11 = call i32 @system_os(i8* %10, i32 100)
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%13 = call i32 @system_arch(i8* %12, i32 100)
%14 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %10, i8* %6, i32 %8, i32 %9)
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @execvp(i8* %16, i8** %15)
%18 = load i32, i32* @EXIT_SUCCESS
%19 = call i32 @exit(i32 %18)
unreachable
}