#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 */
int /*<<< orphan*/ aquire_transport();
int /*<<< orphan*/ exec_behaviour(int /*<<< orphan*/);
int get_argument_as_int(char);
int /*<<< orphan*/ init_arguments(int, char **);
int /*<<< orphan*/ init_behaviour(int /*<<< orphan*/);
int /*<<< orphan*/ init_daemon();
int /*<<< orphan*/ init_transport();
int /*<<< orphan*/ post_behaviour();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ publish_transport(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  init_arguments(argc, argv);
  init_behaviour(init_transport());
  int loops = get_argument_as_int('l');
  init_daemon();
  printf("^C to exit\n");
  do {
    publish_transport(exec_behaviour(aquire_transport()));
    ;
    post_behaviour();
  } while (--loops);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1090 <init_arguments@plt>
mov    $0x0,%al
call   1080 <init_transport@plt>
mov    %eax,%edi
call   10a0 <init_behaviour@plt>
mov    $0x6c,%edi
call   10c0 <get_argument_as_int@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <init_daemon@plt>
lea    0xe15(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <aquire_transport@plt>
mov    %eax,%edi
call   1040 <exec_behaviour@plt>
mov    %eax,%edi
call   10b0 <publish_transport@plt>
mov    $0x0,%al
call   1070 <post_behaviour@plt>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jne    11f0 <main+0x50>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
call   1090 <init_arguments@plt>
xor    %eax,%eax
call   1080 <init_transport@plt>
mov    %eax,%edi
call   10a0 <init_behaviour@plt>
mov    $0x6c,%edi
call   10c0 <get_argument_as_int@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <init_daemon@plt>
lea    0xe32(%rip),%rdi
call   1040 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1060 <aquire_transport@plt>
mov    %eax,%edi
call   1050 <exec_behaviour@plt>
mov    %eax,%edi
call   10b0 <publish_transport@plt>
xor    %eax,%eax
call   1070 <post_behaviour@plt>
add    $0xffffffff,%ebx
jne    11e0 <main+0x40>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"^C to exit\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i32 @init_arguments(i32 %7, i8** %8)
%10 = call i32 (...) @init_transport()
%11 = call i32 @init_behaviour(i32 %10)
%12 = call i32 @get_argument_as_int(i8 signext 108)
store i32 %12, i32* %6
%13 = call i32 (...) @init_daemon()
%14 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %20, %2
%16 = call i32 (...) @aquire_transport()
%17 = call i32 @exec_behaviour(i32 %16)
%18 = call i32 @publish_transport(i32 %17)
%19 = call i32 (...) @post_behaviour()
br label %20
20: ; preds = %15
%21 = load i32, i32* %6
%22 = add nsw i32 %21, -1
store i32 %22, i32* %6
%23 = icmp ne i32 %22, 0
br i1 %23, label %15, label %24
24: ; preds = %20
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@str = [11 x i8] c"^C to exit\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @init_arguments(i32 %0, i8** %1)
%4 = tail call i32 (...) @init_transport()
%5 = tail call i32 @init_behaviour(i32 %4)
%6 = tail call i32 @get_argument_as_int(i8 signext 108)
%7 = tail call i32 (...) @init_daemon()
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %9
9: ; preds = %9, %2
%10 = phi i32 [ %6, %2 ], [ %15, %9 ]
%11 = tail call i32 (...) @aquire_transport()
%12 = tail call i32 @exec_behaviour(i32 %11)
%13 = tail call i32 @publish_transport(i32 %12)
%14 = tail call i32 (...) @post_behaviour()
%15 = add nsw i32 %10, -1
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %9
17: ; preds = %9
ret i32 0
}