#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 */
scalar_t__ police_action_a2n(char *, int *);
char *strchr(char *, char);
int get_police_result(int *action, int *result, char *arg) {
  char *p = strchr(arg, '/');
  if (p)
    *p = 0;
  if (police_action_a2n(arg, action)) {
    if (p)
      *p = '/';
    return -1;
  }
  if (p) {
    *p = '/';
    if (police_action_a2n(p + 1, result))
      return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_police_result>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1158 <get_police_result+0x38>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <police_action_a2n@plt>
cmp    $0x0,%rax
je     118d <get_police_result+0x6d>
cmpq   $0x0,-0x28(%rbp)
je     1181 <get_police_result+0x61>
mov    -0x28(%rbp),%rax
movb   $0x2f,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    11d2 <get_police_result+0xb2>
cmpq   $0x0,-0x28(%rbp)
je     11cb <get_police_result+0xab>
mov    -0x28(%rbp),%rax
movb   $0x2f,(%rax)
mov    -0x28(%rbp),%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rsi
call   1040 <police_action_a2n@plt>
cmp    $0x0,%rax
je     11c6 <get_police_result+0xa6>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d2 <get_police_result+0xb2>
jmp    11cb <get_police_result+0xab>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_police_result>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbp
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
mov    $0x2f,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1176 <get_police_result+0x56>
mov    %rax,%rbx
movb   $0x0,(%rax)
mov    %rbp,%rdi
mov    %r15,%rsi
call   1040 <police_action_a2n@plt>
movb   $0x2f,(%rbx)
mov    $0xffffffff,%ebp
test   %rax,%rax
jne    118d <get_police_result+0x6d>
add    $0x1,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <police_action_a2n@plt>
test   %rax,%rax
jne    118d <get_police_result+0x6d>
jmp    118b <get_police_result+0x6b>
mov    %rbp,%rdi
mov    %r15,%rsi
call   1040 <police_action_a2n@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
jne    118d <get_police_result+0x6d>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get_police_result(i32* %0, i32* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
store i32* %0, i32** %5
store i32* %1, i32** %6
store i8* %2, i8** %7
%9 = load i8*, i8** %7
%10 = call i8* @strchr(i8* %9, i8 signext 47)
store i8* %10, i8** %8
%11 = load i8*, i8** %8
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = load i8*, i8** %8
store i8 0, i8* %14
br label %15
15: ; preds = %13, %3
%16 = load i8*, i8** %7
%17 = load i32*, i32** %5
%18 = call i64 @police_action_a2n(i8* %16, i32* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %15
%21 = load i8*, i8** %8
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = load i8*, i8** %8
store i8 47, i8* %24
br label %25
25: ; preds = %23, %20
store i32 -1, i32* %4
br label %39
26: ; preds = %15
%27 = load i8*, i8** %8
%28 = icmp ne i8* %27, null
br i1 %28, label %29, label %38
29: ; preds = %26
%30 = load i8*, i8** %8
store i8 47, i8* %30
%31 = load i8*, i8** %8
%32 = getelementptr inbounds i8, i8* %31, i64 1
%33 = load i32*, i32** %6
%34 = call i64 @police_action_a2n(i8* %32, i32* %33)
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %29
store i32 -1, i32* %4
br label %39
37: ; preds = %29
br label %38
38: ; preds = %37, %26
store i32 0, i32* %4
br label %39
39: ; preds = %38, %36, %25
%40 = load i32, i32* %4
ret i32 %40
}

LLVM IR (-O2):
define i32 @get_police_result(i32* %0, i32* %1, i8* %2) {
%4 = tail call i8* @strchr(i8* dereferenceable(1) %2, i8 signext 47)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i64 @police_action_a2n(i8* %2, i32* %0)
%8 = icmp eq i64 %7, 0
br i1 %8, label %16, label %17
9: ; preds = %3
store i8 0, i8* %4
%10 = tail call i64 @police_action_a2n(i8* %2, i32* %0)
%11 = icmp eq i64 %10, 0
store i8 47, i8* %4
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = getelementptr inbounds i8, i8* %4, i64 1
%14 = tail call i64 @police_action_a2n(i8* %13, i32* %1)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %6, %12
br label %17
17: ; preds = %9, %6, %12, %16
%18 = phi i32 [ 0, %16 ], [ -1, %12 ], [ -1, %6 ], [ -1, %9 ]
ret i32 %18
}