#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 */
struct udev_ctrl {
  int dummy;
};
struct udev {
  int dummy;
};
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ *member_2;
  int /*<<< orphan*/ const member_1;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt_long(int, char **, char *, struct option const *,
                int /*<<< orphan*/ *);
scalar_t__ getuid();
#define no_argument 129
char *optarg;
int /*<<< orphan*/ print_help();
#define required_argument 128
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *strchr(char *, char);
int strtoul(char *, char **, int /*<<< orphan*/);
struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *, char *);
int /*<<< orphan*/ udev_ctrl_send_reload_rules(struct udev_ctrl *);
int /*<<< orphan*/ udev_ctrl_send_set_children_max(struct udev_ctrl *, int);
int /*<<< orphan*/ udev_ctrl_send_set_env(struct udev_ctrl *, char *);
int /*<<< orphan*/ udev_ctrl_send_set_log_level(struct udev_ctrl *, int);
int /*<<< orphan*/ udev_ctrl_send_start_exec_queue(struct udev_ctrl *);
int /*<<< orphan*/ udev_ctrl_send_stop_exec_queue(struct udev_ctrl *);
int /*<<< orphan*/ udev_ctrl_unref(struct udev_ctrl *);
int /*<<< orphan*/ udev_log_null(struct udev *, char *);
int util_log_priority(char *);
int udevadm_control(struct udev *udev, int argc, char *argv[]) {
  struct udev_ctrl *uctrl = NULL;
  int rc = 1;
  static const struct option options[] = {
      {"log-priority", required_argument, NULL, 'l'},
      {"stop-exec-queue", no_argument, NULL, 's'},
      {"start-exec-queue", no_argument, NULL, 'S'},
      {"reload-rules", no_argument, NULL, 'R'},
      {"property", required_argument, NULL, 'p'},
      {"env", required_argument, NULL, 'p'},
      {"children-max", required_argument, NULL, 'm'},
      {"help", no_argument, NULL, 'h'},
      {}};
  if (getuid() != 0) {
    fprintf(stderr, "root privileges required\n");
    return 1;
  }
  uctrl = udev_ctrl_new_from_socket(udev, "@/org/kernel/udev/udevd");
  if (uctrl == NULL)
    return 2;
  for (;;) {
    int option;
    int i;
    char *endp;
    option = getopt_long(argc, argv, "l:sSRp:m:h", options, NULL);
    if (option == -1)
      break;
    switch (option) {
    case 'l':
      i = util_log_priority(optarg);
      if (i < 0) {
        fprintf(stderr, "invalid number '%s'\n", optarg);
        goto exit;
      }
      if (udev_ctrl_send_set_log_level(uctrl, util_log_priority(optarg)) < 0)
        rc = 2;
      else
        rc = 0;
      break;
    case 's':
      if (udev_ctrl_send_stop_exec_queue(uctrl) < 0)
        rc = 2;
      else
        rc = 0;
      break;
    case 'S':
      if (udev_ctrl_send_start_exec_queue(uctrl) < 0)
        rc = 2;
      else
        rc = 0;
      break;
    case 'R':
      if (udev_ctrl_send_reload_rules(uctrl) < 0)
        rc = 2;
      else
        rc = 0;
      break;
    case 'p':
      if (strchr(optarg, '=') == NULL) {
        fprintf(stderr, "expect <KEY>=<value> instead of '%s'\n", optarg);
        goto exit;
      }
      if (udev_ctrl_send_set_env(uctrl, optarg) < 0)
        rc = 2;
      else
        rc = 0;
      break;
    case 'm':
      i = strtoul(optarg, &endp, 0);
      if (endp[0] != '\0' || i < 1) {
        fprintf(stderr, "invalid number '%s'\n", optarg);
        goto exit;
      }
      if (udev_ctrl_send_set_children_max(uctrl, i) < 0)
        rc = 2;
      else
        rc = 0;
      break;
    case 'h':
      print_help();
      rc = 0;
      break;
    }
  }
  if (rc == 1)
    udev_log_null(udev, "unrecognized command\n");
exit:
  udev_ctrl_unref(uctrl);
  return rc;
}


