#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*/ printf(char *, ...);
int usage(const char *progname) {
  printf("\nUsage: %s [ -e ] [-f fast|rand] [-j <oom_adj>|inherit] [ -l ] "
         "<megabytes>\n",
         progname);
  printf("\nOptions:\n");
  printf("  -e\t\texit after consuming/dirtying the allocated memory.\n");
  printf("  -l\t\tthe given amount of RAM is left free instead of consumed.\n");
  printf("  -f\t\tfilling memory using 'rand' or 'fast' method.\n");
  printf(
      "  -j\t\tset oom_adj to specified value (default = 0) or inherit it.\n");
  printf("\nExample:\n");
  printf("  %s -e 20\n", progname);
  printf("  %s -f fast -j inherit 20\n", progname);
  printf("  %s -f fast -j -17 -l 20\n", progname);
  printf("\n");
  return 1;
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf17(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfd0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xfc9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xfc3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xfcd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf43(%rip),%rdi
call   1040 <puts@plt>
lea    0xf41(%rip),%rdi
call   1040 <puts@plt>
lea    0xf6f(%rip),%rdi
call   1040 <puts@plt>
lea    0xfa3(%rip),%rdi
call   1040 <puts@plt>
lea    0xfcb(%rip),%rdi
call   1040 <puts@plt>
lea    0x1001(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb8(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb3(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [76 x i8] c"\0AUsage: %s [ -e ] [-f fast|rand] [-j <oom_adj>|inherit] [ -l ] <megabytes>\0A\00"
@.str.1 = [11 x i8] c"\0AOptions:\0A\00"
@.str.2 = [59 x i8] c" -e\09\09exit after consuming/dirtying the allocated memory.\0A\00"
@.str.3 = [65 x i8] c" -l\09\09the given amount of RAM is left free instead of consumed.\0A\00"
@.str.4 = [53 x i8] c" -f\09\09filling memory using 'rand' or 'fast' method.\0A\00"
@.str.5 = [67 x i8] c" -j\09\09set oom_adj to specified value (default = 0) or inherit it.\0A\00"
@.str.6 = [11 x i8] c"\0AExample:\0A\00"
@.str.7 = [12 x i8] c" %s -e 20\0A\00"
@.str.8 = [28 x i8] c" %s -f fast -j inherit 20\0A\00"
@.str.9 = [27 x i8] c" %s -f fast -j -17 -l 20\0A\00"
@.str.10 = [2 x i8] c"\0A\00"
define i32 @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.4, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%11 = load i8*, i8** %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i8* %11)
%13 = load i8*, i8** %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8* %13)
%15 = load i8*, i8** %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i8* %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@.str = [76 x i8] c"\0AUsage: %s [ -e ] [-f fast|rand] [-j <oom_adj>|inherit] [ -l ] <megabytes>\0A\00"
@.str.7 = [12 x i8] c" %s -e 20\0A\00"
@.str.8 = [28 x i8] c" %s -f fast -j inherit 20\0A\00"
@.str.9 = [27 x i8] c" %s -f fast -j -17 -l 20\0A\00"
@str = [10 x i8] c"\0AOptions:\00"
@str.11 = [58 x i8] c" -e\09\09exit after consuming/dirtying the allocated memory.\00"
@str.12 = [64 x i8] c" -l\09\09the given amount of RAM is left free instead of consumed.\00"
@str.13 = [52 x i8] c" -f\09\09filling memory using 'rand' or 'fast' method.\00"
@str.14 = [66 x i8] c" -j\09\09set oom_adj to specified value (default = 0) or inherit it.\00"
@str.15 = [10 x i8] c"\0AExample:\00"
define i32 @usage(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.11, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.12, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str.13, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.14, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.15, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i8* %0)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i8* %0)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i8* %0)
%12 = tail call i32 @putchar(i32 10)
ret i32 1
}