#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*/ PrintErrorExit(char *, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ ishex(char *);
int /*<<< orphan*/ stderr;
void Check_TapeAlert(int argc, char **argv) {
  if (argc > 3) {
    if (!ishex(argv[3])) {
      fprintf(stderr, "Value not hexadecimal: %s\n", argv[3]);
      exit(1);
    }
    if (argc == 4)
      return;
    PrintErrorExit(argv[0], "TapeAlert");
  }
  PrintErrorExit(argv[0], "TapeAlert");
}


x86 assembly (clang, -O0):
<Check_TapeAlert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x4(%rbp)
jle    11b8 <Check_TapeAlert+0x78>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1030 <ishex@plt>
cmp    $0x0,%eax
jne    1196 <Check_TapeAlert+0x56>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
lea    0xe79(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
cmpl   $0x4,-0x4(%rbp)
jne    11a5 <Check_TapeAlert+0x65>
jmp    11cb <Check_TapeAlert+0x8b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe68(%rip),%rsi
call   1050 <PrintErrorExit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe55(%rip),%rsi
call   1050 <PrintErrorExit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Check_TapeAlert>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x4,%edi
jl     1175 <Check_TapeAlert+0x35>
mov    %edi,%ebp
mov    0x18(%rbx),%rdi
call   1030 <ishex@plt>
test   %eax,%eax
je     118a <Check_TapeAlert+0x4a>
cmp    $0x4,%ebp
jne    1166 <Check_TapeAlert+0x26>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    (%rbx),%rdi
lea    0xeab(%rip),%rsi
call   1050 <PrintErrorExit@plt>
mov    (%rbx),%rdi
lea    0xe9c(%rip),%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <PrintErrorExit@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
mov    0x18(%rbx),%rdx
lea    0xe62(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"Value not hexadecimal: %s\0A\00"
@.str.1 = [10 x i8] c"TapeAlert\00"
define void @Check_TapeAlert(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp sgt i32 %5, 3
br i1 %6, label %7, label %29
7: ; preds = %2
%8 = load i8**, i8*** %4
%9 = getelementptr inbounds i8*, i8** %8, i64 3
%10 = load i8*, i8** %9
%11 = call i32 @ishex(i8* %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %20, label %13
13: ; preds = %7
%14 = load i32, i32* @stderr
%15 = load i8**, i8*** %4
%16 = getelementptr inbounds i8*, i8** %15, i64 3
%17 = load i8*, i8** %16
%18 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %7
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, 4
br i1 %22, label %23, label %24
23: ; preds = %20
br label %34
24: ; preds = %20
%25 = load i8**, i8*** %4
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
%28 = call i32 @PrintErrorExit(i8* %27, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %24, %2
%30 = load i8**, i8*** %4
%31 = getelementptr inbounds i8*, i8** %30, i64 0
%32 = load i8*, i8** %31
%33 = call i32 @PrintErrorExit(i8* %32, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %34
34: ; preds = %29, %23
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"Value not hexadecimal: %s\0A\00"
@.str.1 = [10 x i8] c"TapeAlert\00"
define void @Check_TapeAlert(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 3
br i1 %3, label %4, label %19
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 3
%6 = load i8*, i8** %5
%7 = tail call i32 @ishex(i8* %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %4
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %5
%12 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %4
%15 = icmp eq i32 %0, 4
br i1 %15, label %22, label %16
16: ; preds = %14
%17 = load i8*, i8** %1
%18 = tail call i32 @PrintErrorExit(i8* %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %16, %2
%20 = load i8*, i8** %1
%21 = tail call i32 @PrintErrorExit(i8* %20, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %14, %19
ret void
}