#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*/ assert(int);
int /*<<< orphan*/ printf(char *, ...);
int semver_is_valid(char *);
void test_valid_chars() {
  printf("\n# Test: %s\n", "valid_chars");
  int error;
  error = semver_is_valid("1");
  assert(error == 1);
  error = semver_is_valid("159");
  assert(error == 1);
  error = semver_is_valid("1b3");
  assert(error == 1);
  error = semver_is_valid("3 0 1");
  assert(error == 0);
  error = semver_is_valid("&3@(");
  assert(error == 0);
  printf("OK\n");
}


x86 assembly (clang, -O0):
<test_valid_chars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec7(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
call   1030 <semver_is_valid@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xea5(%rip),%rdi
call   1030 <semver_is_valid@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe89(%rip),%rdi
call   1030 <semver_is_valid@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe6d(%rip),%rdi
call   1030 <semver_is_valid@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe53(%rip),%rdi
call   1030 <semver_is_valid@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_valid_chars>:
push   %rax
lea    0xeb8(%rip),%rdi
lea    0xebe(%rip),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec8(%rip),%rdi
call   1030 <semver_is_valid@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1060 <assert@plt>
lea    0xea2(%rip),%rdi
call   1030 <semver_is_valid@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1060 <assert@plt>
lea    0xe8c(%rip),%rdi
call   1030 <semver_is_valid@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1060 <assert@plt>
lea    0xe76(%rip),%rdi
call   1030 <semver_is_valid@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
lea    0xe63(%rip),%rdi
call   1030 <semver_is_valid@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
lea    0xe4f(%rip),%rdi
pop    %rax
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"\0A# Test: %s\0A\00"
@.str.1 = [12 x i8] c"valid_chars\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [4 x i8] c"159\00"
@.str.4 = [4 x i8] c"1b3\00"
@.str.5 = [6 x i8] c"3 0 1\00"
@.str.6 = [5 x i8] c"&3@(\00"
@.str.7 = [4 x i8] c"OK\0A\00"
define void @test_valid_chars() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @semver_is_valid(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 1
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = call i32 @semver_is_valid(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
store i32 %8, i32* %1
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 1
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i32 @semver_is_valid(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store i32 %13, i32* %1
%14 = load i32, i32* %1
%15 = icmp eq i32 %14, 1
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = call i32 @semver_is_valid(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
store i32 %18, i32* %1
%19 = load i32, i32* %1
%20 = icmp eq i32 %19, 0
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = call i32 @semver_is_valid(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
store i32 %23, i32* %1
%24 = load i32, i32* %1
%25 = icmp eq i32 %24, 0
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"\0A# Test: %s\0A\00"
@.str.1 = [12 x i8] c"valid_chars\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [4 x i8] c"159\00"
@.str.4 = [4 x i8] c"1b3\00"
@.str.5 = [6 x i8] c"3 0 1\00"
@.str.6 = [5 x i8] c"&3@(\00"
@str = [3 x i8] c"OK\00"
define void @test_valid_chars() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @semver_is_valid(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%3 = icmp eq i32 %2, 1
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @semver_is_valid(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%7 = icmp eq i32 %6, 1
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = tail call i32 @semver_is_valid(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%11 = icmp eq i32 %10, 1
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
%14 = tail call i32 @semver_is_valid(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
%16 = zext i1 %15 to i32
%17 = tail call i32 @assert(i32 %16)
%18 = tail call i32 @semver_is_valid(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i32
%21 = tail call i32 @assert(i32 %20)
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}