#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(int /*<<< orphan*/);
int /*<<< orphan*/ err(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ execvp(char *, char **);
char *getArchiveFileName(char **);
char *getDelegateProgramName(char *);
int /*<<< orphan*/ getLockFileName(char const *);
int /*<<< orphan*/ setCorrectActionOption(char const *, char **);
int /*<<< orphan*/ warnx(char *);
int main(int argc, char *argv[]) {
  const char *archiveFileName = getArchiveFileName(argv);
  if (archiveFileName) {
    attemptLock(getLockFileName(archiveFileName));
    setCorrectActionOption(archiveFileName, argv);
  } else
    warnx("warning: Could not determine archive file name, continueing without "
          "update magic and lock.");
  argv[0] = getDelegateProgramName(argv[0]);
  execvp(argv[0], argv);
  err(EXIT_FAILURE, "%s", argv[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    -0x10(%rbp),%rdi
call   1050 <getArchiveFileName@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11d0 <main+0x50>
mov    -0x18(%rbp),%rdi
call   1030 <getLockFileName@plt>
mov    %eax,%edi
call   1080 <attemptLock@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <setCorrectActionOption@plt>
jmp    11dc <main+0x5c>
lea    0xe29(%rip),%rdi
call   1040 <warnx@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <getDelegateProgramName@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   10a0 <execvp@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe42(%rip),%rsi
call   1060 <err@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rsi,%rdi
call   1050 <getArchiveFileName@plt>
test   %rax,%rax
je     11b3 <main+0x33>
mov    %rax,%r14
mov    %rax,%rdi
call   1030 <getLockFileName@plt>
mov    %eax,%edi
call   1080 <attemptLock@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1070 <setCorrectActionOption@plt>
jmp    11bf <main+0x3f>
lea    0xe46(%rip),%rdi
call   1040 <warnx@plt>
mov    (%rbx),%rdi
call   1090 <getDelegateProgramName@plt>
mov    %rax,(%rbx)
mov    %rax,%rdi
mov    %rbx,%rsi
call   10a0 <execvp@plt>
mov    0x2e04(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe73(%rip),%rsi
call   1060 <err@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [91 x i8] c"warning: Could not determine archive file name, continueing without update magic and lock.\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"%s\00"
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* @getArchiveFileName(i8** %7)
store i8* %8, i8** %6
%9 = load i8*, i8** %6
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i8*, i8** %6
%13 = call i32 @getLockFileName(i8* %12)
%14 = call i32 @attemptLock(i32 %13)
%15 = load i8*, i8** %6
%16 = load i8**, i8*** %5
%17 = call i32 @setCorrectActionOption(i8* %15, i8** %16)
br label %20
18: ; preds = %2
%19 = call i32 @warnx(i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %11
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i8* @getDelegateProgramName(i8* %23)
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 0
store i8* %24, i8** %26
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 0
%29 = load i8*, i8** %28
%30 = load i8**, i8*** %5
%31 = call i32 @execvp(i8* %29, i8** %30)
%32 = load i32, i32* @EXIT_FAILURE
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 0
%35 = load i8*, i8** %34
%36 = call i32 @err(i32 %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %35)
%37 = load i32, i32* %3
ret i32 %37
}

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