#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__ valid_idchar(char const);
int id3_frame_validid(char const *id) {
  return valid_idchar(id[0]) && valid_idchar(id[1]) && valid_idchar(id[2]) &&
         valid_idchar(id[3]);
}


x86 assembly (clang, -O0):
<id3_frame_validid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <valid_idchar@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     118f <id3_frame_validid+0x7f>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <valid_idchar@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     118f <id3_frame_validid+0x7f>
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%edi
call   1030 <valid_idchar@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
je     118f <id3_frame_validid+0x7f>
mov    -0x8(%rbp),%rax
movsbl 0x3(%rax),%edi
call   1030 <valid_idchar@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<id3_frame_validid>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <valid_idchar@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     1153 <id3_frame_validid+0x43>
movsbl 0x1(%rbx),%edi
call   1030 <valid_idchar@plt>
test   %rax,%rax
je     1153 <id3_frame_validid+0x43>
movsbl 0x2(%rbx),%edi
call   1030 <valid_idchar@plt>
test   %rax,%rax
je     1153 <id3_frame_validid+0x43>
movsbl 0x3(%rbx),%edi
call   1030 <valid_idchar@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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