#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 */
struct timespec {
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ rill_exit(int);
int /*<<< orphan*/ rill_rotate(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(int argc, const char **argv) {
  if (argc != 2) {
    fprintf(stderr, "./rill_rotate <path>\n");
    return 1;
  }
  struct timespec ts;
  (void)clock_gettime(CLOCK_REALTIME, &ts);
  printf("rotating '%s' at '%lu'\n", argv[1], ts.tv_sec);
  if (!rill_rotate(argv[1], ts.tv_sec))
    rill_exit(1);
  return 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)
cmpl   $0x2,-0x8(%rbp)
je     1191 <main+0x41>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e4 <main+0x94>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
lea    -0x18(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x18(%rbp),%edx
lea    0xe61(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x18(%rbp),%esi
call   1070 <rill_rotate@plt>
cmp    $0x0,%eax
jne    11dd <main+0x8d>
mov    $0x1,%edi
call   1060 <rill_exit@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jne    11a3 <main+0x53>
mov    %rsi,%rbx
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
mov    0x8(%rbx),%rsi
mov    0x8(%rsp),%edx
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
mov    0x8(%rbx),%rdi
mov    0x8(%rsp),%esi
call   1070 <rill_rotate@plt>
test   %eax,%eax
jne    119f <main+0x4f>
mov    $0x1,%edi
call   1060 <rill_exit@plt>
xor    %eax,%eax
jmp    11bd <main+0x6d>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
lea    0xe4d(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@stderr = global i32 0
@.str = [22 x i8] c"./rill_rotate <path>\0A\00"
@CLOCK_REALTIME = global i32 0
@.str.1 = [24 x i8] c"rotating '%s' at '%lu'\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.timespec
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %31
12: ; preds = %2
%13 = load i32, i32* @CLOCK_REALTIME
%14 = call i32 @clock_gettime(i32 %13, %struct.timespec* %6)
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 0
%19 = load i32, i32* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %17, i32 %19)
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 0
%25 = load i32, i32* %24
%26 = call i32 @rill_rotate(i8* %23, i32 %25)
%27 = icmp ne i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %12
%29 = call i32 @rill_exit(i32 1)
br label %30
30: ; preds = %28, %12
store i32 0, i32* %3
br label %31
31: ; preds = %30, %9
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@stderr = global i32 0
@.str = [22 x i8] c"./rill_rotate <path>\0A\00"
@CLOCK_REALTIME = global i32 0
@.str.1 = [24 x i8] c"rotating '%s' at '%lu'\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.timespec
%4 = icmp eq i32 %0, 2
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %24
8: ; preds = %2
%9 = bitcast %struct.timespec* %3 to i8*
%10 = load i32, i32* @CLOCK_REALTIME
%11 = call i32 @clock_gettime(i32 %10, %struct.timespec* %3)
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i64 0, i32 0
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %13, i32 %15)
%17 = load i8*, i8** %12
%18 = load i32, i32* %14
%19 = call i32 @rill_rotate(i8* %17, i32 %18)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %8
%22 = call i32 @rill_exit(i32 1)
br label %23
23: ; preds = %21, %8
br label %24
24: ; preds = %23, %5
%25 = phi i32 [ 1, %5 ], [ 0, %23 ]
ret i32 %25
}