#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*/ isxdigit(char const);
int is_utf(const char *string) {
  if (!isxdigit(string[0])) {
    return 0;
  }
  if (!isxdigit(string[1])) {
    return 0;
  }
  if (!isxdigit(string[2])) {
    return 0;
  }
  if (!isxdigit(string[3])) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_utf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isxdigit@plt>
cmp    $0x0,%eax
jne    113d <is_utf+0x2d>
movl   $0x0,-0x4(%rbp)
jmp    11aa <is_utf+0x9a>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <isxdigit@plt>
cmp    $0x0,%eax
jne    115f <is_utf+0x4f>
movl   $0x0,-0x4(%rbp)
jmp    11aa <is_utf+0x9a>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%edi
call   1030 <isxdigit@plt>
cmp    $0x0,%eax
jne    1181 <is_utf+0x71>
movl   $0x0,-0x4(%rbp)
jmp    11aa <is_utf+0x9a>
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%edi
call   1030 <isxdigit@plt>
cmp    $0x0,%eax
jne    11a3 <is_utf+0x93>
movl   $0x0,-0x4(%rbp)
jmp    11aa <is_utf+0x9a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @is_utf(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @isxdigit(i8 signext %2)
%4 = icmp eq i32 %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 i32 @isxdigit(i8 signext %7)
%9 = icmp eq i32 %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 i32 @isxdigit(i8 signext %12)
%14 = icmp eq i32 %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 i32 @isxdigit(i8 signext %17)
%19 = icmp ne i32 %18, 0
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %15, %10, %5, %1
%22 = phi i32 [ 0, %1 ], [ 0, %5 ], [ 0, %10 ], [ %20, %15 ]
ret i32 %22
}