#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*/ errx(int, char *);
int /*<<< orphan*/ warnx(char *);
void skip_name(unsigned char const **const rp, unsigned char const *const end) {
  if (*rp + 2 >= end)
    errx(1, "parsed past end of message??");
  while (**rp) {
    if ((**rp & 0xC0) == 0xC0) {
      *rp += 2;
      return;
    } else {
      if ((**rp >> 6) != 0)
        warnx("non-zero high bits in label length??");
      *rp += 1 + **rp & 0x3F;
    }
  }
  *rp += 1;
}


x86 assembly (clang, -O0):
<skip_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
add    $0x2,%rax
cmp    -0x10(%rbp),%rax
jb     1156 <skip_name+0x36>
mov    $0x1,%edi
lea    0xeaf(%rip),%rsi
call   1030 <errx@plt>
jmp    115b <skip_name+0x3b>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
cmpb   $0x0,(%rax)
je     11df <skip_name+0xbf>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movzbl (%rax),%eax
and    $0xc0,%eax
cmp    $0xc0,%eax
jne    1198 <skip_name+0x78>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x2,%rcx
mov    %rcx,(%rax)
jmp    11ed <skip_name+0xcd>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movzbl (%rax),%eax
sar    $0x6,%eax
cmp    $0x0,%eax
je     11ba <skip_name+0x9a>
lea    0xe68(%rip),%rdi
call   1040 <warnx@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movzbl (%rax),%edx
add    $0x1,%edx
and    $0x3f,%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
jmp    115b <skip_name+0x3b>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_name>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%rax
lea    0x2(%rax),%rcx
cmp    %rsi,%rcx
jb     1147 <skip_name+0x27>
lea    0xec6(%rip),%rsi
mov    $0x1,%edi
call   1030 <errx@plt>
mov    (%rbx),%rax
mov    (%rax),%cl
test   %cl,%cl
je     1195 <skip_name+0x75>
lea    0xec9(%rip),%r14
jmp    117b <skip_name+0x5b>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%cl
movzbl %cl,%ecx
and    $0x3f,%ecx
lea    (%rax,%rcx,1),%rdx
mov    %rdx,(%rbx)
movzbl (%rax,%rcx,1),%ecx
mov    %rdx,%rax
test   %cl,%cl
je     1198 <skip_name+0x78>
cmp    $0xc0,%cl
jae    119e <skip_name+0x7e>
cmp    $0x40,%cl
jb     1160 <skip_name+0x40>
mov    %r14,%rdi
call   1040 <warnx@plt>
mov    (%rbx),%rax
movzbl (%rax),%ecx
jmp    1160 <skip_name+0x40>
mov    %rax,%rdx
add    $0x1,%rdx
jmp    11a5 <skip_name+0x85>
add    $0x2,%rax
mov    %rax,%rdx
mov    %rdx,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [29 x i8] c"parsed past end of message??\00"
@.str.1 = [37 x i8] c"non-zero high bits in label length??\00"
define void @skip_name(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
store i8** %0, i8*** %3
store i8* %1, i8** %4
%5 = load i8**, i8*** %3
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8, i8* %6, i64 2
%8 = load i8*, i8** %4
%9 = icmp uge i8* %7, %8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @errx(i32 1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
br label %13
13: ; preds = %49, %12
%14 = load i8**, i8*** %3
%15 = load i8*, i8** %14
%16 = load i8, i8* %15
%17 = icmp ne i8 %16, 0
br i1 %17, label %18, label %50
18: ; preds = %13
%19 = load i8**, i8*** %3
%20 = load i8*, i8** %19
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = and i32 %22, 192
%24 = icmp eq i32 %23, 192
br i1 %24, label %25, label %29
25: ; preds = %18
%26 = load i8**, i8*** %3
%27 = load i8*, i8** %26
%28 = getelementptr inbounds i8, i8* %27, i64 2
store i8* %28, i8** %26
br label %54
29: ; preds = %18
%30 = load i8**, i8*** %3
%31 = load i8*, i8** %30
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = ashr i32 %33, 6
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %29
%37 = call i32 @warnx(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
br label %38
38: ; preds = %36, %29
%39 = load i8**, i8*** %3
%40 = load i8*, i8** %39
%41 = load i8, i8* %40
%42 = zext i8 %41 to i32
%43 = add nsw i32 1, %42
%44 = and i32 %43, 63
%45 = load i8**, i8*** %3
%46 = load i8*, i8** %45
%47 = sext i32 %44 to i64
%48 = getelementptr inbounds i8, i8* %46, i64 %47
store i8* %48, i8** %45
br label %49
49: ; preds = %38
br label %13
50: ; preds = %13
%51 = load i8**, i8*** %3
%52 = load i8*, i8** %51
%53 = getelementptr inbounds i8, i8* %52, i64 1
store i8* %53, i8** %51
br label %54
54: ; preds = %50, %25
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"parsed past end of message??\00"
@.str.1 = [37 x i8] c"non-zero high bits in label length??\00"
define void @skip_name(i8** nocapture %0, i8* readnone %1) {
%3 = load i8*, i8** %0
%4 = getelementptr inbounds i8, i8* %3, i64 2
%5 = icmp ult i8* %4, %1
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @errx(i32 1, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %0
br label %9
9: ; preds = %6, %2
%10 = phi i8* [ %8, %6 ], [ %3, %2 ]
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %34, label %13
13: ; preds = %9, %25
%14 = phi i8 [ %32, %25 ], [ %11, %9 ]
%15 = phi i8* [ %31, %25 ], [ %10, %9 ]
%16 = icmp ugt i8 %14, -65
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = getelementptr inbounds i8, i8* %15, i64 2
br label %37
19: ; preds = %13
%20 = icmp ult i8 %14, 64
br i1 %20, label %25, label %21
21: ; preds = %19
%22 = tail call i32 @warnx(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%23 = load i8*, i8** %0
%24 = load i8, i8* %23
br label %25
25: ; preds = %21, %19
%26 = phi i8 [ %24, %21 ], [ %14, %19 ]
%27 = phi i8* [ %23, %21 ], [ %15, %19 ]
%28 = add i8 %26, 1
%29 = and i8 %28, 63
%30 = zext i8 %29 to i64
%31 = getelementptr inbounds i8, i8* %27, i64 %30
store i8* %31, i8** %0
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 0
br i1 %33, label %34, label %13
34: ; preds = %25, %9
%35 = phi i8* [ %10, %9 ], [ %31, %25 ]
%36 = getelementptr inbounds i8, i8* %35, i64 1
br label %37
37: ; preds = %34, %17
%38 = phi i8* [ %36, %34 ], [ %18, %17 ]
store i8* %38, i8** %0
ret void
}