#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 */
scalar_t__ isspace(char const);
int needs_quoting(const char *string) {
  if (string == NULL)
    return 0;
  if (*string == '\0')
    return 1;
  while (*string) {
    if (*string == '"' || isspace(*string))
      return 1;
    ++string;
  }
  return 0;
}


x86 assembly (clang, -O0):
<needs_quoting>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <needs_quoting+0x23>
movl   $0x0,-0x4(%rbp)
jmp    11ab <needs_quoting+0x9b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    114f <needs_quoting+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    11ab <needs_quoting+0x9b>
jmp    1154 <needs_quoting+0x44>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11a4 <needs_quoting+0x94>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
je     1187 <needs_quoting+0x77>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1193 <needs_quoting+0x83>
movl   $0x1,-0x4(%rbp)
jmp    11ab <needs_quoting+0x9b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1154 <needs_quoting+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<needs_quoting>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
test   %rdi,%rdi
je     1153 <needs_quoting+0x43>
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     114e <needs_quoting+0x3e>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
test   %al,%al
je     1153 <needs_quoting+0x43>
cmp    $0x22,%al
je     114e <needs_quoting+0x3e>
movsbl %al,%edi
call   1030 <isspace@plt>
test   %rax,%rax
jne    114e <needs_quoting+0x3e>
movzbl (%rbx),%eax
jmp    1130 <needs_quoting+0x20>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @needs_quoting(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, %12
%7 = phi i8 [ %14, %12 ], [ %4, %3 ]
%8 = phi i8* [ %13, %12 ], [ %0, %3 ]
switch i8 %7, label %9 [
i8 0, label %16
i8 34, label %15
]
9: ; preds = %6
%10 = tail call i64 @isspace(i8 signext %7)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = load i8, i8* %13
br label %6
15: ; preds = %6, %9
br label %16
16: ; preds = %6, %15, %3, %1
%17 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 1, %15 ], [ 0, %6 ]
ret i32 %17
}