#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_FAILURE;
int /*<<< orphan*/ attemptLock(char const *);
int /*<<< orphan*/ err(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ execvp(char *, char **);
char *getLockFileName(char **);
int /*<<< orphan*/ warnx(char *);
int main(int argc, char *argv[]) {
  const char *lockFileName = getLockFileName(argv);
  if (lockFileName)
    attemptLock(lockFileName);
  else
    warnx("warning: Could not determine lock file name, continueing without "
          "lock.");
  argv[0]++;
  execvp(argv[0], argv);
  err(EXIT_FAILURE, NULL);
}


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    -0x10(%rbp),%rdi
call   1030 <getLockFileName@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     118c <main+0x3c>
mov    -0x18(%rbp),%rdi
call   1060 <attemptLock@plt>
jmp    1198 <main+0x48>
lea    0xe6d(%rip),%rdi
call   1040 <warnx@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <execvp@plt>
mov    0x2e23(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <err@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
mov    %rsi,%rdi
call   1030 <getLockFileName@plt>
test   %rax,%rax
je     116b <main+0x1b>
mov    %rax,%rdi
call   1060 <attemptLock@plt>
jmp    1177 <main+0x27>
lea    0xe8e(%rip),%rdi
call   1040 <warnx@plt>
mov    (%rbx),%rdi
add    $0x1,%rdi
mov    %rdi,(%rbx)
mov    %rbx,%rsi
call   1070 <execvp@plt>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1050 <err@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [71 x i8] c"warning: Could not determine lock file name, continueing without lock.\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = call i8* @getLockFileName(i8** %7)
store i8* %8, i8** %6
%9 = load i8*, i8** %6
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i8*, i8** %6
%13 = call i32 @attemptLock(i8* %12)
br label %16
14: ; preds = %2
%15 = call i32 @warnx(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %18
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = load i8**, i8*** %5
%25 = call i32 @execvp(i8* %23, i8** %24)
%26 = load i32, i32* @EXIT_FAILURE
%27 = call i32 @err(i32 %26, i32* null)
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@.str = [71 x i8] c"warning: Could not determine lock file name, continueing without lock.\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i8* @getLockFileName(i8** %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @attemptLock(i8* %3)
br label %9
7: ; preds = %2
%8 = tail call i32 @warnx(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
%10 = load i8*, i8** %1
%11 = getelementptr inbounds i8, i8* %10, i64 1
store i8* %11, i8** %1
%12 = tail call i32 @execvp(i8* %11, i8** %1)
%13 = load i32, i32* @EXIT_FAILURE
%14 = tail call i32 @err(i32 %13, i32* null)
ret i32 0
}