#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 */
typedef char uint8_t;
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
scalar_t__ isprint(char);
bool ParseAbbreviated(int32_t length, const uint8_t *data, int32_t *parsed) {
  assert(length > 0);
  assert(data != NULL);
  assert(parsed != NULL);
  *parsed = 0;
  bool sync;
  uint8_t ch = data[length - 1];
  if (length == 1) {
    sync = (data[0] == '<');
  } else if (ch == '\n' || ch == '\r') {
    sync = true;
    *parsed = length - 1;
  } else {
    sync = (length < 128 && isprint(ch));
  }
  return sync;
}


x86 assembly (clang, -O0):
<ParseAbbreviated>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x1d(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    11a9 <ParseAbbreviated+0x89>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3c,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
jmp    1210 <ParseAbbreviated+0xf0>
movsbl -0x1d(%rbp),%eax
cmp    $0xa,%eax
je     11c3 <ParseAbbreviated+0xa3>
movsbl -0x1d(%rbp),%eax
cmp    $0xd,%eax
jne    11db <ParseAbbreviated+0xbb>
movl   $0x1,-0x1c(%rbp)
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    120b <ParseAbbreviated+0xeb>
xor    %eax,%eax
cmpl   $0x80,-0x4(%rbp)
mov    %al,-0x1e(%rbp)
jge    1200 <ParseAbbreviated+0xe0>
movsbl -0x1d(%rbp),%edi
call   1040 <isprint@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1e(%rbp)
mov    -0x1e(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
jmp    1210 <ParseAbbreviated+0xf0>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ParseAbbreviated>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %edi,%edi
test   %ebp,%ebp
setg   %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1030 <assert@plt>
movl   $0x0,(%r14)
cmp    $0x1,%ebp
jne    1169 <ParseAbbreviated+0x49>
cmpb   $0x3c,(%rbx)
sete   %al
jmp    119a <ParseAbbreviated+0x7a>
movslq %ebp,%rcx
mov    -0x1(%rbx,%rcx,1),%al
cmp    $0xd,%al
je     1178 <ParseAbbreviated+0x58>
cmp    $0xa,%al
jne    1183 <ParseAbbreviated+0x63>
add    $0xffffffffffffffff,%rcx
mov    %ecx,(%r14)
mov    $0x1,%al
jmp    119a <ParseAbbreviated+0x7a>
cmp    $0x7f,%ebp
jg     1198 <ParseAbbreviated+0x78>
movsbl %al,%edi
call   1040 <isprint@plt>
test   %rax,%rax
setne  %al
jmp    119a <ParseAbbreviated+0x7a>
xor    %eax,%eax
movzbl %al,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ParseAbbreviated(i32 %0, i8* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i8*, i8** %5
%14 = icmp ne i8* %13, null
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i32*, i32** %6
%18 = icmp ne i32* %17, null
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load i32*, i32** %6
store i32 0, i32* %21
%22 = load i8*, i8** %5
%23 = load i32, i32* %4
%24 = sub nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %22, i64 %25
%27 = load i8, i8* %26
store i8 %27, i8* %8
%28 = load i32, i32* %4
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %37
30: ; preds = %3
%31 = load i8*, i8** %5
%32 = getelementptr inbounds i8, i8* %31, i64 0
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 60
%36 = zext i1 %35 to i32
store i32 %36, i32* %7
br label %60
37: ; preds = %3
%38 = load i8, i8* %8
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 10
br i1 %40, label %45, label %41
41: ; preds = %37
%42 = load i8, i8* %8
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 13
br i1 %44, label %45, label %49
45: ; preds = %41, %37
store i32 1, i32* %7
%46 = load i32, i32* %4
%47 = sub nsw i32 %46, 1
%48 = load i32*, i32** %6
store i32 %47, i32* %48
br label %59
49: ; preds = %41
%50 = load i32, i32* %4
%51 = icmp slt i32 %50, 128
br i1 %51, label %52, label %56
52: ; preds = %49
%53 = load i8, i8* %8
%54 = call i64 @isprint(i8 signext %53)
%55 = icmp ne i64 %54, 0
br label %56
56: ; preds = %52, %49
%57 = phi i1 [ false, %49 ], [ %55, %52 ]
%58 = zext i1 %57 to i32
store i32 %58, i32* %7
br label %59
59: ; preds = %56, %45
br label %60
60: ; preds = %59, %30
%61 = load i32, i32* %7
ret i32 %61
}

LLVM IR (-O2):
define i32 @ParseAbbreviated(i32 %0, i8* %1, i32* writeonly %2) {
%4 = icmp sgt i32 %0, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = icmp ne i8* %1, null
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = icmp ne i32* %2, null
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
store i32 0, i32* %2
%13 = add nsw i32 %0, -1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %1, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i32 %0, 1
br i1 %17, label %18, label %21
18: ; preds = %3
%19 = load i8, i8* %1
%20 = icmp eq i8 %19, 60
br label %28
21: ; preds = %3
switch i8 %16, label %23 [
i8 13, label %22
i8 10, label %22
]
22: ; preds = %21, %21
store i32 %13, i32* %2
br label %28
23: ; preds = %21
%24 = icmp slt i32 %0, 128
br i1 %24, label %25, label %28
25: ; preds = %23
%26 = tail call i64 @isprint(i8 signext %16)
%27 = icmp ne i64 %26, 0
br label %28
28: ; preds = %23, %25, %22, %18
%29 = phi i1 [ %20, %18 ], [ true, %22 ], [ false, %23 ], [ %27, %25 ]
%30 = zext i1 %29 to i32
ret i32 %30
}