#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 */
scalar_t__ isalpha(char);
scalar_t__ isdigit(char);
strip_number(char *tok_ptr) {
  if (isalpha(*tok_ptr))
    return 0;
  while (*tok_ptr)
    if (isdigit(*tok_ptr))
      tok_ptr++;
    else
      break;
  *tok_ptr = '\0';
  return 0;
}


x86 assembly (clang, -O0):
<strip_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%rax
je     114e <strip_number+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    119f <strip_number+0x7f>
jmp    1153 <strip_number+0x33>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1191 <strip_number+0x71>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1187 <strip_number+0x67>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    118c <strip_number+0x6c>
jmp    1191 <strip_number+0x71>
jmp    1153 <strip_number+0x33>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strip_number>:
push   %rbx
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1040 <isalpha@plt>
test   %rax,%rax
jne    115c <strip_number+0x3c>
mov    (%rbx),%al
test   %al,%al
je     1159 <strip_number+0x39>
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     1159 <strip_number+0x39>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <strip_number+0x20>
movb   $0x0,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @strip_number(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = call i64 @isalpha(i8 signext %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %26
9: ; preds = %1
br label %10
10: ; preds = %23, %9
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %24
14: ; preds = %10
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = call i64 @isdigit(i8 signext %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %3
br label %23
22: ; preds = %14
br label %24
23: ; preds = %19
br label %10
24: ; preds = %22, %10
%25 = load i8*, i8** %3
store i8 0, i8* %25
store i32 0, i32* %2
br label %26
26: ; preds = %24, %8
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @strip_number(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i64 @isalpha(i8 signext %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %19
5: ; preds = %1
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 0
br i1 %7, label %17, label %8
8: ; preds = %5, %13
%9 = phi i8 [ %15, %13 ], [ %6, %5 ]
%10 = phi i8* [ %14, %13 ], [ %0, %5 ]
%11 = tail call i64 @isdigit(i8 signext %9)
%12 = icmp eq i64 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %8
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %8
17: ; preds = %13, %8, %5
%18 = phi i8* [ %0, %5 ], [ %10, %8 ], [ %14, %13 ]
store i8 0, i8* %18
br label %19
19: ; preds = %1, %17
ret i32 0
}