#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 EXIT_SUCCESS;
int errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int sem_unlink(char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc != 2 || strcmp(argv[1], "--help") == 0) {
    printf("%s sem-name\n", argv[0]);
    exit(1);
  }
  if (sem_unlink(argv[1]) == -1) {
    perror("sem_unlink");
    exit(errno);
  };
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    118e <main+0x3e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe81(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11ab <main+0x5b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <sem_unlink@plt>
cmp    $0xffffffff,%eax
jne    11db <main+0x8b>
lea    0xe4c(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    116e <main+0x1e>
mov    0x8(%rbx),%rdi
lea    0xe9c(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1187 <main+0x37>
mov    (%rbx),%rsi
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    0x8(%rbx),%rdi
call   1070 <sem_unlink@plt>
cmp    $0xffffffff,%eax
jne    11af <main+0x5f>
lea    0xe78(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"--help\00"
@.str.1 = [13 x i8] c"%s sem-name\0A\00"
@.str.2 = [11 x i8] c"sem_unlink\00"
@errno = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %14, label %8
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %8, %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %8
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @sem_unlink(i8* %23)
%25 = icmp eq i32 %24, -1
br i1 %25, label %26, label %30
26: ; preds = %20
%27 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%28 = load i32, i32* @errno
%29 = call i32 @exit(i32 %28)
unreachable
30: ; preds = %20
%31 = load i32, i32* @EXIT_SUCCESS
%32 = call i32 @exit(i32 %31)
unreachable
}

LLVM IR (-O2):
@.str = [7 x i8] c"--help\00"
@.str.1 = [13 x i8] c"%s sem-name\0A\00"
@.str.2 = [11 x i8] c"sem_unlink\00"
@errno = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %4, %2
%10 = load i8*, i8** %1
%11 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %4
%14 = load i8*, i8** %5
%15 = tail call i32 @sem_unlink(i8* %14)
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%19 = load i32, i32* @errno
%20 = tail call i32 @exit(i32 %19)
unreachable
21: ; preds = %13
%22 = load i32, i32* @EXIT_SUCCESS
%23 = tail call i32 @exit(i32 %22)
unreachable
}