#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 */
size_t strnlen(char const *const, int);
char get_next_char(const char c, const char *const restrict choice_set) {
  const size_t len_n = strnlen(choice_set, 98);
  for (unsigned int i = 0; i < len_n; i++)
    if (c == choice_set[i])
      return choice_set[i + 1];
  return '\0';
}


x86 assembly (clang, -O0):
<get_next_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x62,%esi
call   1030 <strnlen@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%rax
jae    1189 <get_next_char+0x79>
movsbl -0x2(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    -0x1c(%rbp),%edx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    1176 <get_next_char+0x66>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,1),%al
mov    %al,-0x1(%rbp)
jmp    118d <get_next_char+0x7d>
jmp    117b <get_next_char+0x6b>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113b <get_next_char+0x2b>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_next_char>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
mov    $0x62,%esi
call   1030 <strnlen@plt>
test   %rax,%rax
je     1141 <get_next_char+0x31>
xor    %ecx,%ecx
nopl   0x0(%rax)
mov    %rcx,%rdx
add    $0x1,%ecx
cmp    %bpl,(%rbx,%rdx,1)
je     1145 <get_next_char+0x35>
cmp    %rcx,%rax
ja     1130 <get_next_char+0x20>
xor    %eax,%eax
jmp    1148 <get_next_char+0x38>
mov    (%rbx,%rcx,1),%al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define signext i8 @get_next_char(i8 signext %0, i8* noalias %1) {
%3 = tail call i64 @strnlen(i8* %1, i32 98)
%4 = icmp eq i64 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2, %15
%6 = phi i64 [ %11, %15 ], [ 0, %2 ]
%7 = getelementptr inbounds i8, i8* %1, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, %0
%10 = add nuw nsw i64 %6, 1
%11 = and i64 %10, 4294967295
br i1 %9, label %12, label %15
12: ; preds = %5
%13 = getelementptr inbounds i8, i8* %1, i64 %11
%14 = load i8, i8* %13
br label %17
15: ; preds = %5
%16 = icmp ugt i64 %3, %11
br i1 %16, label %5, label %17
17: ; preds = %15, %2, %12
%18 = phi i8 [ %14, %12 ], [ 0, %2 ], [ 0, %15 ]
ret i8 %18
}