#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 at_tok_nextint(char **, int *);
int at_tok_start(char **);
int ParseRegistrationState(char *line) {
  int err;
  int srv_status, srv_domain;
  char *responseStr[4];
  const char *cmd;
  const char *prefix;
  char *p;
  int commas;
  int skip;
  int count = 3;
  err = at_tok_start(&line);
  if (err < 0)
    goto error;
  err = at_tok_nextint(&line, &srv_status);
  if (err < 0)
    goto error;
  err = at_tok_nextint(&line, &srv_domain);
  if (err < 0)
    goto error;
  if ((srv_status == 2) && ((srv_domain == 2) || (srv_domain == 4))) {
    return 1;
  } else {
    return 0;
  }
error:
  return -1;
}


x86 assembly (clang, -O0):
<ParseRegistrationState>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x3,-0x64(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <at_tok_start@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    114e <ParseRegistrationState+0x2e>
jmp    11c2 <ParseRegistrationState+0xa2>
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <at_tok_nextint@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    116d <ParseRegistrationState+0x4d>
jmp    11c2 <ParseRegistrationState+0xa2>
lea    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <at_tok_nextint@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    118c <ParseRegistrationState+0x6c>
jmp    11c2 <ParseRegistrationState+0xa2>
cmpl   $0x2,-0x18(%rbp)
jne    11b6 <ParseRegistrationState+0x96>
cmpl   $0x2,-0x1c(%rbp)
je     11aa <ParseRegistrationState+0x8a>
cmpl   $0x4,-0x1c(%rbp)
jne    11b6 <ParseRegistrationState+0x96>
movl   $0x1,-0x4(%rbp)
jmp    11c9 <ParseRegistrationState+0xa9>
movl   $0x0,-0x4(%rbp)
jmp    11c9 <ParseRegistrationState+0xa9>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ParseRegistrationState>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,(%rsp)
mov    %rsp,%rdi
call   1030 <at_tok_start@plt>
mov    $0xffffffff,%ebx
test   %eax,%eax
js     1176 <ParseRegistrationState+0x56>
mov    %rsp,%rdi
lea    0xc(%rsp),%rsi
call   1040 <at_tok_nextint@plt>
test   %eax,%eax
js     1176 <ParseRegistrationState+0x56>
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
call   1040 <at_tok_nextint@plt>
test   %eax,%eax
js     1176 <ParseRegistrationState+0x56>
xor    %ebx,%ebx
cmpl   $0x2,0xc(%rsp)
jne    1176 <ParseRegistrationState+0x56>
mov    0x8(%rsp),%eax
add    $0xfffffffe,%eax
xor    %ebx,%ebx
test   $0xfffffffd,%eax
sete   %bl
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ParseRegistrationState(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [4 x i8*]
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i8* %0, i8** %3
store i32 3, i32* %13
%14 = call i32 @at_tok_start(i8** %3)
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %1
br label %39
18: ; preds = %1
%19 = call i32 @at_tok_nextint(i8** %3, i32* %5)
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
br label %39
23: ; preds = %18
%24 = call i32 @at_tok_nextint(i8** %3, i32* %6)
store i32 %24, i32* %4
%25 = load i32, i32* %4
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
br label %39
28: ; preds = %23
%29 = load i32, i32* %5
%30 = icmp eq i32 %29, 2
br i1 %30, label %31, label %38
31: ; preds = %28
%32 = load i32, i32* %6
%33 = icmp eq i32 %32, 2
br i1 %33, label %37, label %34
34: ; preds = %31
%35 = load i32, i32* %6
%36 = icmp eq i32 %35, 4
br i1 %36, label %37, label %38
37: ; preds = %34, %31
store i32 1, i32* %2
br label %40
38: ; preds = %34, %28
store i32 0, i32* %2
br label %40
39: ; preds = %27, %22, %17
store i32 -1, i32* %2
br label %40
40: ; preds = %39, %38, %37
%41 = load i32, i32* %2
ret i32 %41
}

LLVM IR (-O2):
define i32 @ParseRegistrationState(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call i32 @at_tok_start(i8** %2)
%8 = icmp slt i32 %7, 0
br i1 %8, label %24, label %9
9: ; preds = %1
%10 = call i32 @at_tok_nextint(i8** %2, i32* %3)
%11 = icmp slt i32 %10, 0
br i1 %11, label %24, label %12
12: ; preds = %9
%13 = call i32 @at_tok_nextint(i8** %2, i32* %4)
%14 = icmp slt i32 %13, 0
br i1 %14, label %24, label %15
15: ; preds = %12
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 2
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 4
%21 = icmp eq i32 %19, 2
%22 = or i1 %20, %21
%23 = zext i1 %22 to i32
br label %24
24: ; preds = %15, %18, %1, %9, %12
%25 = phi i32 [ -1, %12 ], [ -1, %9 ], [ -1, %1 ], [ %23, %18 ], [ 0, %15 ]
ret i32 %25
}