#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 */
char *str_dup(char *);
scalar_t__ str_rm(char *, char *);
scalar_t__ str_rm_and_after(char *, char *);
scalar_t__ str_rm_and_before(char *, char *);
int scanvar(char *var, char **pre, char **dep, char **req) {
  *pre = str_dup(var);
  *dep = str_dup(var);
  *req = str_dup(var);
  return str_rm(*pre, "ACCESS_") && str_rm_and_after(*pre, "_") &&
         str_rm(*dep, "ACCESS_") && str_rm_and_before(*dep, "_") &&
         str_rm_and_after(*dep, ":=") && str_rm_and_before(*req, ":=");
}


x86 assembly (clang, -O0):
<scanvar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <str_dup@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
call   1060 <str_dup@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
call   1060 <str_dup@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe61(%rip),%rsi
call   1030 <str_rm@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x21(%rbp)
je     1267 <scanvar+0x127>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe42(%rip),%rsi
call   1050 <str_rm_and_after@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x21(%rbp)
je     1267 <scanvar+0x127>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
lea    0xe17(%rip),%rsi
call   1030 <str_rm@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x21(%rbp)
je     1267 <scanvar+0x127>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
lea    0xdf8(%rip),%rsi
call   1040 <str_rm_and_before@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x21(%rbp)
je     1267 <scanvar+0x127>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
lea    0xdd5(%rip),%rsi
call   1050 <str_rm_and_after@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x21(%rbp)
je     1267 <scanvar+0x127>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
lea    0xdb0(%rip),%rsi
call   1040 <str_rm_and_before@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scanvar>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%rbp
mov    %rdi,%rbx
call   1060 <str_dup@plt>
mov    %rax,0x0(%rbp)
mov    %rbx,%rdi
call   1060 <str_dup@plt>
mov    %rax,(%r12)
mov    %rbx,%rdi
call   1060 <str_dup@plt>
mov    %rax,(%r14)
mov    0x0(%rbp),%rdi
lea    0xe81(%rip),%rsi
call   1030 <str_rm@plt>
xor    %r15d,%r15d
test   %rax,%rax
je     11f9 <scanvar+0xb9>
mov    0x0(%rbp),%rdi
lea    0xe6f(%rip),%rsi
call   1050 <str_rm_and_after@plt>
test   %rax,%rax
je     11f9 <scanvar+0xb9>
mov    (%r12),%rdi
lea    0xe54(%rip),%rsi
call   1030 <str_rm@plt>
test   %rax,%rax
je     11f9 <scanvar+0xb9>
mov    (%r12),%rdi
lea    0xe45(%rip),%rsi
call   1040 <str_rm_and_before@plt>
test   %rax,%rax
je     11f9 <scanvar+0xb9>
mov    (%r12),%rdi
lea    0xe32(%rip),%rsi
call   1050 <str_rm_and_after@plt>
test   %rax,%rax
je     11f9 <scanvar+0xb9>
mov    (%r14),%rdi
lea    0xe1e(%rip),%rsi
call   1040 <str_rm_and_before@plt>
xor    %r15d,%r15d
test   %rax,%rax
setne  %r15b
mov    %r15d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"ACCESS_\00"
@.str.1 = [2 x i8] c"_\00"
@.str.2 = [3 x i8] c":=\00"
define i32 @scanvar(i8* %0, i8** %1, i8** %2, i8** %3) {
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i8**
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i8** %3, i8*** %8
%9 = load i8*, i8** %5
%10 = call i8* @str_dup(i8* %9)
%11 = load i8**, i8*** %6
store i8* %10, i8** %11
%12 = load i8*, i8** %5
%13 = call i8* @str_dup(i8* %12)
%14 = load i8**, i8*** %7
store i8* %13, i8** %14
%15 = load i8*, i8** %5
%16 = call i8* @str_dup(i8* %15)
%17 = load i8**, i8*** %8
store i8* %16, i8** %17
%18 = load i8**, i8*** %6
%19 = load i8*, i8** %18
%20 = call i64 @str_rm(i8* %19, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %47
22: ; preds = %4
%23 = load i8**, i8*** %6
%24 = load i8*, i8** %23
%25 = call i64 @str_rm_and_after(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %47
27: ; preds = %22
%28 = load i8**, i8*** %7
%29 = load i8*, i8** %28
%30 = call i64 @str_rm(i8* %29, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %47
32: ; preds = %27
%33 = load i8**, i8*** %7
%34 = load i8*, i8** %33
%35 = call i64 @str_rm_and_before(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %47
37: ; preds = %32
%38 = load i8**, i8*** %7
%39 = load i8*, i8** %38
%40 = call i64 @str_rm_and_after(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %47
42: ; preds = %37
%43 = load i8**, i8*** %8
%44 = load i8*, i8** %43
%45 = call i64 @str_rm_and_before(i8* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%46 = icmp ne i64 %45, 0
br label %47
47: ; preds = %42, %37, %32, %27, %22, %4
%48 = phi i1 [ false, %37 ], [ false, %32 ], [ false, %27 ], [ false, %22 ], [ false, %4 ], [ %46, %42 ]
%49 = zext i1 %48 to i32
ret i32 %49
}

LLVM IR (-O2):
@.str = [8 x i8] c"ACCESS_\00"
@.str.1 = [2 x i8] c"_\00"
@.str.2 = [3 x i8] c":=\00"
define i32 @scanvar(i8* %0, i8** nocapture %1, i8** nocapture %2, i8** nocapture %3) {
%5 = tail call i8* @str_dup(i8* %0)
store i8* %5, i8** %1
%6 = tail call i8* @str_dup(i8* %0)
store i8* %6, i8** %2
%7 = tail call i8* @str_dup(i8* %0)
store i8* %7, i8** %3
%8 = load i8*, i8** %1
%9 = tail call i64 @str_rm(i8* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %32, label %11
11: ; preds = %4
%12 = load i8*, i8** %1
%13 = tail call i64 @str_rm_and_after(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %32, label %15
15: ; preds = %11
%16 = load i8*, i8** %2
%17 = tail call i64 @str_rm(i8* %16, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %32, label %19
19: ; preds = %15
%20 = load i8*, i8** %2
%21 = tail call i64 @str_rm_and_before(i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %32, label %23
23: ; preds = %19
%24 = load i8*, i8** %2
%25 = tail call i64 @str_rm_and_after(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %32, label %27
27: ; preds = %23
%28 = load i8*, i8** %3
%29 = tail call i64 @str_rm_and_before(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp ne i64 %29, 0
%31 = zext i1 %30 to i32
br label %32
32: ; preds = %27, %23, %19, %15, %11, %4
%33 = phi i32 [ 0, %23 ], [ 0, %19 ], [ 0, %15 ], [ 0, %11 ], [ 0, %4 ], [ %31, %27 ]
ret i32 %33
}