#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 */
typedef int /*<<< orphan*/ tmp;

/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ logmsg(int, char *);
int /*<<< orphan*/ run_trigger_program(char const **);
scalar_t__ snprintf(char *, int, char *, ...);
char *strdup(char *);
void run_partition_trigger(int partnum, const char *partitionstatus, int armed,
                           int ready, int stay, int chime, int entryd,
                           int exitd, int palarm) {
  char *env[32 + 1];
  int envc = 0;
  char tmp[255], **e;
  logmsg(3, "run_partition_trigger() called");
  if (envc < 32 &&
      snprintf(tmp, sizeof(tmp), "ALARM_EVENT_TYPE=%s", "partition") >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  if (envc < 32 && snprintf(tmp, sizeof(tmp), "ALARM_EVENT_STATUS=%s",
                            partitionstatus) >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  if (envc < 32 &&
      snprintf(tmp, sizeof(tmp), "ALARM_EVENT_PARTITION=%d", partnum) >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  if (envc < 32 && snprintf(tmp, sizeof(tmp), "ALARM_EVENT_PARTITION_ARMED=%d",
                            armed) >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  if (envc < 32 && snprintf(tmp, sizeof(tmp), "ALARM_EVENT_PARTITION_READY=%d",
                            ready) >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  if (envc < 32 &&
      snprintf(tmp, sizeof(tmp), "ALARM_EVENT_PARTITION_STAY=%d", stay) >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  if (envc < 32 && snprintf(tmp, sizeof(tmp), "ALARM_EVENT_PARTITION_CHIME=%d",
                            chime) >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  if (envc < 32 && snprintf(tmp, sizeof(tmp), "ALARM_EVENT_PARTITION_ENTRY=%d",
                            entryd) >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  if (envc < 32 &&
      snprintf(tmp, sizeof(tmp), "ALARM_EVENT_PARTITION_EXIT=%d", exitd) >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  if (envc < 32 && snprintf(tmp, sizeof(tmp), "ALARM_EVENT_PARTITION_ALARM=%d",
                            palarm) >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  env[envc] = NULL;
  run_trigger_program((const char **)env);
  e = env;
  while (*e) {
    free(*e);
    e++;
  }
}


x86 assembly (clang, -O0):
<run_partition_trigger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
movl   $0x0,-0x134(%rbp)
mov    $0x3,%edi
lea    0xe71(%rip),%rsi
call   1050 <logmsg@plt>
cmpl   $0x20,-0x134(%rbp)
jge    1205 <run_partition_trigger+0xb5>
lea    -0x240(%rbp),%rdi
mov    $0xff,%esi
lea    0xe6b(%rip),%rdx
lea    0xe78(%rip),%rcx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     1205 <run_partition_trigger+0xb5>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     1200 <run_partition_trigger+0xb0>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    1205 <run_partition_trigger+0xb5>
cmpl   $0x20,-0x134(%rbp)
jge    1273 <run_partition_trigger+0x123>
lea    -0x240(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0xff,%esi
lea    0xe14(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     1273 <run_partition_trigger+0x123>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     126e <run_partition_trigger+0x11e>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    1273 <run_partition_trigger+0x123>
cmpl   $0x20,-0x134(%rbp)
jge    12e0 <run_partition_trigger+0x190>
lea    -0x240(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0xff,%esi
lea    0xdbd(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     12e0 <run_partition_trigger+0x190>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     12db <run_partition_trigger+0x18b>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    12e0 <run_partition_trigger+0x190>
cmpl   $0x20,-0x134(%rbp)
jge    134d <run_partition_trigger+0x1fd>
lea    -0x240(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    $0xff,%esi
lea    0xd69(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     134d <run_partition_trigger+0x1fd>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     1348 <run_partition_trigger+0x1f8>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    134d <run_partition_trigger+0x1fd>
cmpl   $0x20,-0x134(%rbp)
jge    13ba <run_partition_trigger+0x26a>
lea    -0x240(%rbp),%rdi
mov    -0x18(%rbp),%ecx
mov    $0xff,%esi
lea    0xd1b(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     13ba <run_partition_trigger+0x26a>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     13b5 <run_partition_trigger+0x265>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    13ba <run_partition_trigger+0x26a>
cmpl   $0x20,-0x134(%rbp)
jge    1427 <run_partition_trigger+0x2d7>
lea    -0x240(%rbp),%rdi
mov    -0x1c(%rbp),%ecx
mov    $0xff,%esi
lea    0xccd(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     1427 <run_partition_trigger+0x2d7>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     1422 <run_partition_trigger+0x2d2>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    1427 <run_partition_trigger+0x2d7>
cmpl   $0x20,-0x134(%rbp)
jge    1494 <run_partition_trigger+0x344>
lea    -0x240(%rbp),%rdi
mov    -0x20(%rbp),%ecx
mov    $0xff,%esi
lea    0xc7e(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     1494 <run_partition_trigger+0x344>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     148f <run_partition_trigger+0x33f>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    1494 <run_partition_trigger+0x344>
cmpl   $0x20,-0x134(%rbp)
jge    1501 <run_partition_trigger+0x3b1>
lea    -0x240(%rbp),%rdi
mov    0x10(%rbp),%ecx
mov    $0xff,%esi
lea    0xc30(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     1501 <run_partition_trigger+0x3b1>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     14fc <run_partition_trigger+0x3ac>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    1501 <run_partition_trigger+0x3b1>
cmpl   $0x20,-0x134(%rbp)
jge    156e <run_partition_trigger+0x41e>
lea    -0x240(%rbp),%rdi
mov    0x18(%rbp),%ecx
mov    $0xff,%esi
lea    0xbe2(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     156e <run_partition_trigger+0x41e>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     1569 <run_partition_trigger+0x419>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    156e <run_partition_trigger+0x41e>
cmpl   $0x20,-0x134(%rbp)
jge    15db <run_partition_trigger+0x48b>
lea    -0x240(%rbp),%rdi
mov    0x20(%rbp),%ecx
mov    $0xff,%esi
lea    0xb93(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     15db <run_partition_trigger+0x48b>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     15d6 <run_partition_trigger+0x486>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    15db <run_partition_trigger+0x48b>
movslq -0x134(%rbp),%rax
movq   $0x0,-0x130(%rbp,%rax,8)
lea    -0x130(%rbp),%rdi
call   1060 <run_trigger_program@plt>
lea    -0x130(%rbp),%rax
mov    %rax,-0x248(%rbp)
mov    -0x248(%rbp),%rax
cmpq   $0x0,(%rax)
je     163f <run_partition_trigger+0x4ef>
mov    -0x248(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x248(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x248(%rbp)
jmp    1608 <run_partition_trigger+0x4b8>
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_partition_trigger>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    %r9d,0xc(%rsp)
mov    %r8d,%r15d
mov    %ecx,%r12d
mov    %edx,%r13d
mov    %rsi,%rbp
mov    %edi,%ebx
lea    0xe85(%rip),%rsi
mov    $0x3,%edi
call   1050 <logmsg@plt>
lea    0xe93(%rip),%rdx
lea    0xea0(%rip),%rcx
xor    %r14d,%r14d
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     11c8 <run_partition_trigger+0x78>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %rax,0x110(%rsp)
xor    %r14d,%r14d
test   %rax,%rax
setne  %r14b
lea    0xe6e(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
mov    %rbp,%rcx
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     1205 <run_partition_trigger+0xb5>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %r14d,%ecx
mov    %rax,0x110(%rsp,%rcx,8)
cmp    $0x1,%rax
sbb    $0xffffffff,%r14d
lea    0xe47(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     1241 <run_partition_trigger+0xf1>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %r14d,%ecx
mov    %rax,0x110(%rsp,%rcx,8)
cmp    $0x1,%rax
sbb    $0xffffffff,%r14d
lea    0xe24(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
mov    %r13d,%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     127e <run_partition_trigger+0x12e>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %r14d,%ecx
mov    %rax,0x110(%rsp,%rcx,8)
cmp    $0x1,%rax
sbb    $0xffffffff,%r14d
lea    0xe06(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
mov    %r12d,%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     12bb <run_partition_trigger+0x16b>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %r14d,%ecx
mov    %rax,0x110(%rsp,%rcx,8)
cmp    $0x1,%rax
sbb    $0xffffffff,%r14d
lea    0xde8(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
mov    %r15d,%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     12f8 <run_partition_trigger+0x1a8>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %r14d,%ecx
mov    %rax,0x110(%rsp,%rcx,8)
cmp    $0x1,%rax
sbb    $0xffffffff,%r14d
mov    0x250(%rsp),%ebx
lea    0xdc2(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
mov    0xc(%rsp),%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     133d <run_partition_trigger+0x1ed>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %r14d,%ecx
mov    %rax,0x110(%rsp,%rcx,8)
cmp    $0x1,%rax
sbb    $0xffffffff,%r14d
mov    0x258(%rsp),%ebp
lea    0xd9c(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     1380 <run_partition_trigger+0x230>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %r14d,%ecx
mov    %rax,0x110(%rsp,%rcx,8)
cmp    $0x1,%rax
sbb    $0xffffffff,%r14d
mov    0x260(%rsp),%ebx
lea    0xd78(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     13c3 <run_partition_trigger+0x273>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %r14d,%ecx
mov    %rax,0x110(%rsp,%rcx,8)
cmp    $0x1,%rax
sbb    $0xffffffff,%r14d
lea    0xd5a(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     13ff <run_partition_trigger+0x2af>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %r14d,%ecx
mov    %rax,0x110(%rsp,%rcx,8)
cmp    $0x1,%rax
sbb    $0xffffffff,%r14d
mov    %r14d,%eax
movq   $0x0,0x110(%rsp,%rax,8)
lea    0x110(%rsp),%rdi
call   1060 <run_trigger_program@plt>
mov    0x110(%rsp),%rdi
test   %rdi,%rdi
je     1441 <run_partition_trigger+0x2f1>
lea    0x118(%rsp),%rbx
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1430 <run_partition_trigger+0x2e0>
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"run_partition_trigger() called\00"
@.str.1 = [20 x i8] c"ALARM_EVENT_TYPE=%s\00"
@.str.2 = [10 x i8] c"partition\00"
@.str.3 = [22 x i8] c"ALARM_EVENT_STATUS=%s\00"
@.str.4 = [25 x i8] c"ALARM_EVENT_PARTITION=%d\00"
@.str.5 = [31 x i8] c"ALARM_EVENT_PARTITION_ARMED=%d\00"
@.str.6 = [31 x i8] c"ALARM_EVENT_PARTITION_READY=%d\00"
@.str.7 = [30 x i8] c"ALARM_EVENT_PARTITION_STAY=%d\00"
@.str.8 = [31 x i8] c"ALARM_EVENT_PARTITION_CHIME=%d\00"
@.str.9 = [31 x i8] c"ALARM_EVENT_PARTITION_ENTRY=%d\00"
@.str.10 = [30 x i8] c"ALARM_EVENT_PARTITION_EXIT=%d\00"
@.str.11 = [31 x i8] c"ALARM_EVENT_PARTITION_ALARM=%d\00"
define void @run_partition_trigger(i32 %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8) {
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca [33 x i8*]
%20 = alloca i32
%21 = alloca [255 x i8]
%22 = alloca i8**
store i32 %0, i32* %10
store i8* %1, i8** %11
store i32 %2, i32* %12
store i32 %3, i32* %13
store i32 %4, i32* %14
store i32 %5, i32* %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store i32 %8, i32* %18
store i32 0, i32* %20
%23 = call i32 @logmsg(i32 3, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%24 = load i32, i32* %20
%25 = icmp slt i32 %24, 32
br i1 %25, label %26, label %41
26: ; preds = %9
%27 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%28 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %27, i32 255, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%29 = icmp sge i64 %28, 0
br i1 %29, label %30, label %41
30: ; preds = %26
%31 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%32 = call i8* @strdup(i8* %31)
%33 = load i32, i32* %20
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [33 x i8*], [33 x i8*]* %19, i64 0, i64 %34
store i8* %32, i8** %35
%36 = icmp ne i8* %32, null
br i1 %36, label %37, label %40
37: ; preds = %30
%38 = load i32, i32* %20
%39 = add nsw i32 %38, 1
store i32 %39, i32* %20
br label %40
40: ; preds = %37, %30
br label %41
41: ; preds = %40, %26, %9
%42 = load i32, i32* %20
%43 = icmp slt i32 %42, 32
br i1 %43, label %44, label %60
44: ; preds = %41
%45 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%46 = load i8*, i8** %11
%47 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %45, i32 255, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %46)
%48 = icmp sge i64 %47, 0
br i1 %48, label %49, label %60
49: ; preds = %44
%50 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%51 = call i8* @strdup(i8* %50)
%52 = load i32, i32* %20
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [33 x i8*], [33 x i8*]* %19, i64 0, i64 %53
store i8* %51, i8** %54
%55 = icmp ne i8* %51, null
br i1 %55, label %56, label %59
56: ; preds = %49
%57 = load i32, i32* %20
%58 = add nsw i32 %57, 1
store i32 %58, i32* %20
br label %59
59: ; preds = %56, %49
br label %60
60: ; preds = %59, %44, %41
%61 = load i32, i32* %20
%62 = icmp slt i32 %61, 32
br i1 %62, label %63, label %79
63: ; preds = %60
%64 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%65 = load i32, i32* %10
%66 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %64, i32 255, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %65)
%67 = icmp sge i64 %66, 0
br i1 %67, label %68, label %79
68: ; preds = %63
%69 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%70 = call i8* @strdup(i8* %69)
%71 = load i32, i32* %20
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [33 x i8*], [33 x i8*]* %19, i64 0, i64 %72
store i8* %70, i8** %73
%74 = icmp ne i8* %70, null
br i1 %74, label %75, label %78
75: ; preds = %68
%76 = load i32, i32* %20
%77 = add nsw i32 %76, 1
store i32 %77, i32* %20
br label %78
78: ; preds = %75, %68
br label %79
79: ; preds = %78, %63, %60
%80 = load i32, i32* %20
%81 = icmp slt i32 %80, 32
br i1 %81, label %82, label %98
82: ; preds = %79
%83 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%84 = load i32, i32* %12
%85 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %83, i32 255, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %84)
%86 = icmp sge i64 %85, 0
br i1 %86, label %87, label %98
87: ; preds = %82
%88 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%89 = call i8* @strdup(i8* %88)
%90 = load i32, i32* %20
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [33 x i8*], [33 x i8*]* %19, i64 0, i64 %91
store i8* %89, i8** %92
%93 = icmp ne i8* %89, null
br i1 %93, label %94, label %97
94: ; preds = %87
%95 = load i32, i32* %20
%96 = add nsw i32 %95, 1
store i32 %96, i32* %20
br label %97
97: ; preds = %94, %87
br label %98
98: ; preds = %97, %82, %79
%99 = load i32, i32* %20
%100 = icmp slt i32 %99, 32
br i1 %100, label %101, label %117
101: ; preds = %98
%102 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%103 = load i32, i32* %13
%104 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %102, i32 255, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 %103)
%105 = icmp sge i64 %104, 0
br i1 %105, label %106, label %117
106: ; preds = %101
%107 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%108 = call i8* @strdup(i8* %107)
%109 = load i32, i32* %20
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds [33 x i8*], [33 x i8*]* %19, i64 0, i64 %110
store i8* %108, i8** %111
%112 = icmp ne i8* %108, null
br i1 %112, label %113, label %116
113: ; preds = %106
%114 = load i32, i32* %20
%115 = add nsw i32 %114, 1
store i32 %115, i32* %20
br label %116
116: ; preds = %113, %106
br label %117
117: ; preds = %116, %101, %98
%118 = load i32, i32* %20
%119 = icmp slt i32 %118, 32
br i1 %119, label %120, label %136
120: ; preds = %117
%121 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%122 = load i32, i32* %14
%123 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %121, i32 255, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i32 %122)
%124 = icmp sge i64 %123, 0
br i1 %124, label %125, label %136
125: ; preds = %120
%126 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%127 = call i8* @strdup(i8* %126)
%128 = load i32, i32* %20
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds [33 x i8*], [33 x i8*]* %19, i64 0, i64 %129
store i8* %127, i8** %130
%131 = icmp ne i8* %127, null
br i1 %131, label %132, label %135
132: ; preds = %125
%133 = load i32, i32* %20
%134 = add nsw i32 %133, 1
store i32 %134, i32* %20
br label %135
135: ; preds = %132, %125
br label %136
136: ; preds = %135, %120, %117
%137 = load i32, i32* %20
%138 = icmp slt i32 %137, 32
br i1 %138, label %139, label %155
139: ; preds = %136
%140 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%141 = load i32, i32* %15
%142 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %140, i32 255, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i32 %141)
%143 = icmp sge i64 %142, 0
br i1 %143, label %144, label %155
144: ; preds = %139
%145 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%146 = call i8* @strdup(i8* %145)
%147 = load i32, i32* %20
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds [33 x i8*], [33 x i8*]* %19, i64 0, i64 %148
store i8* %146, i8** %149
%150 = icmp ne i8* %146, null
br i1 %150, label %151, label %154
151: ; preds = %144
%152 = load i32, i32* %20
%153 = add nsw i32 %152, 1
store i32 %153, i32* %20
br label %154
154: ; preds = %151, %144
br label %155
155: ; preds = %154, %139, %136
%156 = load i32, i32* %20
%157 = icmp slt i32 %156, 32
br i1 %157, label %158, label %174
158: ; preds = %155
%159 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%160 = load i32, i32* %16
%161 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %159, i32 255, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i32 %160)
%162 = icmp sge i64 %161, 0
br i1 %162, label %163, label %174
163: ; preds = %158
%164 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%165 = call i8* @strdup(i8* %164)
%166 = load i32, i32* %20
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds [33 x i8*], [33 x i8*]* %19, i64 0, i64 %167
store i8* %165, i8** %168
%169 = icmp ne i8* %165, null
br i1 %169, label %170, label %173
170: ; preds = %163
%171 = load i32, i32* %20
%172 = add nsw i32 %171, 1
store i32 %172, i32* %20
br label %173
173: ; preds = %170, %163
br label %174
174: ; preds = %173, %158, %155
%175 = load i32, i32* %20
%176 = icmp slt i32 %175, 32
br i1 %176, label %177, label %193
177: ; preds = %174
%178 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%179 = load i32, i32* %17
%180 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %178, i32 255, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i32 %179)
%181 = icmp sge i64 %180, 0
br i1 %181, label %182, label %193
182: ; preds = %177
%183 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%184 = call i8* @strdup(i8* %183)
%185 = load i32, i32* %20
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds [33 x i8*], [33 x i8*]* %19, i64 0, i64 %186
store i8* %184, i8** %187
%188 = icmp ne i8* %184, null
br i1 %188, label %189, label %192
189: ; preds = %182
%190 = load i32, i32* %20
%191 = add nsw i32 %190, 1
store i32 %191, i32* %20
br label %192
192: ; preds = %189, %182
br label %193
193: ; preds = %192, %177, %174
%194 = load i32, i32* %20
%195 = icmp slt i32 %194, 32
br i1 %195, label %196, label %212
196: ; preds = %193
%197 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%198 = load i32, i32* %18
%199 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %197, i32 255, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i32 %198)
%200 = icmp sge i64 %199, 0
br i1 %200, label %201, label %212
201: ; preds = %196
%202 = getelementptr inbounds [255 x i8], [255 x i8]* %21, i64 0, i64 0
%203 = call i8* @strdup(i8* %202)
%204 = load i32, i32* %20
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds [33 x i8*], [33 x i8*]* %19, i64 0, i64 %205
store i8* %203, i8** %206
%207 = icmp ne i8* %203, null
br i1 %207, label %208, label %211
208: ; preds = %201
%209 = load i32, i32* %20
%210 = add nsw i32 %209, 1
store i32 %210, i32* %20
br label %211
211: ; preds = %208, %201
br label %212
212: ; preds = %211, %196, %193
%213 = load i32, i32* %20
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds [33 x i8*], [33 x i8*]* %19, i64 0, i64 %214
store i8* null, i8** %215
%216 = getelementptr inbounds [33 x i8*], [33 x i8*]* %19, i64 0, i64 0
%217 = call i32 @run_trigger_program(i8** %216)
%218 = getelementptr inbounds [33 x i8*], [33 x i8*]* %19, i64 0, i64 0
store i8** %218, i8*** %22
br label %219
219: ; preds = %223, %212
%220 = load i8**, i8*** %22
%221 = load i8*, i8** %220
%222 = icmp ne i8* %221, null
br i1 %222, label %223, label %229
223: ; preds = %219
%224 = load i8**, i8*** %22
%225 = load i8*, i8** %224
%226 = call i32 @free(i8* %225)
%227 = load i8**, i8*** %22
%228 = getelementptr inbounds i8*, i8** %227, i32 1
store i8** %228, i8*** %22
br label %219
229: ; preds = %219
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"run_partition_trigger() called\00"
@.str.1 = [20 x i8] c"ALARM_EVENT_TYPE=%s\00"
@.str.2 = [10 x i8] c"partition\00"
@.str.3 = [22 x i8] c"ALARM_EVENT_STATUS=%s\00"
@.str.4 = [25 x i8] c"ALARM_EVENT_PARTITION=%d\00"
@.str.5 = [31 x i8] c"ALARM_EVENT_PARTITION_ARMED=%d\00"
@.str.6 = [31 x i8] c"ALARM_EVENT_PARTITION_READY=%d\00"
@.str.7 = [30 x i8] c"ALARM_EVENT_PARTITION_STAY=%d\00"
@.str.8 = [31 x i8] c"ALARM_EVENT_PARTITION_CHIME=%d\00"
@.str.9 = [31 x i8] c"ALARM_EVENT_PARTITION_ENTRY=%d\00"
@.str.10 = [30 x i8] c"ALARM_EVENT_PARTITION_EXIT=%d\00"
@.str.11 = [31 x i8] c"ALARM_EVENT_PARTITION_ALARM=%d\00"
define void @run_partition_trigger(i32 %0, i8* %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8) {
%10 = alloca [33 x i8*]
%11 = alloca [255 x i8]
%12 = bitcast [33 x i8*]* %10 to i8*
%13 = getelementptr inbounds [255 x i8], [255 x i8]* %11, i64 0, i64 0
%14 = tail call i32 @logmsg(i32 3, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%15 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %13, i32 255, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp sgt i64 %15, -1
br i1 %16, label %17, label %22
17: ; preds = %9
%18 = call i8* @strdup(i8* %13)
%19 = getelementptr inbounds [33 x i8*], [33 x i8*]* %10, i64 0, i64 0
store i8* %18, i8** %19
%20 = icmp ne i8* %18, null
%21 = zext i1 %20 to i32
br label %22
22: ; preds = %17, %9
%23 = phi i32 [ 0, %9 ], [ %21, %17 ]
%24 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %13, i32 255, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%25 = icmp sgt i64 %24, -1
br i1 %25, label %26, label %33
26: ; preds = %22
%27 = call i8* @strdup(i8* %13)
%28 = zext i32 %23 to i64
%29 = getelementptr inbounds [33 x i8*], [33 x i8*]* %10, i64 0, i64 %28
store i8* %27, i8** %29
%30 = icmp ne i8* %27, null
%31 = zext i1 %30 to i32
%32 = add nuw nsw i32 %23, %31
br label %33
33: ; preds = %26, %22
%34 = phi i32 [ %23, %22 ], [ %32, %26 ]
%35 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %13, i32 255, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %0)
%36 = icmp sgt i64 %35, -1
br i1 %36, label %37, label %44
37: ; preds = %33
%38 = call i8* @strdup(i8* %13)
%39 = zext i32 %34 to i64
%40 = getelementptr inbounds [33 x i8*], [33 x i8*]* %10, i64 0, i64 %39
store i8* %38, i8** %40
%41 = icmp ne i8* %38, null
%42 = zext i1 %41 to i32
%43 = add nuw nsw i32 %34, %42
br label %44
44: ; preds = %37, %33
%45 = phi i32 [ %34, %33 ], [ %43, %37 ]
%46 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %13, i32 255, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i32 %2)
%47 = icmp sgt i64 %46, -1
br i1 %47, label %48, label %55
48: ; preds = %44
%49 = call i8* @strdup(i8* %13)
%50 = zext i32 %45 to i64
%51 = getelementptr inbounds [33 x i8*], [33 x i8*]* %10, i64 0, i64 %50
store i8* %49, i8** %51
%52 = icmp ne i8* %49, null
%53 = zext i1 %52 to i32
%54 = add nuw nsw i32 %45, %53
br label %55
55: ; preds = %48, %44
%56 = phi i32 [ %45, %44 ], [ %54, %48 ]
%57 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %13, i32 255, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 %3)
%58 = icmp sgt i64 %57, -1
br i1 %58, label %59, label %66
59: ; preds = %55
%60 = call i8* @strdup(i8* %13)
%61 = zext i32 %56 to i64
%62 = getelementptr inbounds [33 x i8*], [33 x i8*]* %10, i64 0, i64 %61
store i8* %60, i8** %62
%63 = icmp ne i8* %60, null
%64 = zext i1 %63 to i32
%65 = add nuw nsw i32 %56, %64
br label %66
66: ; preds = %59, %55
%67 = phi i32 [ %56, %55 ], [ %65, %59 ]
%68 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %13, i32 255, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i32 %4)
%69 = icmp sgt i64 %68, -1
br i1 %69, label %70, label %77
70: ; preds = %66
%71 = call i8* @strdup(i8* %13)
%72 = zext i32 %67 to i64
%73 = getelementptr inbounds [33 x i8*], [33 x i8*]* %10, i64 0, i64 %72
store i8* %71, i8** %73
%74 = icmp ne i8* %71, null
%75 = zext i1 %74 to i32
%76 = add nuw nsw i32 %67, %75
br label %77
77: ; preds = %70, %66
%78 = phi i32 [ %67, %66 ], [ %76, %70 ]
%79 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %13, i32 255, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i32 %5)
%80 = icmp sgt i64 %79, -1
br i1 %80, label %81, label %88
81: ; preds = %77
%82 = call i8* @strdup(i8* %13)
%83 = zext i32 %78 to i64
%84 = getelementptr inbounds [33 x i8*], [33 x i8*]* %10, i64 0, i64 %83
store i8* %82, i8** %84
%85 = icmp ne i8* %82, null
%86 = zext i1 %85 to i32
%87 = add nuw nsw i32 %78, %86
br label %88
88: ; preds = %81, %77
%89 = phi i32 [ %78, %77 ], [ %87, %81 ]
%90 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %13, i32 255, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i32 %6)
%91 = icmp sgt i64 %90, -1
br i1 %91, label %92, label %99
92: ; preds = %88
%93 = call i8* @strdup(i8* %13)
%94 = zext i32 %89 to i64
%95 = getelementptr inbounds [33 x i8*], [33 x i8*]* %10, i64 0, i64 %94
store i8* %93, i8** %95
%96 = icmp ne i8* %93, null
%97 = zext i1 %96 to i32
%98 = add nuw nsw i32 %89, %97
br label %99
99: ; preds = %92, %88
%100 = phi i32 [ %89, %88 ], [ %98, %92 ]
%101 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %13, i32 255, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.10, i64 0, i64 0), i32 %7)
%102 = icmp sgt i64 %101, -1
br i1 %102, label %103, label %110
103: ; preds = %99
%104 = call i8* @strdup(i8* %13)
%105 = zext i32 %100 to i64
%106 = getelementptr inbounds [33 x i8*], [33 x i8*]* %10, i64 0, i64 %105
store i8* %104, i8** %106
%107 = icmp ne i8* %104, null
%108 = zext i1 %107 to i32
%109 = add nuw nsw i32 %100, %108
br label %110
110: ; preds = %103, %99
%111 = phi i32 [ %100, %99 ], [ %109, %103 ]
%112 = call i64 (i8*, i32, i8*, ...) @snprintf(i8* %13, i32 255, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i32 %8)
%113 = icmp sgt i64 %112, -1
br i1 %113, label %114, label %121
114: ; preds = %110
%115 = call i8* @strdup(i8* %13)
%116 = zext i32 %111 to i64
%117 = getelementptr inbounds [33 x i8*], [33 x i8*]* %10, i64 0, i64 %116
store i8* %115, i8** %117
%118 = icmp ne i8* %115, null
%119 = zext i1 %118 to i32
%120 = add nuw nsw i32 %111, %119
br label %121
121: ; preds = %114, %110
%122 = phi i32 [ %111, %110 ], [ %120, %114 ]
%123 = zext i32 %122 to i64
%124 = getelementptr inbounds [33 x i8*], [33 x i8*]* %10, i64 0, i64 %123
store i8* null, i8** %124
%125 = getelementptr inbounds [33 x i8*], [33 x i8*]* %10, i64 0, i64 0
%126 = call i32 @run_trigger_program(i8** %125)
%127 = load i8*, i8** %125
%128 = icmp eq i8* %127, null
br i1 %128, label %136, label %129
129: ; preds = %121, %129
%130 = phi i8* [ %134, %129 ], [ %127, %121 ]
%131 = phi i8** [ %133, %129 ], [ %125, %121 ]
%132 = call i32 @free(i8* %130)
%133 = getelementptr inbounds i8*, i8** %131, i64 1
%134 = load i8*, i8** %133
%135 = icmp eq i8* %134, null
br i1 %135, label %136, label %129
136: ; preds = %129, %121
ret void
}