#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*/ error(int, int /*<<< orphan*/, char *, ...);
int sanitized_char(char const);
void do_verify_udp(const char *data, int len) {
  char cur = data[0];
  int i;
  if (cur < 'a' || cur > 'z')
    error(1, 0, "data initial byte out of range");
  for (i = 1; i < len; i++) {
    if (cur == 'z')
      cur = 'a';
    else
      cur++;
    if (data[i] != cur)
      error(1, 0, "data[%d]: len %d, %c(%hhu) != %c(%hhu)\n", i, len,
            sanitized_char(data[i]), data[i], sanitized_char(cur), cur);
  }
}


x86 assembly (clang, -O0):
<do_verify_udp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
cmp    $0x61,%eax
jl     1152 <do_verify_udp+0x32>
movsbl -0xd(%rbp),%eax
cmp    $0x7a,%eax
jle    1167 <do_verify_udp+0x47>
mov    $0x1,%edi
xor    %esi,%esi
lea    0xea0(%rip),%rdx
mov    $0x0,%al
call   1040 <error@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1233 <do_verify_udp+0x113>
movsbl -0xd(%rbp),%eax
cmp    $0x7a,%eax
jne    1190 <do_verify_udp+0x70>
movb   $0x61,-0xd(%rbp)
jmp    1198 <do_verify_udp+0x78>
mov    -0xd(%rbp),%al
add    $0x1,%al
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0xd(%rbp),%ecx
cmp    %ecx,%eax
je     1220 <do_verify_udp+0x100>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <sanitized_char@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x18(%rbp)
movsbl -0xd(%rbp),%edi
call   1030 <sanitized_char@plt>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    -0x18(%rbp),%r11d
mov    %eax,%r10d
movsbl -0xd(%rbp),%eax
mov    $0x1,%edi
xor    %esi,%esi
lea    0xe13(%rip),%rdx
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
mov    $0x0,%al
call   1040 <error@plt>
jmp    1225 <do_verify_udp+0x105>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116e <do_verify_udp+0x4e>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_verify_udp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    (%rdi),%r12b
lea    -0x7b(%r12),%eax
cmp    $0xe5,%al
ja     1151 <do_verify_udp+0x31>
lea    0xebd(%rip),%rdx
mov    $0x1,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <error@plt>
cmp    $0x2,%ebx
jl     11e7 <do_verify_udp+0xc7>
mov    %ebx,%eax
mov    %rax,(%rsp)
mov    $0x1,%ebx
mov    $0x61,%ecx
jmp    117a <do_verify_udp+0x5a>
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    %rbx,(%rsp)
je     11e7 <do_verify_udp+0xc7>
lea    0x1(%r12),%eax
cmp    $0x7a,%r12b
movzbl %al,%r12d
cmove  %ecx,%r12d
movzbl (%r14,%rbx,1),%eax
cmp    %r12b,%al
je     1170 <do_verify_udp+0x50>
movsbl %r12b,%r13d
movsbl %al,%edi
call   1030 <sanitized_char@plt>
mov    %eax,%ebp
movsbl (%r14,%rbx,1),%r15d
mov    %r13d,%edi
call   1030 <sanitized_char@plt>
mov    %eax,%r10d
sub    $0x8,%rsp
mov    $0x1,%edi
xor    %esi,%esi
lea    0xe5a(%rip),%rdx
mov    %ebx,%ecx
mov    0x8(%rsp),%r8
mov    %ebp,%r9d
xor    %eax,%eax
push   %r13
push   %r10
push   %r15
call   1040 <error@plt>
mov    $0x61,%ecx
add    $0x20,%rsp
jmp    1170 <do_verify_udp+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"data initial byte out of range\00"
@.str.1 = [40 x i8] c"data[%d]: len %d, %c(%hhu) != %c(%hhu)\0A\00"
define void @do_verify_udp(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
store i8 %9, i8* %5
%10 = load i8, i8* %5
%11 = sext i8 %10 to i32
%12 = icmp slt i32 %11, 97
br i1 %12, label %17, label %13
13: ; preds = %2
%14 = load i8, i8* %5
%15 = sext i8 %14 to i32
%16 = icmp sgt i32 %15, 122
br i1 %16, label %17, label %19
17: ; preds = %13, %2
%18 = call i32 (i32, i32, i8*, ...) @error(i32 1, i32 0, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %19
19: ; preds = %17, %13
store i32 1, i32* %6
br label %20
20: ; preds = %63, %19
%21 = load i32, i32* %6
%22 = load i32, i32* %4
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %66
24: ; preds = %20
%25 = load i8, i8* %5
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 122
br i1 %27, label %28, label %29
28: ; preds = %24
store i8 97, i8* %5
br label %32
29: ; preds = %24
%30 = load i8, i8* %5
%31 = add i8 %30, 1
store i8 %31, i8* %5
br label %32
32: ; preds = %29, %28
%33 = load i8*, i8** %3
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %33, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = load i8, i8* %5
%40 = sext i8 %39 to i32
%41 = icmp ne i32 %38, %40
br i1 %41, label %42, label %62
42: ; preds = %32
%43 = load i32, i32* %6
%44 = load i32, i32* %4
%45 = load i8*, i8** %3
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %45, i64 %47
%49 = load i8, i8* %48
%50 = call i32 @sanitized_char(i8 signext %49)
%51 = load i8*, i8** %3
%52 = load i32, i32* %6
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %51, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = load i8, i8* %5
%58 = call i32 @sanitized_char(i8 signext %57)
%59 = load i8, i8* %5
%60 = sext i8 %59 to i32
%61 = call i32 (i32, i32, i8*, ...) @error(i32 1, i32 0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %43, i32 %44, i32 %50, i32 %56, i32 %58, i32 %60)
br label %62
62: ; preds = %42, %32
br label %63
63: ; preds = %62
%64 = load i32, i32* %6
%65 = add nsw i32 %64, 1
store i32 %65, i32* %6
br label %20
66: ; preds = %20
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"data initial byte out of range\00"
@.str.1 = [40 x i8] c"data[%d]: len %d, %c(%hhu) != %c(%hhu)\0A\00"
define void @do_verify_udp(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = add i8 %3, -123
%5 = icmp ult i8 %4, -26
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (i32, i32, i8*, ...) @error(i32 1, i32 0, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %6
%9 = icmp sgt i32 %1, 1
br i1 %9, label %10, label %32
10: ; preds = %8
%11 = zext i32 %1 to i64
br label %12
12: ; preds = %10, %29
%13 = phi i64 [ 1, %10 ], [ %30, %29 ]
%14 = phi i8 [ %3, %10 ], [ %17, %29 ]
%15 = icmp eq i8 %14, 122
%16 = add i8 %14, 1
%17 = select i1 %15, i8 97, i8 %16
%18 = getelementptr inbounds i8, i8* %0, i64 %13
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, %17
br i1 %20, label %29, label %21
21: ; preds = %12
%22 = sext i8 %17 to i32
%23 = tail call i32 @sanitized_char(i8 signext %19)
%24 = load i8, i8* %18
%25 = sext i8 %24 to i32
%26 = tail call i32 @sanitized_char(i8 signext %17)
%27 = trunc i64 %13 to i32
%28 = tail call i32 (i32, i32, i8*, ...) @error(i32 1, i32 0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %27, i32 %1, i32 %23, i32 %25, i32 %26, i32 %22)
br label %29
29: ; preds = %12, %21
%30 = add nuw nsw i64 %13, 1
%31 = icmp eq i64 %30, %11
br i1 %31, label %32, label %12
32: ; preds = %29, %8
ret void
}