#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*/ exploit(char *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  char buff[15];
  printf("      Try: AAAAAAAAAAAAAAAAAAAAA (16x'A' + 5x'A')\n");
  printf("Don't-Try: AAAAAAAAAAAAAAAAAAAAAAAAA (16x'A' + 8x'A' + 'A')\n");
  printf("      Try: AAAAAAAAAAAAAAAAAAAAAAAA (16 + 8) x 'A'\n");
  printf("\nEnter the Text : \n");
  gets(buff);
  exploit(buff);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
lea    0xf12(%rip),%rdi
call   1030 <printf@plt>
lea    0xf3a(%rip),%rdi
call   1030 <printf@plt>
lea    -0x13(%rbp),%rdi
call   1040 <gets@plt>
lea    -0x13(%rbp),%rdi
call   1050 <exploit@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
lea    0xeea(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1a(%rip),%rdi
call   1030 <puts@plt>
lea    0xf41(%rip),%rdi
call   1030 <puts@plt>
lea    0x1(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <gets@plt>
mov    %rbx,%rdi
call   1050 <exploit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [51 x i8] c" Try: AAAAAAAAAAAAAAAAAAAAA (16x'A' + 5x'A')\0A\00"
@.str.1 = [61 x i8] c"Don't-Try: AAAAAAAAAAAAAAAAAAAAAAAAA (16x'A' + 8x'A' + 'A')\0A\00"
@.str.2 = [52 x i8] c" Try: AAAAAAAAAAAAAAAAAAAAAAAA (16 + 8) x 'A'\0A\00"
@.str.3 = [20 x i8] c"\0AEnter the Text : \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8]
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%7 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%8 = call i32 @gets(i8* %7)
%9 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%10 = call i32 @exploit(i8* %9)
ret i32 0
}

LLVM IR (-O2):
@str = [50 x i8] c" Try: AAAAAAAAAAAAAAAAAAAAA (16x'A' + 5x'A')\00"
@str.4 = [60 x i8] c"Don't-Try: AAAAAAAAAAAAAAAAAAAAAAAAA (16x'A' + 8x'A' + 'A')\00"
@str.5 = [51 x i8] c" Try: AAAAAAAAAAAAAAAAAAAAAAAA (16 + 8) x 'A'\00"
@str.6 = [19 x i8] c"\0AEnter the Text : \00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.4, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.5, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.6, i64 0, i64 0))
%7 = call i32 @gets(i8* %2)
%8 = call i32 @exploit(i8* %2)
ret i32 0
}