#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 */
unsigned int executeBatch(void *, char **, unsigned int);
int /*<<< orphan*/ freeCommands(char **, unsigned int);
unsigned int handleMessage(void *, int /*<<< orphan*/ *, char *, unsigned char,
                           char **, unsigned int *, void **);
unsigned int executeHandleMessage(void *handle, char *message,
                                  unsigned char actionType) {
  char *commands[10000];
  unsigned int commandCount = 0;
  void *rulesBinding = NULL;
  unsigned int result = handleMessage(handle, NULL, message, actionType,
                                      commands, &commandCount, &rulesBinding);
  if (result != 0 && result != 201) {
    freeCommands(commands, commandCount);
    return result;
  }
  unsigned int batchResult = executeBatch(rulesBinding, commands, commandCount);
  if (batchResult != 0) {
    return batchResult;
  }
  return result;
}


x86 assembly (clang, -O0):
<executeHandleMessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x138c0,%rsp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %al,-0x19(%rbp)
movl   $0x0,-0x138a4(%rbp)
movq   $0x0,-0x138b0(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x19(%rbp),%cl
lea    -0x138a0(%rbp),%r8
xor    %eax,%eax
mov    %eax,%esi
lea    -0x138a4(%rbp),%r9
lea    -0x138b0(%rbp),%rax
movzbl %cl,%ecx
mov    %rax,(%rsp)
call   1030 <handleMessage@plt>
mov    %eax,-0x138b4(%rbp)
cmpl   $0x0,-0x138b4(%rbp)
je     11d0 <executeHandleMessage+0xa0>
cmpl   $0xc9,-0x138b4(%rbp)
je     11d0 <executeHandleMessage+0xa0>
lea    -0x138a0(%rbp),%rdi
mov    -0x138a4(%rbp),%esi
call   1050 <freeCommands@plt>
mov    -0x138b4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1213 <executeHandleMessage+0xe3>
mov    -0x138b0(%rbp),%rdi
lea    -0x138a0(%rbp),%rsi
mov    -0x138a4(%rbp),%edx
call   1040 <executeBatch@plt>
mov    %eax,-0x138b8(%rbp)
cmpl   $0x0,-0x138b8(%rbp)
je     120a <executeHandleMessage+0xda>
mov    -0x138b8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1213 <executeHandleMessage+0xe3>
mov    -0x138b4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x138c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<executeHandleMessage>:
push   %rbx
sub    $0x138a0,%rsp
mov    %edx,%ecx
mov    %rsi,%rdx
movl   $0x0,0x14(%rsp)
movq   $0x0,0x18(%rsp)
lea    0x18(%rsp),%rax
mov    %rax,(%rsp)
lea    0x20(%rsp),%r8
lea    0x14(%rsp),%r9
xor    %esi,%esi
call   1030 <handleMessage@plt>
mov    %eax,%ebx
test   %eax,%eax
je     1176 <executeHandleMessage+0x46>
cmp    $0xc9,%ebx
jne    1190 <executeHandleMessage+0x60>
mov    0x18(%rsp),%rdi
mov    0x14(%rsp),%edx
lea    0x20(%rsp),%rsi
call   1040 <executeBatch@plt>
test   %eax,%eax
cmovne %eax,%ebx
jmp    119e <executeHandleMessage+0x6e>
mov    0x14(%rsp),%esi
lea    0x20(%rsp),%rdi
call   1050 <freeCommands@plt>
mov    %ebx,%eax
add    $0x138a0,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @executeHandleMessage(i8* %0, i8* %1, i8 zeroext %2) {
%4 = alloca [10000 x i8*]
%5 = alloca i32
%6 = alloca i8*
%7 = bitcast [10000 x i8*]* %4 to i8*
%8 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%9 = bitcast i8** %6 to i8*
store i8* null, i8** %6
%10 = getelementptr inbounds [10000 x i8*], [10000 x i8*]* %4, i64 0, i64 0
%11 = call i32 @handleMessage(i8* %0, i32* null, i8* %1, i8 zeroext %2, i8** %10, i32* %5, i8** %6)
switch i32 %11, label %12 [
i32 201, label %15
i32 0, label %15
]
12: ; preds = %3
%13 = load i32, i32* %5
%14 = call i32 @freeCommands(i8** %10, i32 %13)
br label %21
15: ; preds = %3, %3
%16 = load i8*, i8** %6
%17 = load i32, i32* %5
%18 = call i32 @executeBatch(i8* %16, i8** %10, i32 %17)
%19 = icmp eq i32 %18, 0
%20 = select i1 %19, i32 %11, i32 %18
br label %21
21: ; preds = %15, %12
%22 = phi i32 [ %11, %12 ], [ %20, %15 ]
ret i32 %22
}