#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 */
char *basename(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strncpy(char *, char const *, int);
void print_usage(const char *exec_name) {
  char buffer[2048];
  strncpy(buffer, exec_name, 2048);
  buffer[2048 - 1] = 0;
  printf("Usage: %s [option(s)]\n", basename(buffer));
  printf("Options:\n"
         "    -h: print helps\n"
         "    -a: the node where the memory is allocated on\n"
         "    -c: the cpu where creates a thread to access memory.\n"
         "    -t: the seconds for measuring.\n"
         "    -s: the random seed to build random address array (just for "
         "reproducing).\n");
  printf("\nFor example:\n"
         "    1. Generate LMA for 10s (memory allocated on node1, thread runs "
         "on cpu1):\n"
         "       %s -a 1 -c 1 -t 10\n"
         "    2. Generate RMA for 10s (memory allocated on node0, thread runs "
         "on cpu10):\n"
         "       %s -a 0 -c 10 -t 10\n",
         basename(buffer), basename(buffer));
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x810(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x800,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x11(%rbp)
lea    -0x810(%rbp),%rdi
call   1050 <basename@plt>
mov    %rax,%rsi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x810(%rbp),%rdi
call   1050 <basename@plt>
mov    %rax,-0x818(%rbp)
lea    -0x810(%rbp),%rdi
call   1050 <basename@plt>
mov    -0x818(%rbp),%rsi
mov    %rax,%rdx
lea    0xf5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
push   %r14
push   %rbx
sub    $0x808,%rsp
mov    %rdi,%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x800,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x7ff(%rsp)
mov    %r14,%rdi
call   1060 <basename@plt>
lea    0xe8c(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf73(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
call   1060 <basename@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1060 <basename@plt>
lea    0xe73(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x808,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Usage: %s [option(s)]\0A\00"
@.str.1 = [250 x i8] c"Options:\0A -h: print helps\0A -a: the node where the memory is allocated on\0A -c: the cpu where creates a thread to access memory.\0A -t: the seconds for measuring.\0A -s: the random seed to build random address array (just for reproducing).\0A\00"
@.str.2 = [225 x i8] c"\0AFor example:\0A 1. Generate LMA for 10s (memory allocated on node1, thread runs on cpu1):\0A %s -a 1 -c 1 -t 10\0A 2. Generate RMA for 10s (memory allocated on node0, thread runs on cpu10):\0A %s -a 0 -c 10 -t 10\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
%3 = alloca [2048 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @strncpy(i8* %4, i8* %5, i32 2048)
%7 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 2047
store i8 0, i8* %7
%8 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%9 = call i8* @basename(i8* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([250 x i8], [250 x i8]* @.str.1, i64 0, i64 0))
%12 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%13 = call i8* @basename(i8* %12)
%14 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%15 = call i8* @basename(i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([225 x i8], [225 x i8]* @.str.2, i64 0, i64 0), i8* %13, i8* %15)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"Usage: %s [option(s)]\0A\00"
@.str.2 = [225 x i8] c"\0AFor example:\0A 1. Generate LMA for 10s (memory allocated on node1, thread runs on cpu1):\0A %s -a 1 -c 1 -t 10\0A 2. Generate RMA for 10s (memory allocated on node0, thread runs on cpu10):\0A %s -a 0 -c 10 -t 10\0A\00"
@str = [249 x i8] c"Options:\0A -h: print helps\0A -a: the node where the memory is allocated on\0A -c: the cpu where creates a thread to access memory.\0A -t: the seconds for measuring.\0A -s: the random seed to build random address array (just for reproducing).\00"
define void @print_usage(i8* %0) {
%2 = alloca [2048 x i8]
%3 = getelementptr inbounds [2048 x i8], [2048 x i8]* %2, i64 0, i64 0
%4 = call i32 @strncpy(i8* %3, i8* %0, i32 2048)
%5 = getelementptr inbounds [2048 x i8], [2048 x i8]* %2, i64 0, i64 2047
store i8 0, i8* %5
%6 = call i8* @basename(i8* %3)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([249 x i8], [249 x i8]* @str, i64 0, i64 0))
%9 = call i8* @basename(i8* %3)
%10 = call i8* @basename(i8* %3)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([225 x i8], [225 x i8]* @.str.2, i64 0, i64 0), i8* %9, i8* %10)
ret void
}