#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*/ checkIfNumber(char *);
int /*<<< orphan*/ checkRegister(char *);
int getRegisterNumber(char *);
int checkAllRegistersAreValid(char **regs) {
  while (*regs) {
    if (!checkRegister(*regs) || !checkIfNumber(*regs + 1) ||
        getRegisterNumber(*regs) < 0 || getRegisterNumber(*regs) >= 32) {
      return 0;
    }
    regs++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<checkAllRegistersAreValid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     11bf <checkAllRegistersAreValid+0x8f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <checkRegister@plt>
cmp    $0x0,%eax
je     11a2 <checkAllRegistersAreValid+0x72>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
add    $0x1,%rdi
call   1030 <checkIfNumber@plt>
cmp    $0x0,%eax
je     11a2 <checkAllRegistersAreValid+0x72>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <getRegisterNumber@plt>
cmp    $0x0,%eax
jl     11a2 <checkAllRegistersAreValid+0x72>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <getRegisterNumber@plt>
cmp    $0x20,%eax
jl     11ae <checkAllRegistersAreValid+0x7e>
movl   $0x0,-0x4(%rbp)
jmp    11c6 <checkAllRegistersAreValid+0x96>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    113c <checkAllRegistersAreValid+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkAllRegistersAreValid>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     117f <checkAllRegistersAreValid+0x4f>
xor    %ebp,%ebp
call   1040 <checkRegister@plt>
test   %eax,%eax
je     1184 <checkAllRegistersAreValid+0x54>
mov    (%rbx),%rdi
add    $0x1,%rdi
call   1030 <checkIfNumber@plt>
test   %eax,%eax
je     1184 <checkAllRegistersAreValid+0x54>
mov    (%rbx),%rdi
call   1050 <getRegisterNumber@plt>
test   %eax,%eax
js     1184 <checkAllRegistersAreValid+0x54>
mov    (%rbx),%rdi
call   1050 <getRegisterNumber@plt>
cmp    $0x20,%eax
jge    1184 <checkAllRegistersAreValid+0x54>
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1140 <checkAllRegistersAreValid+0x10>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @checkAllRegistersAreValid(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %26, label %7
4: ; preds = %21
%5 = load i8*, i8** %25
%6 = icmp eq i8* %5, null
br i1 %6, label %26, label %7
7: ; preds = %1, %4
%8 = phi i8* [ %5, %4 ], [ %2, %1 ]
%9 = phi i8** [ %25, %4 ], [ %0, %1 ]
%10 = tail call i32 @checkRegister(i8* %8)
%11 = icmp eq i32 %10, 0
br i1 %11, label %26, label %12
12: ; preds = %7
%13 = load i8*, i8** %9
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = tail call i32 @checkIfNumber(i8* %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %26, label %17
17: ; preds = %12
%18 = load i8*, i8** %9
%19 = tail call i32 @getRegisterNumber(i8* %18)
%20 = icmp slt i32 %19, 0
br i1 %20, label %26, label %21
21: ; preds = %17
%22 = load i8*, i8** %9
%23 = tail call i32 @getRegisterNumber(i8* %22)
%24 = icmp sgt i32 %23, 31
%25 = getelementptr inbounds i8*, i8** %9, i64 1
br i1 %24, label %26, label %4
26: ; preds = %21, %17, %12, %7, %4, %1
%27 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ], [ 0, %12 ], [ 0, %17 ], [ 0, %21 ]
ret i32 %27
}