#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__ optind;
int /*<<< orphan*/ parse_options(int, char **);
int trim_wtmp(char const *);
int main(int argc, char *argv[]) {
  const char *wtmpfile = "/var/log/wtmp";
  parse_options(argc, argv);
  argc -= optind;
  argv += optind;
  if (argc > 0)
    wtmpfile = argv[0];
  return trim_wtmp(wtmpfile);
}


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)
lea    0xec3(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <parse_options@plt>
mov    0x2e94(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    0x2e80(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    118c <main+0x6c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <trim_wtmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
call   1030 <parse_options@plt>
mov    0x2eb4(%rip),%rax
mov    (%rax),%rax
sub    %eax,%ebp
test   %ebp,%ebp
jle    1143 <main+0x23>
mov    (%rbx,%rax,8),%rdi
jmp    114a <main+0x2a>
lea    0xeb6(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <trim_wtmp@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"/var/log/wtmp\00"
@optind = global i64 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
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i32 @parse_options(i32 %7, i8** %8)
%10 = load i64, i64* @optind
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = sub nsw i64 %12, %10
%14 = trunc i64 %13 to i32
store i32 %14, i32* %4
%15 = load i64, i64* @optind
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 %15
store i8** %17, i8*** %5
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
store i8* %23, i8** %6
br label %24
24: ; preds = %20, %2
%25 = load i8*, i8** %6
%26 = call i32 @trim_wtmp(i8* %25)
ret i32 %26
}

LLVM IR (-O2):
@.str = [14 x i8] c"/var/log/wtmp\00"
@optind = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @parse_options(i32 %0, i8** %1)
%4 = load i64, i64* @optind
%5 = trunc i64 %4 to i32
%6 = sub i32 %0, %5
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 %4
%10 = load i8*, i8** %9
br label %11
11: ; preds = %8, %2
%12 = phi i8* [ %10, %8 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %2 ]
%13 = tail call i32 @trim_wtmp(i8* %12)
ret i32 %13
}