#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_zone_trigger(int zonenum, const char *zonename, int fault, int bypass,
                      int trouble, int tamper, int armed,
                      const char *zonestatus) {
  char *env[32 + 1];
  int envc = 0;
  char tmp[255], **e;
  logmsg(3, "run_zone_trigger() called");
  if (envc < 32 &&
      snprintf(tmp, sizeof(tmp), "ALARM_EVENT_TYPE=%s", "zone") >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  if (envc < 32 &&
      snprintf(tmp, sizeof(tmp), "ALARM_EVENT_STATUS=%s", zonestatus) >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  if (envc < 32 &&
      snprintf(tmp, sizeof(tmp), "ALARM_EVENT_ZONE=%d", zonenum) >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  if (envc < 32 &&
      snprintf(tmp, sizeof(tmp), "ALARM_EVENT_ZONE_NAME=%s", zonename) >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  if (envc < 32 &&
      snprintf(tmp, sizeof(tmp), "ALARM_EVENT_ZONE_FAULT=%d", fault) >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  if (envc < 32 &&
      snprintf(tmp, sizeof(tmp), "ALARM_EVENT_ZONE_TROUBLE=%d", trouble) >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  if (envc < 32 &&
      snprintf(tmp, sizeof(tmp), "ALARM_EVENT_ZONE_TAMPER=%d", tamper) >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  if (envc < 32 &&
      snprintf(tmp, sizeof(tmp), "ALARM_EVENT_ZONE_BYPASS=%d", bypass) >= 0) {
    if ((env[envc] = strdup(tmp)) != NULL)
      envc++;
  };
  if (envc < 32 &&
      snprintf(tmp, sizeof(tmp), "ALARM_EVENT_ZONE_ARMED=%d", armed) >= 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_zone_trigger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
mov    0x18(%rbp),%rax
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    0xe73(%rip),%rsi
call   1050 <logmsg@plt>
cmpl   $0x20,-0x134(%rbp)
jge    1203 <run_zone_trigger+0xb3>
lea    -0x240(%rbp),%rdi
mov    $0xff,%esi
lea    0xe68(%rip),%rdx
lea    0xe75(%rip),%rcx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     1203 <run_zone_trigger+0xb3>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     11fe <run_zone_trigger+0xae>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    1203 <run_zone_trigger+0xb3>
cmpl   $0x20,-0x134(%rbp)
jge    1271 <run_zone_trigger+0x121>
lea    -0x240(%rbp),%rdi
mov    0x18(%rbp),%rcx
mov    $0xff,%esi
lea    0xe0c(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     1271 <run_zone_trigger+0x121>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     126c <run_zone_trigger+0x11c>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    1271 <run_zone_trigger+0x121>
cmpl   $0x20,-0x134(%rbp)
jge    12de <run_zone_trigger+0x18e>
lea    -0x240(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0xff,%esi
lea    0xdb5(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     12de <run_zone_trigger+0x18e>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     12d9 <run_zone_trigger+0x189>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    12de <run_zone_trigger+0x18e>
cmpl   $0x20,-0x134(%rbp)
jge    134c <run_zone_trigger+0x1fc>
lea    -0x240(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    $0xff,%esi
lea    0xd5b(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     134c <run_zone_trigger+0x1fc>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     1347 <run_zone_trigger+0x1f7>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    134c <run_zone_trigger+0x1fc>
cmpl   $0x20,-0x134(%rbp)
jge    13b9 <run_zone_trigger+0x269>
lea    -0x240(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    $0xff,%esi
lea    0xd07(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     13b9 <run_zone_trigger+0x269>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     13b4 <run_zone_trigger+0x264>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    13b9 <run_zone_trigger+0x269>
cmpl   $0x20,-0x134(%rbp)
jge    1426 <run_zone_trigger+0x2d6>
lea    -0x240(%rbp),%rdi
mov    -0x1c(%rbp),%ecx
mov    $0xff,%esi
lea    0xcb4(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     1426 <run_zone_trigger+0x2d6>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     1421 <run_zone_trigger+0x2d1>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    1426 <run_zone_trigger+0x2d6>
cmpl   $0x20,-0x134(%rbp)
jge    1493 <run_zone_trigger+0x343>
lea    -0x240(%rbp),%rdi
mov    -0x20(%rbp),%ecx
mov    $0xff,%esi
lea    0xc63(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     1493 <run_zone_trigger+0x343>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     148e <run_zone_trigger+0x33e>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    1493 <run_zone_trigger+0x343>
cmpl   $0x20,-0x134(%rbp)
jge    1500 <run_zone_trigger+0x3b0>
lea    -0x240(%rbp),%rdi
mov    -0x18(%rbp),%ecx
mov    $0xff,%esi
lea    0xc11(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     1500 <run_zone_trigger+0x3b0>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     14fb <run_zone_trigger+0x3ab>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    1500 <run_zone_trigger+0x3b0>
cmpl   $0x20,-0x134(%rbp)
jge    156d <run_zone_trigger+0x41d>
lea    -0x240(%rbp),%rdi
mov    0x10(%rbp),%ecx
mov    $0xff,%esi
lea    0xbbf(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
cmp    $0x0,%rax
jl     156d <run_zone_trigger+0x41d>
lea    -0x240(%rbp),%rdi
call   1070 <strdup@plt>
movslq -0x134(%rbp),%rcx
mov    %rax,-0x130(%rbp,%rcx,8)
ff
cmp    $0x0,%rax
je     1568 <run_zone_trigger+0x418>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    156d <run_zone_trigger+0x41d>
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     15d1 <run_zone_trigger+0x481>
mov    -0x248(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x248(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x248(%rbp)
jmp    159a <run_zone_trigger+0x44a>
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_zone_trigger>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x218,%rsp
mov    %r9d,0x8(%rsp)
mov    %r8d,%r12d
mov    %ecx,0xc(%rsp)
mov    %edx,%r13d
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x258(%rsp),%r14
lea    0xe7c(%rip),%rsi
mov    $0x3,%edi
call   1050 <logmsg@plt>
lea    0xe85(%rip),%rdx
lea    0xe92(%rip),%rcx
xor    %r15d,%r15d
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     11d1 <run_zone_trigger+0x81>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %rax,0x110(%rsp)
xor    %r15d,%r15d
test   %rax,%rax
setne  %r15b
lea    0xe5b(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     120e <run_zone_trigger+0xbe>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %r15d,%ecx
mov    %rax,0x110(%rsp,%rcx,8)
cmp    $0x1,%rax
sbb    $0xffffffff,%r15d
lea    0xe34(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     124a <run_zone_trigger+0xfa>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %r15d,%ecx
mov    %rax,0x110(%rsp,%rcx,8)
cmp    $0x1,%rax
sbb    $0xffffffff,%r15d
lea    0xe0c(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     1287 <run_zone_trigger+0x137>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %r15d,%ecx
mov    %rax,0x110(%rsp,%rcx,8)
cmp    $0x1,%rax
sbb    $0xffffffff,%r15d
lea    0xde8(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
mov    %r13d,%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     12c4 <run_zone_trigger+0x174>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %r15d,%ecx
mov    %rax,0x110(%rsp,%rcx,8)
cmp    $0x1,%rax
sbb    $0xffffffff,%r15d
lea    0xdc5(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
mov    %r12d,%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     1301 <run_zone_trigger+0x1b1>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %r15d,%ecx
mov    %rax,0x110(%rsp,%rcx,8)
cmp    $0x1,%rax
sbb    $0xffffffff,%r15d
lea    0xda4(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
mov    0x8(%rsp),%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     133f <run_zone_trigger+0x1ef>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %r15d,%ecx
mov    %rax,0x110(%rsp,%rcx,8)
cmp    $0x1,%rax
sbb    $0xffffffff,%r15d
mov    0x250(%rsp),%ebx
lea    0xd7a(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
mov    0xc(%rsp),%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     1384 <run_zone_trigger+0x234>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %r15d,%ecx
mov    %rax,0x110(%rsp,%rcx,8)
cmp    $0x1,%rax
sbb    $0xffffffff,%r15d
lea    0xd57(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0xff,%esi
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
test   %rax,%rax
js     13c0 <run_zone_trigger+0x270>
lea    0x10(%rsp),%rdi
call   1070 <strdup@plt>
mov    %r15d,%ecx
mov    %rax,0x110(%rsp,%rcx,8)
cmp    $0x1,%rax
sbb    $0xffffffff,%r15d
mov    %r15d,%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     1411 <run_zone_trigger+0x2c1>
lea    0x118(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1400 <run_zone_trigger+0x2b0>
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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