#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 */
typedef int /*<<< orphan*/ regex_t;

/* Variables and functions */
int REG_EXTENDED;
int REG_ICASE;
int REG_NOSUB;
scalar_t__ regcomp(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ regexec(int /*<<< orphan*/ *, char const *,
                           int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/);
int validator_network_old(const char *network) {
  regex_t regex;
  char msgbuf[100];
  if (regcomp(&regex, "^(3[0-2]|[1-2]?[0-9])",
              REG_ICASE | REG_EXTENDED | REG_NOSUB)) {
    return 0;
  }
  return !regexec(&regex, network, 0, NULL, 0);
}


x86 assembly (clang, -O0):
<validator_network_old>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edx
mov    0x2e91(%rip),%rax
or     (%rax),%edx
mov    0x2e90(%rip),%rax
or     (%rax),%edx
lea    -0x14(%rbp),%rdi
lea    0xeab(%rip),%rsi
call   1030 <regcomp@plt>
cmp    $0x0,%rax
je     1170 <validator_network_old+0x50>
movl   $0x0,-0x4(%rbp)
jmp    1197 <validator_network_old+0x77>
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdi
xor    %r8d,%r8d
xor    %eax,%eax
mov    %eax,%ecx
mov    %r8d,%edx
call   1040 <regexec@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validator_network_old>:
push   %rbx
sub    $0x10,%rsp
mov    0x2ebc(%rip),%rax
mov    0x2e9d(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
mov    %rdi,%rbx
mov    0x2e97(%rip),%rax
or     (%rax),%edx
lea    0xeb6(%rip),%rsi
lea    0xc(%rsp),%rdi
call   1030 <regcomp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    117b <validator_network_old+0x5b>
lea    0xc(%rsp),%rdi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1040 <regexec@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"^(3[0-2]|[1-2]?[0-9])\00"
@REG_ICASE = global i32 0
@REG_EXTENDED = global i32 0
@REG_NOSUB = global i32 0
define i32 @validator_network_old(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [100 x i8]
store i8* %0, i8** %3
%6 = load i32, i32* @REG_ICASE
%7 = load i32, i32* @REG_EXTENDED
%8 = or i32 %6, %7
%9 = load i32, i32* @REG_NOSUB
%10 = or i32 %8, %9
%11 = call i64 @regcomp(i32* %4, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %1
store i32 0, i32* %2
br label %20
14: ; preds = %1
%15 = load i8*, i8** %3
%16 = call i32 @regexec(i32* %4, i8* %15, i32 0, i32* null, i32 0)
%17 = icmp ne i32 %16, 0
%18 = xor i1 %17, true
%19 = zext i1 %18 to i32
store i32 %19, i32* %2
br label %20
20: ; preds = %14, %13
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
@.str = [22 x i8] c"^(3[0-2]|[1-2]?[0-9])\00"
@REG_ICASE = global i32 0
@REG_EXTENDED = global i32 0
@REG_NOSUB = global i32 0
define i32 @validator_network_old(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @REG_ICASE
%5 = load i32, i32* @REG_EXTENDED
%6 = or i32 %5, %4
%7 = load i32, i32* @REG_NOSUB
%8 = or i32 %6, %7
%9 = call i64 @regcomp(i32* %2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %1
%12 = call i32 @regexec(i32* %2, i8* %0, i32 0, i32* null, i32 0)
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %1, %11
%16 = phi i32 [ %14, %11 ], [ 0, %1 ]
ret i32 %16
}