#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*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stdout;
int strlen(char *);
int main() {
  setbuf(stdout, NULL);
  char input[32];
  puts(
      "I check input length now! Your attacks have no effect on me anymore!!!");
  printf("Your response? ");
  scanf("%s", input);
  if (strlen(input) > 32) {
    exit(1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <setbuf@plt>
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
lea    0xeba(%rip),%rdi
call   1060 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xeba(%rip),%rdi
call   1070 <scanf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x20,%eax
jle    11be <main+0x5e>
mov    $0x1,%edi
call   1080 <exit@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1050 <setbuf@plt>
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
lea    0xebf(%rip),%rdi
call   1060 <printf@plt>
lea    0xec3(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x21,%eax
jge    11b4 <main+0x54>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [71 x i8] c"I check input length now! Your attacks have no effect on me anymore!!!\00"
@.str.1 = [16 x i8] c"Your response? \00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [32 x i8]
%2 = load i32, i32* @stdout
%3 = call i32 @setbuf(i32 %2, i32* null)
%4 = call i32 @puts(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
%10 = icmp sgt i32 %9, 32
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [71 x i8] c"I check input length now! Your attacks have no effect on me anymore!!!\00"
@.str.1 = [16 x i8] c"Your response? \00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [32 x i8]
%2 = load i32, i32* @stdout
%3 = tail call i32 @setbuf(i32 %2, i32* null)
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%8 = call i32 @strlen(i8* %4)
%9 = icmp sgt i32 %8, 32
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %0
ret i32 0
}