#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(int /*<<< orphan*/);
int mq_unlink(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  int flag;
  if (argc != 2) {
    perror("usage: mq_unlink <name>");
  }
  flag = mq_unlink(argv[1]);
  if (flag == -1) {
    printf("fail!\n");
  } else {
    printf("ok!\n");
  }
  exit(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)
cmpl   $0x2,-0x8(%rbp)
je     116c <main+0x2c>
lea    0xe99(%rip),%rdi
call   1040 <perror@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <mq_unlink@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1197 <main+0x57>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
jmp    11a3 <main+0x63>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
je     1155 <main+0x15>
lea    0xeb0(%rip),%rdi
call   1040 <perror@plt>
mov    0x8(%rbx),%rdi
call   1060 <mq_unlink@plt>
cmp    $0xffffffff,%eax
lea    0xeb4(%rip),%rax
lea    0xea9(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"usage: mq_unlink <name>\00"
@.str.1 = [7 x i8] c"fail!\0A\00"
@.str.2 = [5 x i8] c"ok!\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 = icmp ne i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @mq_unlink(i8* %14)
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %20
18: ; preds = %11
%19 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %22
20: ; preds = %11
%21 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %20, %18
%23 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [24 x i8] c"usage: mq_unlink <name>\00"
@str = [4 x i8] c"ok!\00"
@str.3 = [6 x i8] c"fail!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @perror(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @mq_unlink(i8* %8)
%10 = icmp eq i32 %9, -1
%11 = select i1 %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0)
%12 = tail call i32 @puts(i8* dereferenceable(1) %11)
%13 = tail call i32 @exit(i32 0)
unreachable
}