#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*/ isalnum(int);
int string_need_quotes(const char *str) {
  while (*str != '\0') {
    if (!isalnum((int)((unsigned char)*str)) && *str != '!' && *str != '.' &&
        *str != '/') {
      return 1;
    }
    str++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<string_need_quotes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     118e <string_need_quotes+0x7e>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%eax
jne    117d <string_need_quotes+0x6d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x21,%eax
je     117d <string_need_quotes+0x6d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     117d <string_need_quotes+0x6d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     117d <string_need_quotes+0x6d>
movl   $0x1,-0x4(%rbp)
jmp    1195 <string_need_quotes+0x85>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <string_need_quotes+0xc>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_need_quotes>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%bpl
test   %bpl,%bpl
je     116f <string_need_quotes+0x5f>
mov    %rdi,%rbx
add    $0x1,%rbx
movabs $0xc00200000000,%r15
jmp    114c <string_need_quotes+0x3c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rbx),%ebp
add    $0x1,%rbx
test   %bpl,%bpl
je     116f <string_need_quotes+0x5f>
movzbl %bpl,%r14d
mov    %r14d,%edi
call   1030 <isalnum@plt>
test   %eax,%eax
jne    1140 <string_need_quotes+0x30>
mov    $0x1,%eax
cmp    $0x2f,%bpl
ja     1171 <string_need_quotes+0x61>
bt     %r14,%r15
jb     1140 <string_need_quotes+0x30>
jmp    1171 <string_need_quotes+0x61>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @string_need_quotes(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %31, %1
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %34
9: ; preds = %4
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = call i32 @isalnum(i32 %12)
%14 = icmp ne i32 %13, 0
br i1 %14, label %31, label %15
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 33
br i1 %19, label %20, label %31
20: ; preds = %15
%21 = load i8*, i8** %3
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 46
br i1 %24, label %25, label %31
25: ; preds = %20
%26 = load i8*, i8** %3
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 47
br i1 %29, label %30, label %31
30: ; preds = %25
store i32 1, i32* %2
br label %35
31: ; preds = %25, %20, %15, %9
%32 = load i8*, i8** %3
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %3
br label %4
34: ; preds = %4
store i32 0, i32* %2
br label %35
35: ; preds = %34, %30
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
define i32 @string_need_quotes(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %12
%5 = phi i8 [ %14, %12 ], [ %2, %1 ]
%6 = phi i8* [ %13, %12 ], [ %0, %1 ]
%7 = zext i8 %5 to i32
%8 = tail call i32 @isalnum(i32 %7)
%9 = freeze i32 %8
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %4
switch i8 %5, label %16 [
i8 47, label %12
i8 46, label %12
i8 33, label %12
]
12: ; preds = %11, %11, %11, %4
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %12, %11, %1
%17 = phi i32 [ 0, %1 ], [ 1, %11 ], [ 0, %12 ]
ret i32 %17
}