x86 assembly (clang, -O0):
<udevadm_control>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    $0x0,%al
call   1070 <getuid@plt>
cmp    $0x0,%rax
je     1256 <udevadm_control+0x56>
mov    0x2d9e(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1521 <udevadm_control+0x321>
mov    -0x10(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1040 <udev_ctrl_new_from_socket@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1281 <udevadm_control+0x81>
movl   $0x2,-0x4(%rbp)
jmp    1521 <udevadm_control+0x321>
jmp    1286 <udevadm_control+0x86>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
lea    0xe80(%rip),%rdx
lea    0x2a55(%rip),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1080 <getopt_long@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0xffffffff,-0x30(%rbp)
jne    12b7 <udevadm_control+0xb7>
jmp    14f3 <udevadm_control+0x2f3>
mov    -0x30(%rbp),%eax
add    $0xffffffae,%eax
mov    %eax,%ecx
mov    %rcx,-0x48(%rbp)
sub    $0x21,%eax
ja     14ee <udevadm_control+0x2ee>
mov    -0x48(%rbp),%rax
lea    0xd29(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d11(%rip),%rax
mov    (%rax),%rdi
call   1050 <util_log_priority@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1322 <udevadm_control+0x122>
mov    0x2cd5(%rip),%rax
mov    (%rax),%edi
mov    0x2cec(%rip),%rax
mov    (%rax),%rdx
lea    0xe09(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    1512 <udevadm_control+0x312>
mov    -0x28(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    0x2cc7(%rip),%rax
mov    (%rax),%rdi
call   1050 <util_log_priority@plt>
mov    -0x50(%rbp),%rdi
mov    %eax,%esi
call   1030 <udev_ctrl_send_set_log_level@plt>
cmp    $0x0,%eax
jge    1359 <udevadm_control+0x159>
movl   $0x2,-0x2c(%rbp)
jmp    1360 <udevadm_control+0x160>
movl   $0x0,-0x2c(%rbp)
jmp    14ee <udevadm_control+0x2ee>
mov    -0x28(%rbp),%rdi
call   10e0 <udev_ctrl_send_stop_exec_queue@plt>
cmp    $0x0,%eax
jge    1383 <udevadm_control+0x183>
movl   $0x2,-0x2c(%rbp)
jmp    138a <udevadm_control+0x18a>
movl   $0x0,-0x2c(%rbp)
jmp    14ee <udevadm_control+0x2ee>
mov    -0x28(%rbp),%rdi
call   10f0 <udev_ctrl_send_start_exec_queue@plt>
cmp    $0x0,%eax
jge    13ad <udevadm_control+0x1ad>
movl   $0x2,-0x2c(%rbp)
jmp    13b4 <udevadm_control+0x1b4>
movl   $0x0,-0x2c(%rbp)
jmp    14ee <udevadm_control+0x2ee>
mov    -0x28(%rbp),%rdi
call   10d0 <udev_ctrl_send_reload_rules@plt>
cmp    $0x0,%eax
jge    13d7 <udevadm_control+0x1d7>
movl   $0x2,-0x2c(%rbp)
jmp    13de <udevadm_control+0x1de>
movl   $0x0,-0x2c(%rbp)
jmp    14ee <udevadm_control+0x2ee>
mov    0x2c0e(%rip),%rax
mov    (%rax),%rdi
mov    $0x3d,%esi
call   1090 <strchr@plt>
cmp    $0x0,%rax
jne    1427 <udevadm_control+0x227>
mov    0x2bd0(%rip),%rax
mov    (%rax),%edi
mov    0x2be7(%rip),%rax
mov    (%rax),%rdx
lea    0xd19(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    1512 <udevadm_control+0x312>
mov    -0x28(%rbp),%rdi
mov    0x2bc6(%rip),%rax
mov    (%rax),%rsi
call   10c0 <udev_ctrl_send_set_env@plt>
cmp    $0x0,%eax
jge    144f <udevadm_control+0x24f>
movl   $0x2,-0x2c(%rbp)
jmp    1456 <udevadm_control+0x256>
movl   $0x0,-0x2c(%rbp)
jmp    14ee <udevadm_control+0x2ee>
mov    0x2b96(%rip),%rax
mov    (%rax),%rdi
lea    -0x40(%rbp),%rsi
xor    %edx,%edx
call   1100 <strtoul@plt>
mov    %eax,-0x34(%rbp)
mov    -0x40(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    148d <udevadm_control+0x28d>
cmpl   $0x1,-0x34(%rbp)
jge    14b3 <udevadm_control+0x2b3>
mov    0x2b44(%rip),%rax
mov    (%rax),%edi
mov    0x2b5b(%rip),%rax
mov    (%rax),%rdx
lea    0xc78(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    1512 <udevadm_control+0x312>
mov    -0x28(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   10a0 <udev_ctrl_send_set_children_max@plt>
cmp    $0x0,%eax
jge    14d4 <udevadm_control+0x2d4>
movl   $0x2,-0x2c(%rbp)
jmp    14db <udevadm_control+0x2db>
movl   $0x0,-0x2c(%rbp)
jmp    14ee <udevadm_control+0x2ee>
mov    $0x0,%al
call   1110 <print_help@plt>
movl   $0x0,-0x2c(%rbp)
jmp    1286 <udevadm_control+0x86>
cmpl   $0x1,-0x2c(%rbp)
jne    150d <udevadm_control+0x30d>
mov    -0x10(%rbp),%rdi
lea    0xc52(%rip),%rsi
call   1060 <udev_log_null@plt>
jmp    1512 <udevadm_control+0x312>
mov    -0x28(%rbp),%rdi
call   1120 <udev_ctrl_unref@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<udevadm_control>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r13
mov    %esi,%r15d
mov    %rdi,%rbx
xor    %eax,%eax
call   1070 <getuid@plt>
test   %rax,%rax
je     1244 <udevadm_control+0x44>
mov    0x2dae(%rip),%rax
mov    (%rax),%edi
lea    0xeaf(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    $0x1,%ebx
jmp    13d5 <udevadm_control+0x1d5>
lea    0xeb1(%rip),%rsi
mov    %rbx,%rdi
call   1040 <udev_ctrl_new_from_socket@plt>
test   %rax,%rax
je     1399 <udevadm_control+0x199>
mov    %rax,%r14
mov    %rbx,0x8(%rsp)
mov    $0x1,%ebx
lea    0xea4(%rip),%rbp
lea    0xd89(%rip),%r12
jmp    1289 <udevadm_control+0x89>
mov    %r14,%rdi
call   10e0 <udev_ctrl_send_stop_exec_queue@plt>
mov    %eax,%ebx
shr    $0x1e,%ebx
and    $0xfffffffe,%ebx
mov    %r15d,%edi
mov    %r13,%rsi
mov    %rbp,%rdx
lea    0x2a57(%rip),%rcx
xor    %r8d,%r8d
call   1080 <getopt_long@plt>
lea    -0x52(%rax),%ecx
cmp    $0x21,%ecx
ja     1373 <udevadm_control+0x173>
movslq (%r12,%rcx,4),%rax
add    %r12,%rax
jmp    *%rax
mov    %r14,%rdi
call   10d0 <udev_ctrl_send_reload_rules@plt>
jmp    1281 <udevadm_control+0x81>
mov    %r14,%rdi
call   10f0 <udev_ctrl_send_start_exec_queue@plt>
jmp    1281 <udevadm_control+0x81>
xor    %ebx,%ebx
xor    %eax,%eax
call   1110 <print_help@plt>
jmp    1289 <udevadm_control+0x89>
mov    0x2d1c(%rip),%rbp
mov    0x0(%rbp),%rdi
call   1050 <util_log_priority@plt>
test   %eax,%eax
js     13a0 <udevadm_control+0x1a0>
mov    0x0(%rbp),%rdi
call   1050 <util_log_priority@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <udev_ctrl_send_set_log_level@plt>
jmp    135f <udevadm_control+0x15f>
mov    0x2cef(%rip),%rax
mov    (%rax),%rdi
lea    0x10(%rsp),%rsi
xor    %edx,%edx
call   1100 <strtoul@plt>
mov    0x10(%rsp),%rcx
cmpb   $0x0,(%rcx)
jne    13a0 <udevadm_control+0x1a0>
test   %eax,%eax
jle    13a0 <udevadm_control+0x1a0>
mov    %r14,%rdi
mov    %eax,%esi
call   10a0 <udev_ctrl_send_set_children_max@plt>
jmp    1281 <udevadm_control+0x81>
mov    %r14,%rbp
mov    0x2cb9(%rip),%r14
mov    (%r14),%rdi
mov    $0x3d,%esi
call   1090 <strchr@plt>
test   %rax,%rax
je     13a9 <udevadm_control+0x1a9>
mov    (%r14),%rsi
mov    %rbp,%r14
mov    %rbp,%rdi
call   10c0 <udev_ctrl_send_set_env@plt>
mov    %eax,%ebx
shr    $0x1e,%ebx
and    $0xfffffffe,%ebx
lea    0xda6(%rip),%rbp
jmp    1289 <udevadm_control+0x89>
cmp    $0xffffffff,%eax
jne    1289 <udevadm_control+0x89>
cmp    $0x1,%ebx
jne    13cd <udevadm_control+0x1cd>
lea    0xdd2(%rip),%rsi
mov    0x8(%rsp),%rdi
call   1060 <udev_log_null@plt>
mov    $0x1,%ebx
jmp    13cd <udevadm_control+0x1cd>
mov    $0x2,%ebx
jmp    13d5 <udevadm_control+0x1d5>
lea    0xd78(%rip),%rsi
jmp    13b3 <udevadm_control+0x1b3>
lea    0xd84(%rip),%rsi
mov    %rbp,%r14
mov    0x2c1e(%rip),%rax
mov    (%rax),%edi
mov    0x2c35(%rip),%rax
mov    (%rax),%rdx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    %r14,%rdi
call   1120 <udev_ctrl_unref@plt>
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32*, i32 }
%struct.udev = type { i32 }
%struct.udev_ctrl = type { i32 }
@udevadm_control.options = internal constant [9 x %struct.option] [%struct.option { i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0), i8 -128, i32* null, i32 108 }, %struct.option { i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i32 0, i32 0), i8 -127, i32* null, i32 115 }, %struct.option { i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i32 0, i32 0), i8 -127, i32* null, i32 83 }, %struct.option { i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i32 0, i32 0), i8 -127, i32* null, i32 82 }, %struct.option { i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8 -128, i32* null, i32 112 }, %struct.option { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8 -128, i32* null, i32 112 }, %struct.option { i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i32 0, i32 0), i8 -128, i32* null, i32 109 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8 -127, i32* null, i32 104 }, %struct.option zeroinitializer]
@.str = [13 x i8] c"log-priority\00"
@.str.1 = [16 x i8] c"stop-exec-queue\00"
@.str.2 = [17 x i8] c"start-exec-queue\00"
@.str.3 = [13 x i8] c"reload-rules\00"
@.str.4 = [9 x i8] c"property\00"
@.str.5 = [4 x i8] c"env\00"
@.str.6 = [13 x i8] c"children-max\00"
@.str.7 = [5 x i8] c"help\00"
@stderr = global i32 0
@.str.8 = [26 x i8] c"root privileges required\0A\00"
@.str.9 = [24 x i8] c"@/org/kernel/udev/udevd\00"
@.str.10 = [11 x i8] c"l:sSRp:m:h\00"
@optarg = global i8* null
@.str.11 = [21 x i8] c"invalid number '%s'\0A\00"
@.str.12 = [38 x i8] c"expect <KEY>=<value> instead of '%s'\0A\00"
@.str.13 = [22 x i8] c"unrecognized command\0A\00"
define i32 @udevadm_control(%struct.udev* %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca %struct.udev*
%6 = alloca i32
%7 = alloca i8**
%8 = alloca %struct.udev_ctrl*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
store %struct.udev* %0, %struct.udev** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store %struct.udev_ctrl* null, %struct.udev_ctrl** %8
store i32 1, i32* %9
%13 = call i64 (...) @getuid()
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %3
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %4
br label %126
18: ; preds = %3
%19 = load %struct.udev*, %struct.udev** %5
%20 = call %struct.udev_ctrl* @udev_ctrl_new_from_socket(%struct.udev* %19, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
store %struct.udev_ctrl* %20, %struct.udev_ctrl** %8
%21 = load %struct.udev_ctrl*, %struct.udev_ctrl** %8
%22 = icmp eq %struct.udev_ctrl* %21, null
br i1 %22, label %23, label %24
23: ; preds = %18
store i32 2, i32* %4
br label %126
24: ; preds = %18
br label %25
25: ; preds = %114, %24
%26 = load i32, i32* %6
%27 = load i8**, i8*** %7
%28 = call i32 @getopt_long(i32 %26, i8** %27, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), %struct.option* getelementptr inbounds ([9 x %struct.option], [9 x %struct.option]* @udevadm_control.options, i64 0, i64 0), i32* null)
store i32 %28, i32* %10
%29 = load i32, i32* %10
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %32
31: ; preds = %25
br label %115
32: ; preds = %25
%33 = load i32, i32* %10
switch i32 %33, label %114 [
i32 108, label %34
i32 115, label %52
i32 83, label %59
i32 82, label %66
i32 112, label %73
i32 109, label %89
i32 104, label %112
]
34: ; preds = %32
%35 = load i8*, i8** @optarg
%36 = call i32 @util_log_priority(i8* %35)
store i32 %36, i32* %11
%37 = load i32, i32* %11
%38 = icmp slt i32 %37, 0
br i1 %38, label %39, label %43
39: ; preds = %34
%40 = load i32, i32* @stderr
%41 = load i8*, i8** @optarg
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i8* %41)
br label %122
43: ; preds = %34
%44 = load %struct.udev_ctrl*, %struct.udev_ctrl** %8
%45 = load i8*, i8** @optarg
%46 = call i32 @util_log_priority(i8* %45)
%47 = call i32 @udev_ctrl_send_set_log_level(%struct.udev_ctrl* %44, i32 %46)
%48 = icmp slt i32 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %43
store i32 2, i32* %9
br label %51
50: ; preds = %43
store i32 0, i32* %9
br label %51
51: ; preds = %50, %49
br label %114
52: ; preds = %32
%53 = load %struct.udev_ctrl*, %struct.udev_ctrl** %8
%54 = call i32 @udev_ctrl_send_stop_exec_queue(%struct.udev_ctrl* %53)
%55 = icmp slt i32 %54, 0
br i1 %55, label %56, label %57
56: ; preds = %52
store i32 2, i32* %9
br label %58
57: ; preds = %52
store i32 0, i32* %9
br label %58
58: ; preds = %57, %56
br label %114
59: ; preds = %32
%60 = load %struct.udev_ctrl*, %struct.udev_ctrl** %8
%61 = call i32 @udev_ctrl_send_start_exec_queue(%struct.udev_ctrl* %60)
%62 = icmp slt i32 %61, 0
br i1 %62, label %63, label %64
63: ; preds = %59
store i32 2, i32* %9
br label %65
64: ; preds = %59
store i32 0, i32* %9
br label %65
65: ; preds = %64, %63
br label %114
66: ; preds = %32
%67 = load %struct.udev_ctrl*, %struct.udev_ctrl** %8
%68 = call i32 @udev_ctrl_send_reload_rules(%struct.udev_ctrl* %67)
%69 = icmp slt i32 %68, 0
br i1 %69, label %70, label %71
70: ; preds = %66
store i32 2, i32* %9
br label %72
71: ; preds = %66
store i32 0, i32* %9
br label %72
72: ; preds = %71, %70
br label %114
73: ; preds = %32
%74 = load i8*, i8** @optarg
%75 = call i32* @strchr(i8* %74, i8 signext 61)
%76 = icmp eq i32* %75, null
br i1 %76, label %77, label %81
77: ; preds = %73
%78 = load i32, i32* @stderr
%79 = load i8*, i8** @optarg
%80 = call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i8* %79)
br label %122
81: ; preds = %73
%82 = load %struct.udev_ctrl*, %struct.udev_ctrl** %8
%83 = load i8*, i8** @optarg
%84 = call i32 @udev_ctrl_send_set_env(%struct.udev_ctrl* %82, i8* %83)
%85 = icmp slt i32 %84, 0
br i1 %85, label %86, label %87
86: ; preds = %81
store i32 2, i32* %9
br label %88
87: ; preds = %81
store i32 0, i32* %9
br label %88
88: ; preds = %87, %86
br label %114
89: ; preds = %32
%90 = load i8*, i8** @optarg
%91 = call i32 @strtoul(i8* %90, i8** %12, i32 0)
store i32 %91, i32* %11
%92 = load i8*, i8** %12
%93 = getelementptr inbounds i8, i8* %92, i64 0
%94 = load i8, i8* %93
%95 = sext i8 %94 to i32
%96 = icmp ne i32 %95, 0
br i1 %96, label %100, label %97
97: ; preds = %89
%98 = load i32, i32* %11
%99 = icmp slt i32 %98, 1
br i1 %99, label %100, label %104
100: ; preds = %97, %89
%101 = load i32, i32* @stderr
%102 = load i8*, i8** @optarg
%103 = call i32 (i32, i8*, ...) @fprintf(i32 %101, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), i8* %102)
br label %122
104: ; preds = %97
%105 = load %struct.udev_ctrl*, %struct.udev_ctrl** %8
%106 = load i32, i32* %11
%107 = call i32 @udev_ctrl_send_set_children_max(%struct.udev_ctrl* %105, i32 %106)
%108 = icmp slt i32 %107, 0
br i1 %108, label %109, label %110
109: ; preds = %104
store i32 2, i32* %9
br label %111
110: ; preds = %104
store i32 0, i32* %9
br label %111
111: ; preds = %110, %109
br label %114
112: ; preds = %32
%113 = call i32 (...) @print_help()
store i32 0, i32* %9
br label %114
114: ; preds = %32, %112, %111, %88, %72, %65, %58, %51
br label %25
115: ; preds = %31
%116 = load i32, i32* %9
%117 = icmp eq i32 %116, 1
br i1 %117, label %118, label %121
118: ; preds = %115
%119 = load %struct.udev*, %struct.udev** %5
%120 = call i32 @udev_log_null(%struct.udev* %119, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0))
br label %121
121: ; preds = %118, %115
br label %122
122: ; preds = %121, %100, %77, %39
%123 = load %struct.udev_ctrl*, %struct.udev_ctrl** %8
%124 = call i32 @udev_ctrl_unref(%struct.udev_ctrl* %123)
%125 = load i32, i32* %9
store i32 %125, i32* %4
br label %126
126: ; preds = %122, %23, %15
%127 = load i32, i32* %4
ret i32 %127
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32*, i32 }
%struct.udev = type { i32 }
%struct.udev_ctrl = type { i32 }
@udevadm_control.options = internal constant [9 x %struct.option] [%struct.option { i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i32 0, i32 0), i8 -128, i32* null, i32 108 }, %struct.option { i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i32 0, i32 0), i8 -127, i32* null, i32 115 }, %struct.option { i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i32 0, i32 0), i8 -127, i32* null, i32 83 }, %struct.option { i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i32 0, i32 0), i8 -127, i32* null, i32 82 }, %struct.option { i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8 -128, i32* null, i32 112 }, %struct.option { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8 -128, i32* null, i32 112 }, %struct.option { i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i32 0, i32 0), i8 -128, i32* null, i32 109 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8 -127, i32* null, i32 104 }, %struct.option zeroinitializer]
@.str = [13 x i8] c"log-priority\00"
@.str.1 = [16 x i8] c"stop-exec-queue\00"
@.str.2 = [17 x i8] c"start-exec-queue\00"
@.str.3 = [13 x i8] c"reload-rules\00"
@.str.4 = [9 x i8] c"property\00"
@.str.5 = [4 x i8] c"env\00"
@.str.6 = [13 x i8] c"children-max\00"
@.str.7 = [5 x i8] c"help\00"
@stderr = global i32 0
@.str.8 = [26 x i8] c"root privileges required\0A\00"
@.str.9 = [24 x i8] c"@/org/kernel/udev/udevd\00"
@.str.10 = [11 x i8] c"l:sSRp:m:h\00"
@optarg = global i8* null
@.str.11 = [21 x i8] c"invalid number '%s'\0A\00"
@.str.12 = [38 x i8] c"expect <KEY>=<value> instead of '%s'\0A\00"
@.str.13 = [22 x i8] c"unrecognized command\0A\00"
define i32 @udevadm_control(%struct.udev* %0, i32 %1, i8** %2) {
%4 = alloca i8*
%5 = tail call i64 (...) @getuid()
%6 = icmp eq i64 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
br label %77
10: ; preds = %3
%11 = tail call %struct.udev_ctrl* @udev_ctrl_new_from_socket(%struct.udev* %0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%12 = icmp eq %struct.udev_ctrl* %11, null
br i1 %12, label %77, label %13
13: ; preds = %10
%14 = bitcast i8** %4 to i8*
br label %15
15: ; preds = %13, %68
%16 = phi i32 [ %69, %68 ], [ 1, %13 ]
%17 = tail call i32 @getopt_long(i32 %1, i8** %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0), %struct.option* getelementptr inbounds ([9 x %struct.option], [9 x %struct.option]* @udevadm_control.options, i64 0, i64 0), i32* null)
switch i32 %17, label %68 [
i32 -1, label %70
i32 108, label %18
i32 115, label %28
i32 83, label %32
i32 82, label %36
i32 112, label %40
i32 109, label %49
i32 104, label %61
]
18: ; preds = %15
%19 = load i8*, i8** @optarg
%20 = tail call i32 @util_log_priority(i8* %19)
%21 = icmp slt i32 %20, 0
br i1 %21, label %63, label %22
22: ; preds = %18
%23 = load i8*, i8** @optarg
%24 = tail call i32 @util_log_priority(i8* %23)
%25 = tail call i32 @udev_ctrl_send_set_log_level(%struct.udev_ctrl* %11, i32 %24)
%26 = lshr i32 %25, 30
%27 = and i32 %26, 2
br label %68
28: ; preds = %15
%29 = tail call i32 @udev_ctrl_send_stop_exec_queue(%struct.udev_ctrl* %11)
%30 = lshr i32 %29, 30
%31 = and i32 %30, 2
br label %68
32: ; preds = %15
%33 = tail call i32 @udev_ctrl_send_start_exec_queue(%struct.udev_ctrl* %11)
%34 = lshr i32 %33, 30
%35 = and i32 %34, 2
br label %68
36: ; preds = %15
%37 = tail call i32 @udev_ctrl_send_reload_rules(%struct.udev_ctrl* %11)
%38 = lshr i32 %37, 30
%39 = and i32 %38, 2
br label %68
40: ; preds = %15
%41 = load i8*, i8** @optarg
%42 = tail call i32* @strchr(i8* %41, i8 signext 61)
%43 = icmp eq i32* %42, null
br i1 %43, label %63, label %44
44: ; preds = %40
%45 = load i8*, i8** @optarg
%46 = tail call i32 @udev_ctrl_send_set_env(%struct.udev_ctrl* %11, i8* %45)
%47 = lshr i32 %46, 30
%48 = and i32 %47, 2
br label %68
49: ; preds = %15
%50 = load i8*, i8** @optarg
%51 = call i32 @strtoul(i8* %50, i8** %4, i32 0)
%52 = load i8*, i8** %4
%53 = load i8, i8* %52
%54 = icmp ne i8 %53, 0
%55 = icmp slt i32 %51, 1
%56 = select i1 %54, i1 true, i1 %55
br i1 %56, label %63, label %57
57: ; preds = %49
%58 = tail call i32 @udev_ctrl_send_set_children_max(%struct.udev_ctrl* %11, i32 %51)
%59 = lshr i32 %58, 30
%60 = and i32 %59, 2
br label %68
61: ; preds = %15
%62 = tail call i32 (...) @print_help()
br label %68
63: ; preds = %49, %40, %18
%64 = phi i8* [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), %18 ], [ getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), %40 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.11, i64 0, i64 0), %49 ]
%65 = load i32, i32* @stderr
%66 = load i8*, i8** @optarg
%67 = tail call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* %64, i8* %66)
br label %74
68: ; preds = %61, %15, %22, %28, %32, %36, %44, %57
%69 = phi i32 [ 0, %61 ], [ %16, %15 ], [ %27, %22 ], [ %31, %28 ], [ %35, %32 ], [ %39, %36 ], [ %48, %44 ], [ %60, %57 ]
br label %15
70: ; preds = %15
%71 = icmp eq i32 %16, 1
br i1 %71, label %72, label %74
72: ; preds = %70
%73 = tail call i32 @udev_log_null(%struct.udev* %0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0))
br label %74
74: ; preds = %63, %70, %72
%75 = phi i32 [ %16, %63 ], [ %16, %70 ], [ 1, %72 ]
%76 = tail call i32 @udev_ctrl_unref(%struct.udev_ctrl* %11)
br label %77
77: ; preds = %10, %74, %7
%78 = phi i32 [ 1, %7 ], [ %75, %74 ], [ 2, %10 ]
ret i32 %78
}