#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*/ isgraph(char);
int nisgraph(char *s, int n) {
  for (; *s && n; s++, n--)
    if (!isgraph(*s))
      return (0);
  return (1);
}


x86 assembly (clang, -O0):
<nisgraph>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x15(%rbp)
je     113e <nisgraph+0x2e>
cmpl   $0x0,-0x14(%rbp)
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    114e <nisgraph+0x3e>
jmp    118e <nisgraph+0x7e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isgraph@plt>
cmp    $0x0,%eax
jne    116f <nisgraph+0x5f>
movl   $0x0,-0x4(%rbp)
jmp    1195 <nisgraph+0x85>
jmp    1174 <nisgraph+0x64>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    111f <nisgraph+0xf>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nisgraph>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%r14d
test   %al,%al
je     1165 <nisgraph+0x55>
test   %esi,%esi
je     1165 <nisgraph+0x55>
mov    %rdi,%rbx
mov    %esi,%r15d
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%edi
call   1030 <isgraph@plt>
test   %eax,%eax
je     1162 <nisgraph+0x52>
movzbl (%rbx,%rbp,1),%eax
test   %al,%al
je     1165 <nisgraph+0x55>
lea    0x1(%rbp),%rcx
cmp    %ebp,%r15d
mov    %rcx,%rbp
jne    1140 <nisgraph+0x30>
jmp    1165 <nisgraph+0x55>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @nisgraph(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
br label %6
6: ; preds = %23, %2
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 0
br label %14
14: ; preds = %11, %6
%15 = phi i1 [ false, %6 ], [ %13, %11 ]
br i1 %15, label %16, label %28
16: ; preds = %14
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = call i32 @isgraph(i8 signext %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %16
store i32 0, i32* %3
br label %29
22: ; preds = %16
br label %23
23: ; preds = %22
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %4
%26 = load i32, i32* %5
%27 = add nsw i32 %26, -1
store i32 %27, i32* %5
br label %6
28: ; preds = %14
store i32 1, i32* %3
br label %29
29: ; preds = %28, %21
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
define i32 @nisgraph(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp ne i8 %3, 0
%5 = icmp ne i32 %1, 0
%6 = and i1 %4, %5
br i1 %6, label %7, label %20
7: ; preds = %2, %13
%8 = phi i8 [ %16, %13 ], [ %3, %2 ]
%9 = phi i32 [ %15, %13 ], [ %1, %2 ]
%10 = phi i8* [ %14, %13 ], [ %0, %2 ]
%11 = tail call i32 @isgraph(i8 signext %8)
%12 = icmp eq i32 %11, 0
br i1 %12, label %20, label %13
13: ; preds = %7
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = add nsw i32 %9, -1
%16 = load i8, i8* %14
%17 = icmp ne i8 %16, 0
%18 = icmp ne i32 %15, 0
%19 = select i1 %17, i1 %18, i1 false
br i1 %19, label %7, label %20
20: ; preds = %7, %13, %2
%21 = phi i32 [ 1, %2 ], [ 1, %13 ], [ 0, %7 ]
ret i32 %21
}