#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*/ EINVAL;
int destroy(unsigned int);
int /*<<< orphan*/ errno;
int parse_ui(char *, unsigned int *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ print_help(int);
int handle_destroy(int argc, char **argv) {
  int ret;
  unsigned int minor;
  if (argc != 2) {
    errno = EINVAL;
    goto handle_destroy_error;
  }
  ret = parse_ui(argv[1], &minor);
  if (ret)
    goto handle_destroy_error;
  return destroy(minor);
handle_destroy_error:
  perror("error interpreting destroy parameters");
  print_help(-1);
  return 0;
}


x86 assembly (clang, -O0):
<handle_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1170 <handle_destroy+0x30>
mov    0x2e78(%rip),%rax
mov    (%rax),%ecx
mov    0x2e77(%rip),%rax
mov    %ecx,(%rax)
jmp    11a3 <handle_destroy+0x63>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <parse_ui@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1193 <handle_destroy+0x53>
jmp    11a3 <handle_destroy+0x63>
mov    -0x18(%rbp),%edi
call   1040 <destroy@plt>
mov    %eax,-0x4(%rbp)
jmp    11c0 <handle_destroy+0x80>
lea    0xe56(%rip),%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%edi
call   1060 <print_help@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_destroy>:
push   %rax
cmp    $0x2,%edi
jne    1163 <handle_destroy+0x23>
mov    0x8(%rsi),%rdi
lea    0x4(%rsp),%rsi
call   1030 <parse_ui@plt>
test   %eax,%eax
jne    1175 <handle_destroy+0x35>
mov    0x4(%rsp),%edi
call   1040 <destroy@plt>
pop    %rcx
ret
mov    0x2e6e(%rip),%rax
mov    (%rax),%eax
mov    0x2e6d(%rip),%rcx
mov    %eax,(%rcx)
lea    0xe84(%rip),%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%edi
call   1060 <print_help@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@EINVAL = global i32 0
@errno = global i32 0
@.str = [38 x i8] c"error interpreting destroy parameters\00"
define i32 @handle_destroy(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i32, i32* @EINVAL
store i32 %11, i32* @errno
br label %23
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @parse_ui(i8* %15, i32* %7)
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %12
br label %23
20: ; preds = %12
%21 = load i32, i32* %7
%22 = call i32 @destroy(i32 %21)
store i32 %22, i32* %3
br label %26
23: ; preds = %19, %10
%24 = call i32 @perror(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @print_help(i32 -1)
store i32 0, i32* %3
br label %26
26: ; preds = %23, %20
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@EINVAL = global i32 0
@errno = global i32 0
@.str = [38 x i8] c"error interpreting destroy parameters\00"
define i32 @handle_destroy(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp eq i32 %0, 2
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = load i32, i32* @EINVAL
store i32 %7, i32* @errno
br label %16
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @parse_ui(i8* %10, i32* %3)
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load i32, i32* %3
%15 = call i32 @destroy(i32 %14)
br label %19
16: ; preds = %8, %6
%17 = call i32 @perror(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @print_help(i32 -1)
br label %19
19: ; preds = %16, %13
%20 = phi i32 [ 0, %16 ], [ %15, %13 ]
ret i32 %20
}