#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void usage(char *prg) {
  fprintf(stderr,
          "\n [~] 0x333xes => stack overflow exploit generator v%s [~]\n",
          "0.3");
  fprintf(stderr,
          " [~]          coded by c0wboy ~ www.0x333.org          [~] \n\n");
  fprintf(stderr, " Usage : %s [ -b binary ] [ -e environ ] [ -w switch ]",
          prg);
  fprintf(
      stderr,
      " [ -s type ] [ -x ] [ -l lenght ] [ -o lenght ] [ -a align ] [ -h ]\n");
  fprintf(stderr, "\n \t-b\tbugged binary\n");
  fprintf(stderr, " \t-e\tset environ variable bugged\n");
  fprintf(stderr, " \t-w\tset switch bugged\n");
  fprintf(stderr, " \t-s\tshellcode type [0-%d]\n", 4 - 1);
  fprintf(stderr, " \t-x\tshellcode list\n");
  fprintf(stderr, " \t-l\tbuffer lenght\n");
  fprintf(stderr, " \t-o\tevil buffer (nop+shellcode) lenght (default 1337)\n");
  fprintf(stderr, " \t-a\talign the buffer (try 1)\n");
  fprintf(stderr, " \t-h\tdisplay this help\n\n");
  exit(-333);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
lea    0xec4(%rip),%rsi
lea    0xef9(%rip),%rdx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
lea    0xee6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xf09(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    0xf29(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
lea    0xf57(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
lea    0xf55(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
lea    0xf60(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
lea    0xf61(%rip),%rsi
mov    $0x3,%edx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2de5(%rip),%rax
mov    (%rax),%edi
lea    0xf61(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2dce(%rip),%rax
mov    (%rax),%edi
lea    0xf5f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2db7(%rip),%rax
mov    (%rax),%edi
lea    0xf5c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
lea    0xf7d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2d89(%rip),%rax
mov    (%rax),%edi
lea    0xf85(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0xfffffeb3,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    0x2eb2(%rip),%rbx
mov    (%rbx),%edi
lea    0xec9(%rip),%rsi
lea    0xefe(%rip),%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xef2(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf20(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf44(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf79(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf7e(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf90(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf98(%rip),%rsi
mov    $0x3,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf9f(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xfa4(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xfa8(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xfd0(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xfdf(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0xfffffeb3,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [60 x i8] c"\0A [~] 0x333xes => stack overflow exploit generator v%s [~]\0A\00"
@.str.1 = [4 x i8] c"0.3\00"
@.str.2 = [62 x i8] c" [~] coded by c0wboy ~ www.0x333.org [~] \0A\0A\00"
@.str.3 = [55 x i8] c" Usage : %s [ -b binary ] [ -e environ ] [ -w switch ]\00"
@.str.4 = [69 x i8] c" [ -s type ] [ -x ] [ -l lenght ] [ -o lenght ] [ -a align ] [ -h ]\0A\00"
@.str.5 = [21 x i8] c"\0A \09-b\09bugged binary\0A\00"
@.str.6 = [34 x i8] c" \09-e\09set environ variable bugged\0A\00"
@.str.7 = [24 x i8] c" \09-w\09set switch bugged\0A\00"
@.str.8 = [28 x i8] c" \09-s\09shellcode type [0-%d]\0A\00"
@.str.9 = [21 x i8] c" \09-x\09shellcode list\0A\00"
@.str.10 = [20 x i8] c" \09-l\09buffer lenght\0A\00"
@.str.11 = [56 x i8] c" \09-o\09evil buffer (nop+shellcode) lenght (default 1337)\0A\00"
@.str.12 = [31 x i8] c" \09-a\09align the buffer (try 1)\0A\00"
@.str.13 = [25 x i8] c" \09-h\09display this help\0A\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %2
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @stderr
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.4, i64 0, i64 0))
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 3)
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
%22 = load i32, i32* @stderr
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
%24 = load i32, i32* @stderr
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.11, i64 0, i64 0))
%26 = load i32, i32* @stderr
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0))
%28 = load i32, i32* @stderr
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.13, i64 0, i64 0))
%30 = call i32 @exit(i32 -333)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [60 x i8] c"\0A [~] 0x333xes => stack overflow exploit generator v%s [~]\0A\00"
@.str.1 = [4 x i8] c"0.3\00"
@.str.2 = [62 x i8] c" [~] coded by c0wboy ~ www.0x333.org [~] \0A\0A\00"
@.str.3 = [55 x i8] c" Usage : %s [ -b binary ] [ -e environ ] [ -w switch ]\00"
@.str.4 = [69 x i8] c" [ -s type ] [ -x ] [ -l lenght ] [ -o lenght ] [ -a align ] [ -h ]\0A\00"
@.str.5 = [21 x i8] c"\0A \09-b\09bugged binary\0A\00"
@.str.6 = [34 x i8] c" \09-e\09set environ variable bugged\0A\00"
@.str.7 = [24 x i8] c" \09-w\09set switch bugged\0A\00"
@.str.8 = [28 x i8] c" \09-s\09shellcode type [0-%d]\0A\00"
@.str.9 = [21 x i8] c" \09-x\09shellcode list\0A\00"
@.str.10 = [20 x i8] c" \09-l\09buffer lenght\0A\00"
@.str.11 = [56 x i8] c" \09-o\09evil buffer (nop+shellcode) lenght (default 1337)\0A\00"
@.str.12 = [31 x i8] c" \09-a\09align the buffer (try 1)\0A\00"
@.str.13 = [25 x i8] c" \09-h\09display this help\0A\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0))
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.4, i64 0, i64 0))
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%16 = load i32, i32* @stderr
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0), i32 3)
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0))
%20 = load i32, i32* @stderr
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.10, i64 0, i64 0))
%22 = load i32, i32* @stderr
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.11, i64 0, i64 0))
%24 = load i32, i32* @stderr
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0))
%26 = load i32, i32* @stderr
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.13, i64 0, i64 0))
%28 = tail call i32 @exit(i32 -333)
unreachable
}