#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 /*<<< orphan*/ stx;
struct statx {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int AT_NO_AUTOMOUNT;
int AT_SYMLINK_NOFOLLOW;
unsigned int STATX_BASIC_STATS;
unsigned int STATX_BTIME;
int /*<<< orphan*/ dump_hex(unsigned long long *, int /*<<< orphan*/, int);
int /*<<< orphan*/ dump_statx(struct statx *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ memset(struct statx *, int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *, int);
int statx(int /*<<< orphan*/, char *, int, unsigned int, struct statx *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  struct statx stx;
  int ret, raw = 0, atflag = AT_SYMLINK_NOFOLLOW;
  unsigned int mask = STATX_BASIC_STATS | STATX_BTIME;
  for (argv++; *argv; argv++) {
    if (strcmp(*argv, "-F") == 0) {
      atflag &= ~0x6000;
      atflag |= 0x2000;
      continue;
    }
    if (strcmp(*argv, "-D") == 0) {
      atflag &= ~0x6000;
      atflag |= 0x4000;
      continue;
    }
    if (strcmp(*argv, "-L") == 0) {
      atflag &= ~AT_SYMLINK_NOFOLLOW;
      continue;
    }
    if (strcmp(*argv, "-O") == 0) {
      mask &= ~STATX_BASIC_STATS;
      continue;
    }
    if (strcmp(*argv, "-A") == 0) {
      atflag |= AT_NO_AUTOMOUNT;
      continue;
    }
    if (strcmp(*argv, "-R") == 0) {
      raw = 1;
      continue;
    }
    memset(&stx, 0xbf, sizeof(stx));
    ret = statx(AT_FDCWD, *argv, atflag, mask, &stx);
    printf("statx(%s) = %d\n", *argv, ret);
    if (ret < 0) {
      perror(*argv);
      exit(1);
    }
    if (raw)
      dump_hex((unsigned long long *)&stx, 0, sizeof(stx));
    dump_statx(&stx);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
mov    0x2e24(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2e48(%rip),%rax
mov    (%rax),%eax
mov    0x2e27(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     13a9 <main+0x229>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe1a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1210 <main+0x90>
mov    -0x24(%rbp),%eax
and    $0xffff9fff,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
or     $0x2000,%eax
mov    %eax,-0x24(%rbp)
jmp    1398 <main+0x218>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xde5(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1248 <main+0xc8>
mov    -0x24(%rbp),%eax
and    $0xffff9fff,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
or     $0x4000,%eax
mov    %eax,-0x24(%rbp)
jmp    1398 <main+0x218>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xdb0(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    127c <main+0xfc>
mov    0x2d5c(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    1398 <main+0x218>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd7f(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12b0 <main+0x130>
mov    0x2d58(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    1398 <main+0x218>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd4e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12e1 <main+0x161>
mov    0x2d04(%rip),%rax
mov    (%rax),%eax
or     -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    1398 <main+0x218>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd20(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    130a <main+0x18a>
movl   $0x1,-0x20(%rbp)
jmp    1398 <main+0x218>
lea    -0x18(%rbp),%rdi
mov    $0xbf,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    0x2c94(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
lea    -0x18(%rbp),%r8
call   1080 <statx@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x1c(%rbp),%edx
lea    0xcc2(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x1c(%rbp)
jge    1375 <main+0x1f5>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
cmpl   $0x0,-0x20(%rbp)
je     138f <main+0x20f>
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1070 <dump_hex@plt>
lea    -0x18(%rbp),%rdi
call   1060 <dump_statx@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    11ca <main+0x4a>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     1346 <main+0x1c6>
mov    %rsi,%rbx
add    $0x8,%rbx
mov    0x2e3a(%rip),%rax
mov    (%rax),%r13d
mov    0x2e48(%rip),%r14
or     (%r14),%r13d
mov    0x2e0e(%rip),%r12
mov    (%r12),%ebp
movl   $0x0,0x4(%rsp)
lea    0xe33(%rip),%r15
jmp    11ed <main+0x6d>
nop
and    $0xffff9fff,%ebp
or     $0x2000,%ebp
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
je     1346 <main+0x1c6>
mov    %r15,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11d0 <main+0x50>
mov    (%rbx),%rdi
lea    0xdff(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1300 <main+0x180>
mov    (%rbx),%rdi
lea    0xdea(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1311 <main+0x191>
mov    (%rbx),%rdi
lea    0xdd5(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     131e <main+0x19e>
mov    (%rbx),%rdi
lea    0xdc0(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     132b <main+0x1ab>
mov    (%rbx),%rdi
lea    0xdab(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1339 <main+0x1b9>
mov    %r12,%r15
mov    %rsp,%rdi
mov    $0xbf,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    0x2d2a(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rsi
mov    %ebp,%edx
mov    %r13d,%r12d
mov    %r13d,%ecx
mov    %rsp,%r8
call   1080 <statx@plt>
mov    %eax,%r13d
mov    (%rbx),%rsi
lea    0xd62(%rip),%rdi
mov    %eax,%edx
call   1030 <printf@plt>
test   %r13d,%r13d
js     1357 <main+0x1d7>
cmpl   $0x0,0x4(%rsp)
mov    %rsp,%r13
je     12d9 <main+0x159>
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1070 <dump_hex@plt>
mov    %r13,%rdi
call   1060 <dump_statx@plt>
mov    %r12d,%r13d
mov    %r15,%r12
lea    0xd12(%rip),%r15
jmp    11dc <main+0x5c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
and    $0xffff9fff,%ebp
or     $0x4000,%ebp
jmp    11dc <main+0x5c>
mov    (%r12),%eax
not    %eax
and    %eax,%ebp
jmp    11dc <main+0x5c>
mov    (%r14),%eax
not    %eax
and    %eax,%r13d
jmp    11dc <main+0x5c>
mov    0x2ca6(%rip),%rax
or     (%rax),%ebp
jmp    11dc <main+0x5c>
movl   $0x1,0x4(%rsp)
jmp    11dc <main+0x5c>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rbx),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
%struct.statx = type { i32 }
@AT_SYMLINK_NOFOLLOW = global i32 0
@STATX_BASIC_STATS = global i32 0
@STATX_BTIME = global i32 0
@.str = [3 x i8] c"-F\00"
@.str.1 = [3 x i8] c"-D\00"
@.str.2 = [3 x i8] c"-L\00"
@.str.3 = [3 x i8] c"-O\00"
@.str.4 = [3 x i8] c"-A\00"
@AT_NO_AUTOMOUNT = global i32 0
@.str.5 = [3 x i8] c"-R\00"
@AT_FDCWD = global i32 0
@.str.6 = [16 x i8] c"statx(%s) = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.statx
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
%11 = load i32, i32* @AT_SYMLINK_NOFOLLOW
store i32 %11, i32* %9
%12 = load i32, i32* @STATX_BASIC_STATS
%13 = load i32, i32* @STATX_BTIME
%14 = or i32 %12, %13
store i32 %14, i32* %10
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i32 1
store i8** %16, i8*** %5
br label %17
17: ; preds = %103, %2
%18 = load i8**, i8*** %5
%19 = load i8*, i8** %18
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %106
21: ; preds = %17
%22 = load i8**, i8*** %5
%23 = load i8*, i8** %22
%24 = call i64 @strcmp(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %21
%27 = load i32, i32* %9
%28 = and i32 %27, -24577
store i32 %28, i32* %9
%29 = load i32, i32* %9
%30 = or i32 %29, 8192
store i32 %30, i32* %9
br label %103
31: ; preds = %21
%32 = load i8**, i8*** %5
%33 = load i8*, i8** %32
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %41
36: ; preds = %31
%37 = load i32, i32* %9
%38 = and i32 %37, -24577
store i32 %38, i32* %9
%39 = load i32, i32* %9
%40 = or i32 %39, 16384
store i32 %40, i32* %9
br label %103
41: ; preds = %31
%42 = load i8**, i8*** %5
%43 = load i8*, i8** %42
%44 = call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %51
46: ; preds = %41
%47 = load i32, i32* @AT_SYMLINK_NOFOLLOW
%48 = xor i32 %47, -1
%49 = load i32, i32* %9
%50 = and i32 %49, %48
store i32 %50, i32* %9
br label %103
51: ; preds = %41
%52 = load i8**, i8*** %5
%53 = load i8*, i8** %52
%54 = call i64 @strcmp(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %61
56: ; preds = %51
%57 = load i32, i32* @STATX_BASIC_STATS
%58 = xor i32 %57, -1
%59 = load i32, i32* %10
%60 = and i32 %59, %58
store i32 %60, i32* %10
br label %103
61: ; preds = %51
%62 = load i8**, i8*** %5
%63 = load i8*, i8** %62
%64 = call i64 @strcmp(i8* %63, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%65 = icmp eq i64 %64, 0
br i1 %65, label %66, label %70
66: ; preds = %61
%67 = load i32, i32* @AT_NO_AUTOMOUNT
%68 = load i32, i32* %9
%69 = or i32 %68, %67
store i32 %69, i32* %9
br label %103
70: ; preds = %61
%71 = load i8**, i8*** %5
%72 = load i8*, i8** %71
%73 = call i64 @strcmp(i8* %72, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %76
75: ; preds = %70
store i32 1, i32* %8
br label %103
76: ; preds = %70
%77 = call i32 @memset(%struct.statx* %6, i32 191, i32 4)
%78 = load i32, i32* @AT_FDCWD
%79 = load i8**, i8*** %5
%80 = load i8*, i8** %79
%81 = load i32, i32* %9
%82 = load i32, i32* %10
%83 = call i32 @statx(i32 %78, i8* %80, i32 %81, i32 %82, %struct.statx* %6)
store i32 %83, i32* %7
%84 = load i8**, i8*** %5
%85 = load i8*, i8** %84
%86 = load i32, i32* %7
%87 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %85, i32 %86)
%88 = load i32, i32* %7
%89 = icmp slt i32 %88, 0
br i1 %89, label %90, label %95
90: ; preds = %76
%91 = load i8**, i8*** %5
%92 = load i8*, i8** %91
%93 = call i32 @perror(i8* %92)
%94 = call i32 @exit(i32 1)
unreachable
95: ; preds = %76
%96 = load i32, i32* %8
%97 = icmp ne i32 %96, 0
br i1 %97, label %98, label %101
98: ; preds = %95
%99 = bitcast %struct.statx* %6 to i64*
%100 = call i32 @dump_hex(i64* %99, i32 0, i32 4)
br label %101
101: ; preds = %98, %95
%102 = call i32 @dump_statx(%struct.statx* %6)
br label %103
103: ; preds = %101, %75, %66, %56, %46, %36, %26
%104 = load i8**, i8*** %5
%105 = getelementptr inbounds i8*, i8** %104, i32 1
store i8** %105, i8*** %5
br label %17
106: ; preds = %17
ret i32 0
}

LLVM IR (-O2):
%struct.statx = type { i32 }
@AT_SYMLINK_NOFOLLOW = global i32 0
@STATX_BASIC_STATS = global i32 0
@STATX_BTIME = global i32 0
@.str = [3 x i8] c"-F\00"
@.str.1 = [3 x i8] c"-D\00"
@.str.2 = [3 x i8] c"-L\00"
@.str.3 = [3 x i8] c"-O\00"
@.str.4 = [3 x i8] c"-A\00"
@AT_NO_AUTOMOUNT = global i32 0
@.str.5 = [3 x i8] c"-R\00"
@AT_FDCWD = global i32 0
@.str.6 = [16 x i8] c"statx(%s) = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.statx
%4 = bitcast %struct.statx* %3 to i8*
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
br i1 %7, label %84, label %8
8: ; preds = %2
%9 = load i32, i32* @STATX_BTIME
%10 = load i32, i32* @STATX_BASIC_STATS
%11 = or i32 %9, %10
%12 = load i32, i32* @AT_SYMLINK_NOFOLLOW
%13 = bitcast %struct.statx* %3 to i64*
br label %14
14: ; preds = %8, %77
%15 = phi i8* [ %6, %8 ], [ %82, %77 ]
%16 = phi i8** [ %5, %8 ], [ %81, %77 ]
%17 = phi i32 [ %11, %8 ], [ %80, %77 ]
%18 = phi i32 [ %12, %8 ], [ %79, %77 ]
%19 = phi i32 [ 0, %8 ], [ %78, %77 ]
%20 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %14
%23 = and i32 %18, -24577
%24 = or i32 %23, 8192
br label %77
25: ; preds = %14
%26 = load i8*, i8** %16
%27 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = and i32 %18, -24577
%31 = or i32 %30, 16384
br label %77
32: ; preds = %25
%33 = load i8*, i8** %16
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %32
%37 = load i32, i32* @AT_SYMLINK_NOFOLLOW
%38 = xor i32 %37, -1
%39 = and i32 %18, %38
br label %77
40: ; preds = %32
%41 = load i8*, i8** %16
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %48
44: ; preds = %40
%45 = load i32, i32* @STATX_BASIC_STATS
%46 = xor i32 %45, -1
%47 = and i32 %17, %46
br label %77
48: ; preds = %40
%49 = load i8*, i8** %16
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %48
%53 = load i32, i32* @AT_NO_AUTOMOUNT
%54 = or i32 %53, %18
br label %77
55: ; preds = %48
%56 = load i8*, i8** %16
%57 = call i64 @strcmp(i8* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%58 = icmp eq i64 %57, 0
br i1 %58, label %77, label %59
59: ; preds = %55
%60 = call i32 @memset(%struct.statx* %3, i32 191, i32 4)
%61 = load i32, i32* @AT_FDCWD
%62 = load i8*, i8** %16
%63 = call i32 @statx(i32 %61, i8* %62, i32 %18, i32 %17, %struct.statx* %3)
%64 = load i8*, i8** %16
%65 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %64, i32 %63)
%66 = icmp slt i32 %63, 0
br i1 %66, label %67, label %71
67: ; preds = %59
%68 = load i8*, i8** %16
%69 = call i32 @perror(i8* %68)
%70 = call i32 @exit(i32 1)
unreachable
71: ; preds = %59
%72 = icmp eq i32 %19, 0
br i1 %72, label %75, label %73
73: ; preds = %71
%74 = call i32 @dump_hex(i64* %13, i32 0, i32 4)
br label %75
75: ; preds = %73, %71
%76 = call i32 @dump_statx(%struct.statx* %3)
br label %77
77: ; preds = %55, %75, %52, %44, %36, %29, %22
%78 = phi i32 [ %19, %22 ], [ %19, %29 ], [ %19, %36 ], [ %19, %44 ], [ %19, %52 ], [ %19, %75 ], [ 1, %55 ]
%79 = phi i32 [ %24, %22 ], [ %31, %29 ], [ %39, %36 ], [ %18, %44 ], [ %54, %52 ], [ %18, %75 ], [ %18, %55 ]
%80 = phi i32 [ %17, %22 ], [ %17, %29 ], [ %17, %36 ], [ %47, %44 ], [ %17, %52 ], [ %17, %75 ], [ %17, %55 ]
%81 = getelementptr inbounds i8*, i8** %16, i64 1
%82 = load i8*, i8** %81
%83 = icmp eq i8* %82, null
br i1 %83, label %84, label %14
84: ; preds = %77, %2
ret i32 0
}