#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*/ oldname;
typedef int /*<<< orphan*/ newname;
typedef int /*<<< orphan*/ event;
typedef int /*<<< orphan*/ channel;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char *get_line();
int /*<<< orphan*/ hangup_chan(char *);
int /*<<< orphan*/ offhook_chan(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcasecmp(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncasecmp(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int wait_event(void) {
  char *resp;
  char event[120] = "";
  char channel[120] = "";
  char oldname[120] = "";
  char newname[120] = "";
  resp = get_line();
  if (!resp) {
    fprintf(stderr, "disconnected (6)\n");
    return -1;
  }
  if (!strncasecmp(resp, "Event: ", strlen("Event: "))) {
    strncpy(event, resp + strlen("Event: "), sizeof(event) - 1);
    while ((resp = get_line()) && strlen(resp)) {
      if (!strncasecmp(resp, "Channel: ", strlen("Channel: ")))
        strncpy(channel, resp + strlen("Channel: "), sizeof(channel) - 1);
      if (!strncasecmp(resp, "Newname: ", strlen("Newname: ")))
        strncpy(newname, resp + strlen("Newname: "), sizeof(newname) - 1);
      if (!strncasecmp(resp, "Oldname: ", strlen("Oldname: ")))
        strncpy(oldname, resp + strlen("Oldname: "), sizeof(oldname) - 1);
    }
    if (strlen(channel)) {
      if (!strcasecmp(event, "Hangup"))
        hangup_chan(channel);
      else
        offhook_chan(channel);
    }
    if (strlen(newname) && strlen(oldname)) {
      if (!strcasecmp(event, "Rename")) {
        hangup_chan(oldname);
        offhook_chan(newname);
      }
    }
  } else {
    while ((resp = get_line()) && strlen(resp))
      ;
  }
  if (!resp) {
    fprintf(stderr, "disconnected (7)\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<wait_event>:
push   %rbp
mov    %rsp,%rbp
sub    $0x280,%rsp
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x78,%edx
call   1080 <memset@plt>
lea    -0x110(%rbp),%rdi
xor    %esi,%esi
mov    $0x78,%edx
call   1080 <memset@plt>
lea    -0x190(%rbp),%rdi
xor    %esi,%esi
mov    $0x78,%edx
call   1080 <memset@plt>
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x78,%edx
call   1080 <memset@plt>
mov    $0x0,%al
call   1050 <get_line@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    121e <wait_event+0x8e>
mov    0x2ddc(%rip),%rax
mov    (%rax),%edi
lea    0xdf3(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    158c <wait_event+0x3fc>
mov    -0x10(%rbp),%rax
mov    %rax,-0x218(%rbp)
lea    0xde2(%rip),%rdi
call   1070 <strlen@plt>
mov    -0x218(%rbp),%rdi
mov    %eax,%edx
lea    0xdcd(%rip),%rsi
call   10a0 <strncasecmp@plt>
cmp    $0x0,%eax
jne    1502 <wait_event+0x372>
lea    -0x90(%rbp),%rax
mov    %rax,-0x220(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x228(%rbp)
lea    0xd9f(%rip),%rdi
call   1070 <strlen@plt>
mov    -0x228(%rbp),%rsi
mov    -0x220(%rbp),%rdi
cltq
add    %rax,%rsi
mov    $0x77,%edx
call   1040 <strncpy@plt>
mov    $0x0,%al
call   1050 <get_line@plt>
mov    %rax,%rcx
mov    %rcx,-0x10(%rbp)
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x229(%rbp)
je     12ca <wait_event+0x13a>
mov    -0x10(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x0,%eax
setne  %al
mov    %al,-0x229(%rbp)
mov    -0x229(%rbp),%al
test   $0x1,%al
jne    12dd <wait_event+0x14d>
jmp    1447 <wait_event+0x2b7>
mov    -0x10(%rbp),%rax
mov    %rax,-0x238(%rbp)
lea    0xd2b(%rip),%rdi
call   1070 <strlen@plt>
mov    -0x238(%rbp),%rdi
mov    %eax,%edx
lea    0xd16(%rip),%rsi
call   10a0 <strncasecmp@plt>
cmp    $0x0,%eax
jne    1354 <wait_event+0x1c4>
lea    -0x110(%rbp),%rax
mov    %rax,-0x240(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x248(%rbp)
lea    0xce8(%rip),%rdi
call   1070 <strlen@plt>
mov    -0x248(%rbp),%rsi
mov    -0x240(%rbp),%rdi
cltq
add    %rax,%rsi
mov    $0x77,%edx
call   1040 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x250(%rbp)
lea    0xcbe(%rip),%rdi
call   1070 <strlen@plt>
mov    -0x250(%rbp),%rdi
mov    %eax,%edx
lea    0xca9(%rip),%rsi
call   10a0 <strncasecmp@plt>
cmp    $0x0,%eax
jne    13cb <wait_event+0x23b>
lea    -0x210(%rbp),%rax
mov    %rax,-0x258(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x260(%rbp)
lea    0xc7b(%rip),%rdi
call   1070 <strlen@plt>
mov    -0x260(%rbp),%rsi
mov    -0x258(%rbp),%rdi
cltq
add    %rax,%rsi
mov    $0x77,%edx
call   1040 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x268(%rbp)
lea    0xc51(%rip),%rdi
call   1070 <strlen@plt>
mov    -0x268(%rbp),%rdi
mov    %eax,%edx
lea    0xc3c(%rip),%rsi
call   10a0 <strncasecmp@plt>
cmp    $0x0,%eax
jne    1442 <wait_event+0x2b2>
lea    -0x190(%rbp),%rax
mov    %rax,-0x270(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x278(%rbp)
lea    0xc0e(%rip),%rdi
call   1070 <strlen@plt>
mov    -0x278(%rbp),%rsi
mov    -0x270(%rbp),%rdi
cltq
add    %rax,%rsi
mov    $0x77,%edx
call   1040 <strncpy@plt>
jmp    1295 <wait_event+0x105>
lea    -0x110(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x0,%eax
je     149a <wait_event+0x30a>
lea    -0x90(%rbp),%rdi
lea    0xbce(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    1489 <wait_event+0x2f9>
lea    -0x110(%rbp),%rdi
call   10b0 <hangup_chan@plt>
jmp    1495 <wait_event+0x305>
lea    -0x110(%rbp),%rdi
call   1060 <offhook_chan@plt>
jmp    149a <wait_event+0x30a>
lea    -0x210(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x0,%eax
je     14fd <wait_event+0x36d>
lea    -0x190(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x0,%eax
je     14fd <wait_event+0x36d>
lea    -0x90(%rbp),%rdi
lea    0xb6d(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    14f8 <wait_event+0x368>
lea    -0x190(%rbp),%rdi
call   10b0 <hangup_chan@plt>
lea    -0x210(%rbp),%rdi
call   1060 <offhook_chan@plt>
jmp    14fd <wait_event+0x36d>
jmp    1559 <wait_event+0x3c9>
jmp    1507 <wait_event+0x377>
mov    $0x0,%al
call   1050 <get_line@plt>
mov    %rax,%rcx
mov    %rcx,-0x10(%rbp)
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x279(%rbp)
je     153c <wait_event+0x3ac>
mov    -0x10(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x0,%eax
setne  %al
mov    %al,-0x279(%rbp)
mov    -0x279(%rbp),%al
test   $0x1,%al
jne    154f <wait_event+0x3bf>
jmp    1554 <wait_event+0x3c4>
jmp    1507 <wait_event+0x377>
jmp    1559 <wait_event+0x3c9>
cmpq   $0x0,-0x10(%rbp)
jne    1585 <wait_event+0x3f5>
mov    0x2a75(%rip),%rax
mov    (%rax),%edi
lea    0xad2(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    158c <wait_event+0x3fc>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x280,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_event>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1f8,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x1e0(%rsp)
movaps %xmm0,0x1d0(%rsp)
movaps %xmm0,0x1c0(%rsp)
movaps %xmm0,0x1b0(%rsp)
movaps %xmm0,0x1a0(%rsp)
movaps %xmm0,0x190(%rsp)
movaps %xmm0,0x180(%rsp)
movq   $0x0,0x1f0(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x70(%rsp)
movaps %xmm0,0x160(%rsp)
movaps %xmm0,0x150(%rsp)
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movq   $0x0,0x170(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movq   $0x0,0xf0(%rsp)
xor    %eax,%eax
call   1050 <get_line@plt>
test   %rax,%rax
je     12e3 <wait_event+0x163>
mov    %rax,%rbx
lea    0xd71(%rip),%rbp
mov    %rbp,%rdi
call   1070 <strlen@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
call   1090 <strncasecmp@plt>
test   %eax,%eax
je     12f8 <wait_event+0x178>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <get_line@plt>
test   %rax,%rax
je     14ba <wait_event+0x33a>
mov    %rax,%rdi
call   1070 <strlen@plt>
test   %eax,%eax
jne    12c0 <wait_event+0x140>
xor    %eax,%eax
jmp    14d4 <wait_event+0x354>
mov    0x2cf6(%rip),%rax
mov    (%rax),%edi
lea    0xd0d(%rip),%rsi
jmp    14ca <wait_event+0x34a>
lea    0xd13(%rip),%rdi
call   1070 <strlen@plt>
cltq
add    %rax,%rbx
lea    0x180(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x77,%edx
call   1040 <strncpy@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <get_line@plt>
test   %rax,%rax
je     142c <wait_event+0x2ac>
lea    0xce3(%rip),%r14
lea    0xce6(%rip),%r12
lea    0x80(%rsp),%r13
lea    0xce1(%rip),%rbp
lea    0x100(%rsp),%r15
mov    %rax,%rbx
jmp    1373 <wait_event+0x1f3>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <get_line@plt>
mov    %rax,%rbx
test   %rax,%rax
je     142a <wait_event+0x2aa>
mov    %rbx,%rdi
call   1070 <strlen@plt>
test   %eax,%eax
je     142c <wait_event+0x2ac>
mov    %r14,%rdi
call   1070 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1090 <strncasecmp@plt>
test   %eax,%eax
jne    13b7 <wait_event+0x237>
mov    %r14,%rdi
call   1070 <strlen@plt>
movslq %eax,%rsi
add    %rbx,%rsi
mov    %rsp,%rdi
mov    $0x77,%edx
call   1040 <strncpy@plt>
mov    %r12,%rdi
call   1070 <strlen@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %eax,%edx
call   1090 <strncasecmp@plt>
test   %eax,%eax
jne    13eb <wait_event+0x26b>
mov    %r12,%rdi
call   1070 <strlen@plt>
movslq %eax,%rsi
add    %rbx,%rsi
mov    %r13,%rdi
mov    $0x77,%edx
call   1040 <strncpy@plt>
mov    %rbp,%rdi
call   1070 <strlen@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
call   1090 <strncasecmp@plt>
test   %eax,%eax
jne    1360 <wait_event+0x1e0>
mov    %rbp,%rdi
call   1070 <strlen@plt>
cltq
add    %rax,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x77,%edx
call   1040 <strncpy@plt>
jmp    1360 <wait_event+0x1e0>
xor    %ebx,%ebx
mov    %rsp,%rdi
call   1070 <strlen@plt>
test   %eax,%eax
je     145f <wait_event+0x2df>
lea    0xbf9(%rip),%rsi
lea    0x180(%rsp),%rdi
call   1030 <strcasecmp@plt>
mov    %rsp,%rdi
test   %eax,%eax
je     145a <wait_event+0x2da>
call   1060 <offhook_chan@plt>
jmp    145f <wait_event+0x2df>
call   10a0 <hangup_chan@plt>
lea    0x80(%rsp),%rdi
call   1070 <strlen@plt>
test   %eax,%eax
je     14b3 <wait_event+0x333>
lea    0x100(%rsp),%rdi
call   1070 <strlen@plt>
test   %eax,%eax
je     14b3 <wait_event+0x333>
lea    0xbb7(%rip),%rsi
lea    0x180(%rsp),%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
jne    14b3 <wait_event+0x333>
lea    0x100(%rsp),%rdi
call   10a0 <hangup_chan@plt>
lea    0x80(%rsp),%rdi
call   1060 <offhook_chan@plt>
xor    %eax,%eax
test   %rbx,%rbx
jne    14d4 <wait_event+0x354>
mov    0x2b1f(%rip),%rax
mov    (%rax),%edi
lea    0xb7c(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x1f8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"disconnected (6)\0A\00"
@.str.1 = [8 x i8] c"Event: \00"
@.str.2 = [10 x i8] c"Channel: \00"
@.str.3 = [10 x i8] c"Newname: \00"
@.str.4 = [10 x i8] c"Oldname: \00"
@.str.5 = [7 x i8] c"Hangup\00"
@.str.6 = [7 x i8] c"Rename\00"
@.str.7 = [18 x i8] c"disconnected (7)\0A\00"
define i32 @wait_event() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca [120 x i8]
%4 = alloca [120 x i8]
%5 = alloca [120 x i8]
%6 = alloca [120 x i8]
%7 = bitcast [120 x i8]* %3 to i8*
%8 = bitcast [120 x i8]* %4 to i8*
%9 = bitcast [120 x i8]* %5 to i8*
%10 = bitcast [120 x i8]* %6 to i8*
%11 = call i8* (...) @get_line()
store i8* %11, i8** %2
%12 = load i8*, i8** %2
%13 = icmp ne i8* %12, null
br i1 %13, label %17, label %14
14: ; preds = %0
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %128
17: ; preds = %0
%18 = load i8*, i8** %2
%19 = call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @strncasecmp(i8* %18, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = icmp ne i32 %20, 0
br i1 %21, label %109, label %22
22: ; preds = %17
%23 = getelementptr inbounds [120 x i8], [120 x i8]* %3, i64 0, i64 0
%24 = load i8*, i8** %2
%25 = call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = call i32 @strncpy(i8* %23, i8* %27, i32 119)
br label %29
29: ; preds = %74, %22
%30 = call i8* (...) @get_line()
store i8* %30, i8** %2
%31 = icmp ne i8* %30, null
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load i8*, i8** %2
%34 = call i32 @strlen(i8* %33)
%35 = icmp ne i32 %34, 0
br label %36
36: ; preds = %32, %29
%37 = phi i1 [ false, %29 ], [ %35, %32 ]
br i1 %37, label %38, label %75
38: ; preds = %36
%39 = load i8*, i8** %2
%40 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%41 = call i32 @strncasecmp(i8* %39, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %40)
%42 = icmp ne i32 %41, 0
br i1 %42, label %50, label %43
43: ; preds = %38
%44 = getelementptr inbounds [120 x i8], [120 x i8]* %4, i64 0, i64 0
%45 = load i8*, i8** %2
%46 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %45, i64 %47
%49 = call i32 @strncpy(i8* %44, i8* %48, i32 119)
br label %50
50: ; preds = %43, %38
%51 = load i8*, i8** %2
%52 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%53 = call i32 @strncasecmp(i8* %51, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %52)
%54 = icmp ne i32 %53, 0
br i1 %54, label %62, label %55
55: ; preds = %50
%56 = getelementptr inbounds [120 x i8], [120 x i8]* %6, i64 0, i64 0
%57 = load i8*, i8** %2
%58 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %57, i64 %59
%61 = call i32 @strncpy(i8* %56, i8* %60, i32 119)
br label %62
62: ; preds = %55, %50
%63 = load i8*, i8** %2
%64 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%65 = call i32 @strncasecmp(i8* %63, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %64)
%66 = icmp ne i32 %65, 0
br i1 %66, label %74, label %67
67: ; preds = %62
%68 = getelementptr inbounds [120 x i8], [120 x i8]* %5, i64 0, i64 0
%69 = load i8*, i8** %2
%70 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8, i8* %69, i64 %71
%73 = call i32 @strncpy(i8* %68, i8* %72, i32 119)
br label %74
74: ; preds = %67, %62
br label %29
75: ; preds = %36
%76 = getelementptr inbounds [120 x i8], [120 x i8]* %4, i64 0, i64 0
%77 = call i32 @strlen(i8* %76)
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %90
79: ; preds = %75
%80 = getelementptr inbounds [120 x i8], [120 x i8]* %3, i64 0, i64 0
%81 = call i32 @strcasecmp(i8* %80, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%82 = icmp ne i32 %81, 0
br i1 %82, label %86, label %83
83: ; preds = %79
%84 = getelementptr inbounds [120 x i8], [120 x i8]* %4, i64 0, i64 0
%85 = call i32 @hangup_chan(i8* %84)
br label %89
86: ; preds = %79
%87 = getelementptr inbounds [120 x i8], [120 x i8]* %4, i64 0, i64 0
%88 = call i32 @offhook_chan(i8* %87)
br label %89
89: ; preds = %86, %83
br label %90
90: ; preds = %89, %75
%91 = getelementptr inbounds [120 x i8], [120 x i8]* %6, i64 0, i64 0
%92 = call i32 @strlen(i8* %91)
%93 = icmp ne i32 %92, 0
br i1 %93, label %94, label %108
94: ; preds = %90
%95 = getelementptr inbounds [120 x i8], [120 x i8]* %5, i64 0, i64 0
%96 = call i32 @strlen(i8* %95)
%97 = icmp ne i32 %96, 0
br i1 %97, label %98, label %108
98: ; preds = %94
%99 = getelementptr inbounds [120 x i8], [120 x i8]* %3, i64 0, i64 0
%100 = call i32 @strcasecmp(i8* %99, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%101 = icmp ne i32 %100, 0
br i1 %101, label %107, label %102
102: ; preds = %98
%103 = getelementptr inbounds [120 x i8], [120 x i8]* %5, i64 0, i64 0
%104 = call i32 @hangup_chan(i8* %103)
%105 = getelementptr inbounds [120 x i8], [120 x i8]* %6, i64 0, i64 0
%106 = call i32 @offhook_chan(i8* %105)
br label %107
107: ; preds = %102, %98
br label %108
108: ; preds = %107, %94, %90
br label %121
109: ; preds = %17
br label %110
110: ; preds = %119, %109
%111 = call i8* (...) @get_line()
store i8* %111, i8** %2
%112 = icmp ne i8* %111, null
br i1 %112, label %113, label %117
113: ; preds = %110
%114 = load i8*, i8** %2
%115 = call i32 @strlen(i8* %114)
%116 = icmp ne i32 %115, 0
br label %117
117: ; preds = %113, %110
%118 = phi i1 [ false, %110 ], [ %116, %113 ]
br i1 %118, label %119, label %120
119: ; preds = %117
br label %110
120: ; preds = %117
br label %121
121: ; preds = %120, %108
%122 = load i8*, i8** %2
%123 = icmp ne i8* %122, null
br i1 %123, label %127, label %124
124: ; preds = %121
%125 = load i32, i32* @stderr
%126 = call i32 @fprintf(i32 %125, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
store i32 -1, i32* %1
br label %128
127: ; preds = %121
store i32 0, i32* %1
br label %128
128: ; preds = %127, %124, %14
%129 = load i32, i32* %1
ret i32 %129
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"disconnected (6)\0A\00"
@.str.1 = [8 x i8] c"Event: \00"
@.str.2 = [10 x i8] c"Channel: \00"
@.str.3 = [10 x i8] c"Newname: \00"
@.str.4 = [10 x i8] c"Oldname: \00"
@.str.5 = [7 x i8] c"Hangup\00"
@.str.6 = [7 x i8] c"Rename\00"
@.str.7 = [18 x i8] c"disconnected (7)\0A\00"
define i32 @wait_event() {
%1 = alloca [120 x i8]
%2 = alloca [120 x i8]
%3 = alloca [120 x i8]
%4 = alloca [120 x i8]
%5 = getelementptr inbounds [120 x i8], [120 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [120 x i8], [120 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [120 x i8], [120 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [120 x i8], [120 x i8]* %4, i64 0, i64 0
%9 = tail call i8* (...) @get_line()
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %93
14: ; preds = %0
%15 = tail call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%16 = tail call i32 @strncasecmp(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %82
18: ; preds = %14
%19 = tail call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %9, i64 %20
%22 = call i32 @strncpy(i8* %5, i8* %21, i32 119)
%23 = call i8* (...) @get_line()
%24 = icmp eq i8* %23, null
br i1 %24, label %59, label %25
25: ; preds = %18, %56
%26 = phi i8* [ %57, %56 ], [ %23, %18 ]
%27 = call i32 @strlen(i8* %26)
%28 = icmp eq i32 %27, 0
br i1 %28, label %59, label %29
29: ; preds = %25
%30 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 @strncasecmp(i8* %26, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %29
%34 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %26, i64 %35
%37 = call i32 @strncpy(i8* %6, i8* %36, i32 119)
br label %38
38: ; preds = %33, %29
%39 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%40 = call i32 @strncasecmp(i8* %26, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %39)
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %47
42: ; preds = %38
%43 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %26, i64 %44
%46 = call i32 @strncpy(i8* %8, i8* %45, i32 119)
br label %47
47: ; preds = %42, %38
%48 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%49 = call i32 @strncasecmp(i8* %26, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %48)
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %56
51: ; preds = %47
%52 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %26, i64 %53
%55 = call i32 @strncpy(i8* %7, i8* %54, i32 119)
br label %56
56: ; preds = %51, %47
%57 = call i8* (...) @get_line()
%58 = icmp eq i8* %57, null
br i1 %58, label %59, label %25
59: ; preds = %25, %56, %18
%60 = phi i8* [ null, %18 ], [ null, %56 ], [ %26, %25 ]
%61 = call i32 @strlen(i8* %6)
%62 = icmp eq i32 %61, 0
br i1 %62, label %70, label %63
63: ; preds = %59
%64 = call i32 @strcasecmp(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%65 = icmp eq i32 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %63
%67 = call i32 @hangup_chan(i8* %6)
br label %70
68: ; preds = %63
%69 = call i32 @offhook_chan(i8* %6)
br label %70
70: ; preds = %66, %68, %59
%71 = call i32 @strlen(i8* %8)
%72 = icmp eq i32 %71, 0
br i1 %72, label %88, label %73
73: ; preds = %70
%74 = call i32 @strlen(i8* %7)
%75 = icmp eq i32 %74, 0
br i1 %75, label %88, label %76
76: ; preds = %73
%77 = call i32 @strcasecmp(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %88
79: ; preds = %76
%80 = call i32 @hangup_chan(i8* %7)
%81 = call i32 @offhook_chan(i8* %8)
br label %88
82: ; preds = %14, %85
%83 = tail call i8* (...) @get_line()
%84 = icmp eq i8* %83, null
br i1 %84, label %90, label %85
85: ; preds = %82
%86 = tail call i32 @strlen(i8* %83)
%87 = icmp eq i32 %86, 0
br i1 %87, label %93, label %82
88: ; preds = %70, %73, %79, %76
%89 = icmp eq i8* %60, null
br i1 %89, label %90, label %93
90: ; preds = %82, %88
%91 = load i32, i32* @stderr
%92 = call i32 @fprintf(i32 %91, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
br label %93
93: ; preds = %85, %88, %90, %11
%94 = phi i32 [ -1, %90 ], [ -1, %11 ], [ 0, %88 ], [ 0, %85 ]
ret i32 %94
}