#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__ parse_int(char *, int *);
int parse_quorum_policy(char *pol, int *dest) {
  int qp;
  if (parse_int(pol, &qp) != 0) {
    return -1;
  }
  if (qp < 0 || qp > 32) {
    return -1;
  }
  if (dest != NULL) {
    *dest = qp;
  }
  return 0;
}


x86 assembly (clang, -O0):
<parse_quorum_policy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1030 <parse_int@plt>
cmp    $0x0,%rax
je     1143 <parse_quorum_policy+0x33>
movl   $0xffffffff,-0x4(%rbp)
jmp    117e <parse_quorum_policy+0x6e>
cmpl   $0x0,-0x1c(%rbp)
jl     1157 <parse_quorum_policy+0x47>
cmpl   $0x20,-0x1c(%rbp)
jle    1163 <parse_quorum_policy+0x53>
movl   $0xffffffff,-0x4(%rbp)
jmp    117e <parse_quorum_policy+0x6e>
cmpq   $0x0,-0x18(%rbp)
je     1177 <parse_quorum_policy+0x67>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_quorum_policy>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0xc(%rsp),%rsi
call   1030 <parse_int@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    1141 <parse_quorum_policy+0x31>
mov    0xc(%rsp),%ecx
cmp    $0x20,%ecx
ja     1141 <parse_quorum_policy+0x31>
xor    %eax,%eax
test   %rbx,%rbx
je     1141 <parse_quorum_policy+0x31>
mov    %ecx,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @parse_quorum_policy(i8* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
%7 = load i8*, i8** %4
%8 = call i64 @parse_int(i8* %7, i32* %6)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 -1, i32* %3
br label %25
11: ; preds = %2
%12 = load i32, i32* %6
%13 = icmp slt i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i32, i32* %6
%16 = icmp sgt i32 %15, 32
br i1 %16, label %17, label %18
17: ; preds = %14, %11
store i32 -1, i32* %3
br label %25
18: ; preds = %14
%19 = load i32*, i32** %5
%20 = icmp ne i32* %19, null
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* %6
%23 = load i32*, i32** %5
store i32 %22, i32* %23
br label %24
24: ; preds = %21, %18
store i32 0, i32* %3
br label %25
25: ; preds = %24, %17, %10
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @parse_quorum_policy(i8* %0, i32* writeonly %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i64 @parse_int(i8* %0, i32* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* %3
%9 = icmp ugt i32 %8, 32
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = icmp eq i32* %1, null
br i1 %11, label %13, label %12
12: ; preds = %10
store i32 %8, i32* %1
br label %13
13: ; preds = %10, %12, %7, %2
%14 = phi i32 [ -1, %2 ], [ -1, %7 ], [ 0, %12 ], [ 0, %10 ]
ret i32 %14
}