#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*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int LOG_CONS;
int LOG_INFO;
int LOG_PERROR;
int LOG_PID;
int /*<<< orphan*/ LOG_USER;
int getopt(int, char **, char *);
int /*<<< orphan*/ helpAndLeave(char *, int /*<<< orphan*/);
int /*<<< orphan*/ openlog(char *, int, int /*<<< orphan*/);
char *optarg;
scalar_t__ opterr;
size_t optind;
int parse_level(char *, int *);
int /*<<< orphan*/ syslog(int, char *, char *);
int main(int argc, char *argv[]) {
  if (argc < 2)
    helpAndLeave(argv[0], EXIT_FAILURE);
  int opt;
  int level = (LOG_INFO);
  char *ident = ("_LOGGER");
  char *message;
  opterr = 0;
  while ((opt = getopt(argc, argv, "+i:l:")) != -1) {
    switch (opt) {
    case '?':
      helpAndLeave(argv[0], EXIT_FAILURE);
      break;
    case 'i':
      ident = optarg;
      break;
    case 'l':
      if ((parse_level(optarg, &level)) == -1)
        helpAndLeave(argv[0], EXIT_FAILURE);
      break;
    }
  }
  message = argv[optind];
  if (message == NULL)
    helpAndLeave(argv[0], EXIT_FAILURE);
  openlog(ident, LOG_CONS | LOG_PID | LOG_PERROR, LOG_USER);
  syslog(level, "%s", message);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1185 <main+0x35>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    0x2e32(%rip),%rax
mov    (%rax),%esi
call   1050 <helpAndLeave@plt>
mov    0x2e0c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
lea    0xe68(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2e05(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe50(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1267 <main+0x117>
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x3f,%eax
je     11ff <main+0xaf>
jmp    11dd <main+0x8d>
mov    -0x2c(%rbp),%eax
sub    $0x69,%eax
je     1219 <main+0xc9>
jmp    11ee <main+0x9e>
mov    -0x2c(%rbp),%eax
sub    $0x6c,%eax
je     122c <main+0xdc>
jmp    1262 <main+0x112>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    0x2da3(%rip),%rax
mov    (%rax),%esi
call   1050 <helpAndLeave@plt>
jmp    1262 <main+0x112>
mov    0x2dd8(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    1262 <main+0x112>
mov    0x2dc5(%rip),%rax
mov    (%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <parse_level@plt>
cmp    $0xffffffff,%eax
jne    125d <main+0x10d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    0x2d5a(%rip),%rax
mov    (%rax),%esi
call   1050 <helpAndLeave@plt>
jmp    1262 <main+0x112>
jmp    11aa <main+0x5a>
mov    -0x10(%rbp),%rax
mov    0x2d66(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    129d <main+0x14d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    0x2d1a(%rip),%rax
mov    (%rax),%esi
call   1050 <helpAndLeave@plt>
mov    -0x20(%rbp),%rdi
mov    0x2d10(%rip),%rax
mov    (%rax),%esi
mov    0x2d0f(%rip),%rax
or     (%rax),%esi
mov    0x2d16(%rip),%rax
or     (%rax),%esi
mov    0x2d1d(%rip),%rax
mov    (%rax),%edx
call   1070 <openlog@plt>
mov    -0x18(%rbp),%edi
mov    -0x28(%rbp),%rdx
lea    0xd36(%rip),%rsi
call   1040 <syslog@plt>
mov    0x2cbc(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
cmp    $0x1,%edi
jg     1179 <main+0x29>
mov    (%rbx),%rdi
mov    0x2e3e(%rip),%rax
mov    (%rax),%esi
call   1050 <helpAndLeave@plt>
mov    0x2e18(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x2e1b(%rip),%rax
movq   $0x0,(%rax)
lea    0xe65(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xe61(%rip),%r15
mov    0x2e02(%rip),%r13
mov    0x2e43(%rip),%r14
lea    0xc(%rsp),%r12
jmp    11d1 <main+0x81>
nopl   0x0(%rax)
cmp    $0x3f,%eax
jne    11fa <main+0xaa>
mov    (%rbx),%rdi
mov    0x0(%r13),%esi
call   1050 <helpAndLeave@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1060 <getopt@plt>
cmp    $0x68,%eax
jle    11c0 <main+0x70>
cmp    $0x6c,%eax
jne    1201 <main+0xb1>
mov    (%r14),%rdi
mov    %r12,%rsi
call   1030 <parse_level@plt>
cmp    $0xffffffff,%eax
jne    11d1 <main+0x81>
jmp    11c5 <main+0x75>
cmp    $0xffffffff,%eax
jne    11d1 <main+0x81>
jmp    1210 <main+0xc0>
cmp    $0x69,%eax
jne    11d1 <main+0x81>
mov    (%r14),%rax
mov    %rax,0x10(%rsp)
jmp    11d1 <main+0x81>
mov    0x2dc1(%rip),%rax
mov    (%rax),%rax
mov    (%rbx,%rax,8),%rbp
test   %rbp,%rbp
jne    122f <main+0xdf>
mov    (%rbx),%rdi
mov    0x0(%r13),%esi
call   1050 <helpAndLeave@plt>
mov    0x2d82(%rip),%rax
mov    0x2d83(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2d88(%rip),%rax
or     (%rax),%esi
mov    0x2d8f(%rip),%rax
mov    (%rax),%edx
mov    0x10(%rsp),%rdi
call   1070 <openlog@plt>
mov    0xc(%rsp),%edi
lea    0xda6(%rip),%rsi
mov    %rbp,%rdx
call   1040 <syslog@plt>
mov    0x2d29(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@LOG_INFO = global i32 0
@.str = [8 x i8] c"_LOGGER\00"
@opterr = global i64 0
@.str.1 = [6 x i8] c"+i:l:\00"
@optarg = global i8* null
@optind = global i64 0
@LOG_CONS = global i32 0
@LOG_PID = global i32 0
@LOG_PERROR = global i32 0
@LOG_USER = global i32 0
@.str.2 = [3 x i8] c"%s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = load i32, i32* @EXIT_FAILURE
%17 = call i32 @helpAndLeave(i8* %15, i32 %16)
br label %18
18: ; preds = %12, %2
%19 = load i32, i32* @LOG_INFO
store i32 %19, i32* %7
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %8
store i64 0, i64* @opterr
br label %20
20: ; preds = %46, %18
%21 = load i32, i32* %4
%22 = load i8**, i8*** %5
%23 = call i32 @getopt(i32 %21, i8** %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i32 %23, i32* %6
%24 = icmp ne i32 %23, -1
br i1 %24, label %25, label %47
25: ; preds = %20
%26 = load i32, i32* %6
switch i32 %26, label %46 [
i32 63, label %27
i32 105, label %33
i32 108, label %35
]
27: ; preds = %25
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
%31 = load i32, i32* @EXIT_FAILURE
%32 = call i32 @helpAndLeave(i8* %30, i32 %31)
br label %46
33: ; preds = %25
%34 = load i8*, i8** @optarg
store i8* %34, i8** %8
br label %46
35: ; preds = %25
%36 = load i8*, i8** @optarg
%37 = call i32 @parse_level(i8* %36, i32* %7)
%38 = icmp eq i32 %37, -1
br i1 %38, label %39, label %45
39: ; preds = %35
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 0
%42 = load i8*, i8** %41
%43 = load i32, i32* @EXIT_FAILURE
%44 = call i32 @helpAndLeave(i8* %42, i32 %43)
br label %45
45: ; preds = %39, %35
br label %46
46: ; preds = %25, %45, %33, %27
br label %20
47: ; preds = %20
%48 = load i8**, i8*** %5
%49 = load i64, i64* @optind
%50 = getelementptr inbounds i8*, i8** %48, i64 %49
%51 = load i8*, i8** %50
store i8* %51, i8** %9
%52 = load i8*, i8** %9
%53 = icmp eq i8* %52, null
br i1 %53, label %54, label %60
54: ; preds = %47
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 0
%57 = load i8*, i8** %56
%58 = load i32, i32* @EXIT_FAILURE
%59 = call i32 @helpAndLeave(i8* %57, i32 %58)
br label %60
60: ; preds = %54, %47
%61 = load i8*, i8** %8
%62 = load i32, i32* @LOG_CONS
%63 = load i32, i32* @LOG_PID
%64 = or i32 %62, %63
%65 = load i32, i32* @LOG_PERROR
%66 = or i32 %64, %65
%67 = load i32, i32* @LOG_USER
%68 = call i32 @openlog(i8* %61, i32 %66, i32 %67)
%69 = load i32, i32* %7
%70 = load i8*, i8** %9
%71 = call i32 @syslog(i32 %69, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %70)
%72 = load i32, i32* @EXIT_SUCCESS
ret i32 %72
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@LOG_INFO = global i32 0
@.str = [8 x i8] c"_LOGGER\00"
@opterr = global i64 0
@.str.1 = [6 x i8] c"+i:l:\00"
@optarg = global i8* null
@optind = global i64 0
@LOG_CONS = global i32 0
@LOG_PID = global i32 0
@LOG_PERROR = global i32 0
@LOG_USER = global i32 0
@.str.2 = [3 x i8] c"%s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @helpAndLeave(i8* %6, i32 %7)
br label %9
9: ; preds = %5, %2
%10 = bitcast i32* %3 to i8*
%11 = load i32, i32* @LOG_INFO
store i32 %11, i32* %3
store i64 0, i64* @opterr
br label %12
12: ; preds = %21, %9
%13 = phi i8* [ %22, %21 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %9 ]
br label %14
14: ; preds = %16, %12
%15 = call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
switch i32 %15, label %16 [
i32 -1, label %31
i32 63, label %17
i32 105, label %21
i32 108, label %23
]
16: ; preds = %14, %23, %27, %17
br label %14
17: ; preds = %14
%18 = load i8*, i8** %1
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @helpAndLeave(i8* %18, i32 %19)
br label %16
21: ; preds = %14
%22 = load i8*, i8** @optarg
br label %12
23: ; preds = %14
%24 = load i8*, i8** @optarg
%25 = call i32 @parse_level(i8* %24, i32* %3)
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %16
27: ; preds = %23
%28 = load i8*, i8** %1
%29 = load i32, i32* @EXIT_FAILURE
%30 = call i32 @helpAndLeave(i8* %28, i32 %29)
br label %16
31: ; preds = %14
%32 = load i64, i64* @optind
%33 = getelementptr inbounds i8*, i8** %1, i64 %32
%34 = load i8*, i8** %33
%35 = icmp eq i8* %34, null
br i1 %35, label %36, label %40
36: ; preds = %31
%37 = load i8*, i8** %1
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @helpAndLeave(i8* %37, i32 %38)
br label %40
40: ; preds = %36, %31
%41 = load i32, i32* @LOG_CONS
%42 = load i32, i32* @LOG_PID
%43 = or i32 %42, %41
%44 = load i32, i32* @LOG_PERROR
%45 = or i32 %43, %44
%46 = load i32, i32* @LOG_USER
%47 = call i32 @openlog(i8* %13, i32 %45, i32 %46)
%48 = load i32, i32* %3
%49 = call i32 @syslog(i32 %48, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %34)
%50 = load i32, i32* @EXIT_SUCCESS
ret i32 %50
}