#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*/ die(int, char *);
void misc_check(char *buffer) {
  int i = 0;
  if (buffer) {
    for (i = 0; buffer[i] != 0; i++) {
      if (i >= 256 - 6)
        die(1, "You cannont pass this string.\n");
    }
  }
}


x86 assembly (clang, -O0):
<misc_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1180 <misc_check+0x70>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     117b <misc_check+0x6b>
cmpl   $0xfa,-0xc(%rbp)
jl     1168 <misc_check+0x58>
mov    $0x1,%edi
lea    0xe9d(%rip),%rsi
call   1030 <die@plt>
jmp    116d <misc_check+0x5d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1135 <misc_check+0x25>
jmp    1180 <misc_check+0x70>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<misc_check>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1154 <misc_check+0x44>
mov    %rdi,%r15
cmpb   $0x0,(%rdi)
je     1154 <misc_check+0x44>
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
jmp    113c <misc_check+0x2c>
nopl   (%rax)
cmpb   $0x0,0x1(%r15,%rbx,1)
lea    0x1(%rbx),%rbx
je     1154 <misc_check+0x44>
cmp    $0xfa,%rbx
jb     1130 <misc_check+0x20>
mov    $0x1,%edi
mov    %r14,%rsi
call   1030 <die@plt>
jmp    1130 <misc_check+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [31 x i8] c"You cannont pass this string.\0A\00"
define void @misc_check(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %25
6: ; preds = %1
store i32 0, i32* %3
br label %7
7: ; preds = %21, %6
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %24
15: ; preds = %7
%16 = load i32, i32* %3
%17 = icmp sge i32 %16, 250
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @die(i32 1, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %15
br label %21
21: ; preds = %20
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %7
24: ; preds = %7
br label %25
25: ; preds = %24, %1
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"You cannont pass this string.\0A\00"
define void @misc_check(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %16, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %3, %11
%7 = phi i64 [ %12, %11 ], [ 0, %3 ]
%8 = icmp ugt i64 %7, 249
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @die(i32 1, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %6, %9
%12 = add nuw i64 %7, 1
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %6
16: ; preds = %11, %3, %1
ret void
}