#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 */
typedef int off_t;
typedef int /*<<< orphan*/ intmax_t;
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int LookupAuxFile(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ msg_Err(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strtoll(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main(int i_argc, char **pp_argv) {
  int64_t i_wanted;
  off_t i_ret;
  if (i_argc != 3) {
    msg_Err(NULL, "Usage: offsets <aux file> <27 MHz timestamp>");
    msg_Err(NULL, "[offsets is deprecated, see multicat instead]");
    exit(EXIT_FAILURE);
  }
  i_wanted = strtoll(pp_argv[2], NULL, 0);
  if (!i_wanted) {
    printf("0\n");
    exit(EXIT_SUCCESS);
  }
  i_ret = LookupAuxFile(pp_argv[1], i_wanted, false);
  if (i_ret == -1)
    exit(EXIT_FAILURE);
  printf("%jd\n", (intmax_t)i_ret);
  exit(EXIT_SUCCESS);
}


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   $0x3,-0x8(%rbp)
je     119e <main+0x4e>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe85(%rip),%rsi
call   1030 <msg_Err@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xea2(%rip),%rsi
call   1030 <msg_Err@plt>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtoll@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11da <main+0x8a>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e05(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x14(%rbp),%esi
xor    %edx,%edx
call   1050 <LookupAuxFile@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    1207 <main+0xb7>
mov    0x2de0(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x18(%rbp),%esi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2db9(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x3,%edi
jne    1188 <main+0x28>
mov    %rsi,%rbx
mov    0x10(%rsi),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <strtoll@plt>
test   %eax,%eax
jne    11b2 <main+0x52>
lea    0xedf(%rip),%rdi
call   1030 <puts@plt>
jmp    11d4 <main+0x74>
lea    0xe71(%rip),%rsi
xor    %edi,%edi
call   1040 <msg_Err@plt>
lea    0xe90(%rip),%rsi
xor    %edi,%edi
call   1040 <msg_Err@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    0x8(%rbx),%rdi
mov    %eax,%esi
xor    %edx,%edx
call   1060 <LookupAuxFile@plt>
cmp    $0xffffffff,%eax
je     11a4 <main+0x44>
lea    0xe90(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"Usage: offsets <aux file> <27 MHz timestamp>\00"
@.str.1 = [46 x i8] c"[offsets is deprecated, see multicat instead]\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [3 x i8] c"0\0A\00"
@EXIT_SUCCESS = global i32 0
@.str.3 = [5 x i8] c"%jd\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = call i32 @msg_Err(i32* null, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @msg_Err(i32* null, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 2
%18 = load i8*, i8** %17
%19 = call i32 @strtoll(i8* %18, i32* null, i32 0)
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = icmp ne i32 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %15
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%24 = load i32, i32* @EXIT_SUCCESS
%25 = call i32 @exit(i32 %24)
unreachable
26: ; preds = %15
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = load i32, i32* %6
%31 = call i32 @LookupAuxFile(i8* %29, i32 %30, i32 0)
store i32 %31, i32* %7
%32 = load i32, i32* %7
%33 = icmp eq i32 %32, -1
br i1 %33, label %34, label %37
34: ; preds = %26
%35 = load i32, i32* @EXIT_FAILURE
%36 = call i32 @exit(i32 %35)
unreachable
37: ; preds = %26
%38 = load i32, i32* %7
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %38)
%40 = load i32, i32* @EXIT_SUCCESS
%41 = call i32 @exit(i32 %40)
unreachable
}

LLVM IR (-O2):
@.str = [45 x i8] c"Usage: offsets <aux file> <27 MHz timestamp>\00"
@.str.1 = [46 x i8] c"[offsets is deprecated, see multicat instead]\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
@.str.3 = [5 x i8] c"%jd\0A\00"
@str = [2 x i8] c"0\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = tail call i32 @msg_Err(i32* null, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @msg_Err(i32* null, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @strtoll(i8* nocapture %11, i32* null, i32 0)
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%16 = load i32, i32* @EXIT_SUCCESS
%17 = tail call i32 @exit(i32 %16)
unreachable
18: ; preds = %9
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = tail call i32 @LookupAuxFile(i8* %20, i32 %12, i32 0)
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %26
23: ; preds = %18
%24 = load i32, i32* @EXIT_FAILURE
%25 = tail call i32 @exit(i32 %24)
unreachable
26: ; preds = %18
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%28 = load i32, i32* @EXIT_SUCCESS
%29 = tail call i32 @exit(i32 %28)
unreachable
}