#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 ENOSYS;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int imd_command(int, char **);
int /*<<< orphan*/ stderr;
char *strerror(int);
int /*<<< orphan*/ usage(char *);
int main(int argc, char *argv[]) {
  int ret;
  ret = imd_command(argc, argv);
  if (ret == -ENOSYS) {
    usage(argv[0]);
    exit(1);
  }
  if (ret)
    fprintf(stderr, "%s\n", strerror(-ret));
  return ret ? 1 : 0;
}


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   1050 <imd_command@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    %ecx,%ecx
mov    0x2e67(%rip),%rdx
sub    (%rdx),%ecx
cmp    %ecx,%eax
jne    11a1 <main+0x51>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <usage@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
cmpl   $0x0,-0x14(%rbp)
je     11d3 <main+0x83>
mov    0x2e26(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
xor    %edi,%edi
sub    -0x14(%rbp),%edi
call   1070 <strerror@plt>
mov    -0x18(%rbp),%edi
mov    %rax,%rdx
lea    0xe32(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x14(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
call   1050 <imd_command@plt>
mov    %eax,%ebx
mov    0x2e83(%rip),%rax
mov    (%rax),%eax
add    %ebx,%eax
je     119e <main+0x4e>
test   %ebx,%ebx
je     1192 <main+0x42>
mov    0x2e62(%rip),%rax
mov    (%rax),%ebp
mov    %ebx,%edi
neg    %edi
call   1070 <strerror@plt>
lea    0xe78(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
call   1030 <fprintf@plt>
xor    %eax,%eax
test   %ebx,%ebx
setne  %al
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    (%r14),%rdi
call   1040 <usage@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@ENOSYS = global i32 0
@stderr = global i32 0
@.str = [4 x i8] c"%s\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 @imd_command(i32 %7, i8** %8)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = load i32, i32* @ENOSYS
%12 = sub nsw i32 0, %11
%13 = icmp eq i32 %10, %12
br i1 %13, label %14, label %20
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @usage(i8* %17)
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %2
%21 = load i32, i32* %6
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = load i32, i32* @stderr
%25 = load i32, i32* %6
%26 = sub nsw i32 0, %25
%27 = call i8* @strerror(i32 %26)
%28 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %23, %20
%30 = load i32, i32* %6
%31 = icmp ne i32 %30, 0
%32 = zext i1 %31 to i64
%33 = select i1 %31, i32 1, i32 0
ret i32 %33
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @imd_command(i32 %0, i8** %1)
%4 = load i32, i32* @ENOSYS
%5 = sub nsw i32 0, %4
%6 = icmp eq i32 %3, %5
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load i8*, i8** %1
%9 = tail call i32 @usage(i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = icmp eq i32 %3, 0
br i1 %12, label %18, label %13
13: ; preds = %11
%14 = load i32, i32* @stderr
%15 = sub nsw i32 0, %3
%16 = tail call i8* @strerror(i32 %15)
%17 = tail call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %13, %11
%19 = xor i1 %12, true
%20 = zext i1 %19 to i32
ret i32 %20
}