#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*/ memcpy(char *, char const *, int const);
int ifconfigCheckCopyInput(char *out, const int out_len, const char *in,
                           const int in_len) {
  int i;
  char c;
  if (!(in_len < out_len))
    return 0;
  i = 0;
  while (i < in_len) {
    c = in[i];
    if (!(c >= 32 && c < 127))
      return 0;
    switch (c) {
    case ';':
    case '\'':
    case '\"':
    case '?':
    case '!':
    case '`':
      return 0;
    }
    i++;
  }
  memcpy(out, in, in_len);
  out[in_len] = '\0';
  return 1;
}


x86 assembly (clang, -O0):
<ifconfigCheckCopyInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     113e <ifconfigCheckCopyInput+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    121e <ifconfigCheckCopyInput+0x10e>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11fb <ifconfigCheckCopyInput+0xeb>
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x29(%rbp)
movsbl -0x29(%rbp),%eax
cmp    $0x20,%eax
jl     1179 <ifconfigCheckCopyInput+0x69>
movsbl -0x29(%rbp),%eax
cmp    $0x7f,%eax
jl     1185 <ifconfigCheckCopyInput+0x75>
movl   $0x0,-0x4(%rbp)
jmp    121e <ifconfigCheckCopyInput+0x10e>
movsbl -0x29(%rbp),%eax
mov    %eax,-0x30(%rbp)
add    $0xffffffdf,%eax
sub    $0x2,%eax
jb     11e1 <ifconfigCheckCopyInput+0xd1>
jmp    119d <ifconfigCheckCopyInput+0x8d>
mov    -0x30(%rbp),%eax
sub    $0x27,%eax
je     11e1 <ifconfigCheckCopyInput+0xd1>
jmp    11ae <ifconfigCheckCopyInput+0x9e>
mov    -0x30(%rbp),%eax
sub    $0x3b,%eax
je     11e1 <ifconfigCheckCopyInput+0xd1>
jmp    11bf <ifconfigCheckCopyInput+0xaf>
mov    -0x30(%rbp),%eax
sub    $0x3f,%eax
je     11e1 <ifconfigCheckCopyInput+0xd1>
jmp    11d0 <ifconfigCheckCopyInput+0xc0>
mov    -0x30(%rbp),%eax
sub    $0x60,%eax
jne    11ed <ifconfigCheckCopyInput+0xdd>
jmp    11e1 <ifconfigCheckCopyInput+0xd1>
movl   $0x0,-0x4(%rbp)
jmp    121e <ifconfigCheckCopyInput+0x10e>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1145 <ifconfigCheckCopyInput+0x35>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ifconfigCheckCopyInput>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
cmp    %esi,%ecx
jge    1185 <ifconfigCheckCopyInput+0x75>
mov    %ecx,%ebx
mov    %rdi,%r14
test   %ecx,%ecx
jle    116b <ifconfigCheckCopyInput+0x5b>
mov    %ebx,%r9d
xor    %eax,%eax
movabs $0x8000000044000043,%r8
xor    %edi,%edi
jmp    1149 <ifconfigCheckCopyInput+0x39>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rdi
cmp    %rdi,%r9
je     116b <ifconfigCheckCopyInput+0x5b>
movzbl (%rdx,%rdi,1),%esi
lea    -0x20(%rsi),%ecx
cmp    $0x5e,%cl
ja     1185 <ifconfigCheckCopyInput+0x75>
add    $0xdf,%sil
cmp    $0x3f,%sil
ja     1140 <ifconfigCheckCopyInput+0x30>
movzbl %sil,%ecx
bt     %rcx,%r8
jae    1140 <ifconfigCheckCopyInput+0x30>
jmp    1185 <ifconfigCheckCopyInput+0x75>
mov    %r14,%rdi
mov    %rdx,%rsi
mov    %ebx,%edx
call   1030 <memcpy@plt>
movslq %ebx,%rax
movb   $0x0,(%r14,%rax,1)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @ifconfigCheckCopyInput(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%12 = load i32, i32* %9
%13 = load i32, i32* %7
%14 = icmp slt i32 %12, %13
br i1 %14, label %16, label %15
15: ; preds = %4
store i32 0, i32* %5
br label %51
16: ; preds = %4
store i32 0, i32* %10
br label %17
17: ; preds = %39, %16
%18 = load i32, i32* %10
%19 = load i32, i32* %9
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %42
21: ; preds = %17
%22 = load i8*, i8** %8
%23 = load i32, i32* %10
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
store i8 %26, i8* %11
%27 = load i8, i8* %11
%28 = sext i8 %27 to i32
%29 = icmp sge i32 %28, 32
br i1 %29, label %30, label %34
30: ; preds = %21
%31 = load i8, i8* %11
%32 = sext i8 %31 to i32
%33 = icmp slt i32 %32, 127
br i1 %33, label %35, label %34
34: ; preds = %30, %21
store i32 0, i32* %5
br label %51
35: ; preds = %30
%36 = load i8, i8* %11
%37 = sext i8 %36 to i32
switch i32 %37, label %39 [
i32 59, label %38
i32 39, label %38
i32 34, label %38
i32 63, label %38
i32 33, label %38
i32 96, label %38
]
38: ; preds = %35, %35, %35, %35, %35, %35
store i32 0, i32* %5
br label %51
39: ; preds = %35
%40 = load i32, i32* %10
%41 = add nsw i32 %40, 1
store i32 %41, i32* %10
br label %17
42: ; preds = %17
%43 = load i8*, i8** %6
%44 = load i8*, i8** %8
%45 = load i32, i32* %9
%46 = call i32 @memcpy(i8* %43, i8* %44, i32 %45)
%47 = load i8*, i8** %6
%48 = load i32, i32* %9
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %47, i64 %49
store i8 0, i8* %50
store i32 1, i32* %5
br label %51
51: ; preds = %42, %38, %34, %15
%52 = load i32, i32* %5
ret i32 %52
}

LLVM IR (-O2):
define i32 @ifconfigCheckCopyInput(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = icmp slt i32 %3, %1
br i1 %5, label %6, label %24
6: ; preds = %4
%7 = icmp sgt i32 %3, 0
br i1 %7, label %8, label %20
8: ; preds = %6
%9 = zext i32 %3 to i64
br label %10
10: ; preds = %8, %17
%11 = phi i64 [ 0, %8 ], [ %18, %17 ]
%12 = getelementptr inbounds i8, i8* %2, i64 %11
%13 = load i8, i8* %12
%14 = add i8 %13, -32
%15 = icmp ult i8 %14, 95
br i1 %15, label %16, label %24
16: ; preds = %10
switch i8 %13, label %17 [
i8 59, label %24
i8 39, label %24
i8 34, label %24
i8 63, label %24
i8 33, label %24
i8 96, label %24
]
17: ; preds = %16
%18 = add nuw nsw i64 %11, 1
%19 = icmp eq i64 %18, %9
br i1 %19, label %20, label %10
20: ; preds = %17, %6
%21 = tail call i32 @memcpy(i8* %0, i8* %2, i32 %3)
%22 = sext i32 %3 to i64
%23 = getelementptr inbounds i8, i8* %0, i64 %22
store i8 0, i8* %23
br label %24
24: ; preds = %16, %16, %16, %16, %16, %16, %10, %4, %20
%25 = phi i32 [ 1, %20 ], [ 0, %4 ], [ 0, %10 ], [ 0, %16 ], [ 0, %16 ], [ 0, %16 ], [ 0, %16 ], [ 0, %16 ], [ 0, %16 ]
ret i32 %25
}