#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 */
struct file_state {
  int dummy;
};

/* Variables and functions */
scalar_t__ digitp(int);
int get_char(struct file_state *, char const *);
scalar_t__ letterp(int);
char *next_char(struct file_state *, char const *, int);
const char *after_alnums(struct file_state *file, const char *ptr) {
  int c;
  c = get_char(file, ptr);
  while (letterp(c) || digitp(c)) {
    ptr = next_char(file, ptr, 1);
    c = get_char(file, ptr);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<after_alnums>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <get_char@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <letterp@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x15(%rbp)
jne    118c <after_alnums+0x4c>
mov    -0x14(%rbp),%edi
call   1050 <digitp@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    119c <after_alnums+0x5c>
jmp    11c7 <after_alnums+0x87>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1030 <next_char@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <get_char@plt>
mov    %eax,-0x14(%rbp)
jmp    1160 <after_alnums+0x20>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<after_alnums>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
jmp    1163 <after_alnums+0x23>
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <next_char@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <get_char@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1040 <letterp@plt>
test   %rax,%rax
jne    1150 <after_alnums+0x10>
mov    %ebp,%edi
call   1050 <digitp@plt>
test   %rax,%rax
jne    1150 <after_alnums+0x10>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.file_state = type { i32 }
define i8* @after_alnums(%struct.file_state* %0, i8* %1) {
%3 = alloca %struct.file_state*
%4 = alloca i8*
%5 = alloca i32
store %struct.file_state* %0, %struct.file_state** %3
store i8* %1, i8** %4
%6 = load %struct.file_state*, %struct.file_state** %3
%7 = load i8*, i8** %4
%8 = call i32 @get_char(%struct.file_state* %6, i8* %7)
store i32 %8, i32* %5
br label %9
9: ; preds = %19, %2
%10 = load i32, i32* %5
%11 = call i64 @letterp(i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %9
%14 = load i32, i32* %5
%15 = call i64 @digitp(i32 %14)
%16 = icmp ne i64 %15, 0
br label %17
17: ; preds = %13, %9
%18 = phi i1 [ true, %9 ], [ %16, %13 ]
br i1 %18, label %19, label %26
19: ; preds = %17
%20 = load %struct.file_state*, %struct.file_state** %3
%21 = load i8*, i8** %4
%22 = call i8* @next_char(%struct.file_state* %20, i8* %21, i32 1)
store i8* %22, i8** %4
%23 = load %struct.file_state*, %struct.file_state** %3
%24 = load i8*, i8** %4
%25 = call i32 @get_char(%struct.file_state* %23, i8* %24)
store i32 %25, i32* %5
br label %9
26: ; preds = %17
%27 = load i8*, i8** %4
ret i8* %27
}

LLVM IR (-O2):
%struct.file_state = type { i32 }
define i8* @after_alnums(%struct.file_state* %0, i8* %1) {
br label %3
3: ; preds = %11, %2
%4 = phi i8* [ %12, %11 ], [ %1, %2 ]
%5 = tail call i32 @get_char(%struct.file_state* %0, i8* %4)
%6 = tail call i64 @letterp(i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = tail call i64 @digitp(i32 %5)
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %3, %8
%12 = tail call i8* @next_char(%struct.file_state* %0, i8* %4, i32 1)
br label %3
13: ; preds = %8
ret i8* %4
}