#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 *strchr(char *, char);
scalar_t__ strlen(char *);
int CheckResult(char *res) {
  char *s, *t;
  int done = 0;
  if (!res)
    return (0);
  if ((int)strlen(res) < 3)
    return (0);
  t = res;
  while (!done) {
    s = strchr(t, '=');
    if (!s)
      return (0);
    t = strchr(s, '&');
    if (!t) {
      if ((int)strlen(s) > 1)
        return (1);
      else
        return (0);
    } else {
      if (t - s > 1)
        return (1);
      t++;
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<CheckResult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114a <CheckResult+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    122f <CheckResult+0x10f>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x3,%eax
jge    1168 <CheckResult+0x48>
movl   $0x0,-0x4(%rbp)
jmp    122f <CheckResult+0x10f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x0,-0x24(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1186 <CheckResult+0x66>
jmp    1228 <CheckResult+0x108>
mov    -0x20(%rbp),%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11af <CheckResult+0x8f>
movl   $0x0,-0x4(%rbp)
jmp    122f <CheckResult+0x10f>
mov    -0x18(%rbp),%rdi
mov    $0x26,%esi
call   1040 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11f6 <CheckResult+0xd6>
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x1,%eax
jle    11ea <CheckResult+0xca>
movl   $0x1,-0x4(%rbp)
jmp    122f <CheckResult+0x10f>
movl   $0x0,-0x4(%rbp)
jmp    122f <CheckResult+0x10f>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
cmp    $0x1,%rax
jle    1217 <CheckResult+0xf7>
movl   $0x1,-0x4(%rbp)
jmp    122f <CheckResult+0x10f>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1170 <CheckResult+0x50>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CheckResult>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
test   %rdi,%rdi
je     11a1 <CheckResult+0x81>
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x3,%eax
jl     11a1 <CheckResult+0x81>
mov    %rbx,%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11a1 <CheckResult+0x81>
mov    %rax,%rbx
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x26,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1189 <CheckResult+0x69>
mov    %rax,%rcx
sub    %rbx,%rcx
cmp    $0x2,%rcx
jge    119c <CheckResult+0x7c>
add    $0x1,%rax
mov    %rax,%rdi
mov    $0x3d,%esi
call   1040 <strchr@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1150 <CheckResult+0x30>
jmp    11a1 <CheckResult+0x81>
mov    %rbx,%rdi
call   1030 <strlen@plt>
xor    %ebp,%ebp
cmp    $0x2,%eax
setge  %bpl
jmp    11a1 <CheckResult+0x81>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @CheckResult(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %6
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %1
store i32 0, i32* %2
br label %53
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = call i64 @strlen(i8* %11)
%13 = trunc i64 %12 to i32
%14 = icmp slt i32 %13, 3
br i1 %14, label %15, label %16
15: ; preds = %10
store i32 0, i32* %2
br label %53
16: ; preds = %10
%17 = load i8*, i8** %3
store i8* %17, i8** %5
br label %18
18: ; preds = %51, %16
%19 = load i32, i32* %6
%20 = icmp ne i32 %19, 0
%21 = xor i1 %20, true
br i1 %21, label %22, label %52
22: ; preds = %18
%23 = load i8*, i8** %5
%24 = call i8* @strchr(i8* %23, i8 signext 61)
store i8* %24, i8** %4
%25 = load i8*, i8** %4
%26 = icmp ne i8* %25, null
br i1 %26, label %28, label %27
27: ; preds = %22
store i32 0, i32* %2
br label %53
28: ; preds = %22
%29 = load i8*, i8** %4
%30 = call i8* @strchr(i8* %29, i8 signext 38)
store i8* %30, i8** %5
%31 = load i8*, i8** %5
%32 = icmp ne i8* %31, null
br i1 %32, label %40, label %33
33: ; preds = %28
%34 = load i8*, i8** %4
%35 = call i64 @strlen(i8* %34)
%36 = trunc i64 %35 to i32
%37 = icmp sgt i32 %36, 1
br i1 %37, label %38, label %39
38: ; preds = %33
store i32 1, i32* %2
br label %53
39: ; preds = %33
store i32 0, i32* %2
br label %53
40: ; preds = %28
%41 = load i8*, i8** %5
%42 = load i8*, i8** %4
%43 = ptrtoint i8* %41 to i64
%44 = ptrtoint i8* %42 to i64
%45 = sub i64 %43, %44
%46 = icmp sgt i64 %45, 1
br i1 %46, label %47, label %48
47: ; preds = %40
store i32 1, i32* %2
br label %53
48: ; preds = %40
%49 = load i8*, i8** %5
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %5
br label %51
51: ; preds = %48
br label %18
52: ; preds = %18
store i32 0, i32* %2
br label %53
53: ; preds = %52, %47, %39, %38, %27, %15, %9
%54 = load i32, i32* %2
ret i32 %54
}

LLVM IR (-O2):
define i32 @CheckResult(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %28, label %3
3: ; preds = %1
%4 = tail call i64 @strlen(i8* %0)
%5 = trunc i64 %4 to i32
%6 = icmp slt i32 %5, 3
br i1 %6, label %28, label %7
7: ; preds = %3
%8 = tail call i8* @strchr(i8* %0, i8 signext 61)
%9 = icmp eq i8* %8, null
br i1 %9, label %28, label %14
10: ; preds = %23
%11 = getelementptr inbounds i8, i8* %16, i64 1
%12 = tail call i8* @strchr(i8* %11, i8 signext 61)
%13 = icmp eq i8* %12, null
br i1 %13, label %28, label %14
14: ; preds = %7, %10
%15 = phi i8* [ %12, %10 ], [ %8, %7 ]
%16 = tail call i8* @strchr(i8* %15, i8 signext 38)
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %23
18: ; preds = %14
%19 = tail call i64 @strlen(i8* %15)
%20 = trunc i64 %19 to i32
%21 = icmp sgt i32 %20, 1
%22 = zext i1 %21 to i32
br label %28
23: ; preds = %14
%24 = ptrtoint i8* %16 to i64
%25 = ptrtoint i8* %15 to i64
%26 = sub i64 %24, %25
%27 = icmp sgt i64 %26, 1
br i1 %27, label %28, label %10
28: ; preds = %10, %23, %7, %18, %3, %1
%29 = phi i32 [ 0, %1 ], [ 0, %3 ], [ %22, %18 ], [ 0, %7 ], [ 0, %10 ], [ 1, %23 ]
ret i32 %29
}