#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 */
scalar_t__ find_exec_pid(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  if (argc == 3 && !strcmp(argv[1], "-x")) {
    if (find_exec_pid(argv[2]) >= 0)
      return 0;
    else
      return 1;
  } else if (argc == 3 && !strcmp(argv[1], "-d")) {
    fprintf(stderr, "not yet, sorry\n");
    return 2;
  } else {
    usage();
    return 2;
  }
}


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   $0x3,-0x8(%rbp)
jne    11ac <main+0x6c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe91(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11ac <main+0x6c>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <find_exec_pid@plt>
cmp    $0x0,%rax
jl     11a0 <main+0x60>
movl   $0x0,-0x4(%rbp)
jmp    1202 <main+0xc2>
movl   $0x1,-0x4(%rbp)
jmp    1202 <main+0xc2>
cmpl   $0x3,-0x8(%rbp)
jne    11f4 <main+0xb4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11f4 <main+0xb4>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
lea    0xe23(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1202 <main+0xc2>
mov    $0x0,%al
call   1060 <usage@plt>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    1176 <main+0x36>
mov    %rsi,%rbx
mov    0x8(%rsi),%r14
lea    0xea9(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     118a <main+0x4a>
lea    0xe99(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1199 <main+0x59>
xor    %eax,%eax
call   1060 <usage@plt>
mov    $0x2,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x10(%rbx),%rdi
call   1030 <find_exec_pid@plt>
shr    $0x3f,%rax
jmp    1182 <main+0x42>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
call   1050 <fprintf@plt>
jmp    117d <main+0x3d>

LLVM IR (-O0):
@.str = [3 x i8] c"-x\00"
@.str.1 = [3 x i8] c"-d\00"
@stderr = global i32 0
@.str.2 = [16 x i8] c"not yet, sorry\0A\00"
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 eq i32 %6, 3
br i1 %7, label %8, label %22
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @strcmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = icmp ne i32 %12, 0
br i1 %13, label %22, label %14
14: ; preds = %8
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = call i64 @find_exec_pid(i8* %17)
%19 = icmp sge i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %14
store i32 0, i32* %3
br label %36
21: ; preds = %14
store i32 1, i32* %3
br label %36
22: ; preds = %8, %2
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 3
br i1 %24, label %25, label %34
25: ; preds = %22
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @strcmp(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %25
%32 = load i32, i32* @stderr
%33 = call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
store i32 2, i32* %3
br label %36
34: ; preds = %25, %22
%35 = call i32 (...) @usage()
store i32 2, i32* %3
br label %36
36: ; preds = %34, %31, %21, %20
%37 = load i32, i32* %3
ret i32 %37
}

LLVM IR (-O2):
@.str = [3 x i8] c"-x\00"
@.str.1 = [3 x i8] c"-d\00"
@stderr = global i32 0
@.str.2 = [16 x i8] c"not yet, sorry\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %4, label %21
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %4
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i64 @find_exec_pid(i8* %11)
%13 = lshr i64 %12, 63
%14 = trunc i64 %13 to i32
br label %23
15: ; preds = %4
%16 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* @stderr
%20 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %23
21: ; preds = %2, %15
%22 = tail call i32 (...) @usage()
br label %23
23: ; preds = %9, %21, %18
%24 = phi i32 [ 2, %21 ], [ 2, %18 ], [ %14, %9 ]
ret i32 %24
}