#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_ALL;
unsigned int STATX_BASIC_STATS;
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_ALL;
  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    0x2e2c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    0x2e18(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     13a0 <main+0x220>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe23(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1207 <main+0x87>
mov    -0x24(%rbp),%eax
and    $0xffff9fff,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
or     $0x2000,%eax
mov    %eax,-0x24(%rbp)
jmp    138f <main+0x20f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xdee(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    123f <main+0xbf>
mov    -0x24(%rbp),%eax
and    $0xffff9fff,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
or     $0x4000,%eax
mov    %eax,-0x24(%rbp)
jmp    138f <main+0x20f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xdb9(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1273 <main+0xf3>
mov    0x2d6d(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    138f <main+0x20f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd88(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12a7 <main+0x127>
mov    0x2d61(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    138f <main+0x20f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd57(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12d8 <main+0x158>
mov    0x2d15(%rip),%rax
mov    (%rax),%eax
or     -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    138f <main+0x20f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd29(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1301 <main+0x181>
movl   $0x1,-0x20(%rbp)
jmp    138f <main+0x20f>
lea    -0x18(%rbp),%rdi
mov    $0xbf,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    0x2c9d(%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    0xccb(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x1c(%rbp)
jge    136c <main+0x1ec>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
cmpl   $0x0,-0x20(%rbp)
je     1386 <main+0x206>
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    11c1 <main+0x41>
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
sub    $0x18,%rsp
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     134c <main+0x1cc>
mov    %rsi,%rbx
add    $0x8,%rbx
mov    0x2e1f(%rip),%rax
mov    (%rax),%r12d
mov    0x2e1d(%rip),%r13
mov    0x0(%r13),%ebp
movl   $0x0,0xc(%rsp)
lea    0xe3a(%rip),%r14
lea    0xe36(%rip),%r15
jmp    11ed <main+0x6d>
nop
and    $0xffff9fff,%ebp
or     $0x2000,%ebp
mov    0x8(%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
je     134c <main+0x1cc>
mov    %r14,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11d0 <main+0x50>
mov    (%rbx),%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1300 <main+0x180>
mov    (%rbx),%rdi
lea    0xdee(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1311 <main+0x191>
mov    (%rbx),%rdi
lea    0xdd9(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     131e <main+0x19e>
mov    (%rbx),%rdi
lea    0xdc4(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1331 <main+0x1b1>
mov    (%rbx),%rdi
lea    0xdaf(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     133f <main+0x1bf>
mov    %r13,%r14
lea    0x10(%rsp),%r13
mov    %r13,%rdi
mov    $0xbf,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    0x2d29(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rsi
mov    %ebp,%edx
mov    %r12d,%r15d
mov    %r12d,%ecx
mov    %r13,%r12
mov    %r13,%r8
call   1080 <statx@plt>
mov    %eax,%r13d
mov    (%rbx),%rsi
lea    0xd5e(%rip),%rdi
mov    %eax,%edx
call   1030 <printf@plt>
test   %r13d,%r13d
js     135d <main+0x1dd>
cmpl   $0x0,0xc(%rsp)
mov    %r14,%r13
je     12dd <main+0x15d>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1070 <dump_hex@plt>
mov    %r12,%rdi
call   1060 <dump_statx@plt>
mov    %r15d,%r12d
lea    0xd11(%rip),%r14
lea    0xd0d(%rip),%r15
jmp    11dc <main+0x5c>
nopl   0x0(%rax,%rax,1)
and    $0xffff9fff,%ebp
or     $0x4000,%ebp
jmp    11dc <main+0x5c>
mov    0x0(%r13),%eax
not    %eax
and    %eax,%ebp
jmp    11dc <main+0x5c>
mov    0x2cd3(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %eax,%r12d
jmp    11dc <main+0x5c>
mov    0x2ca8(%rip),%rax
or     (%rax),%ebp
jmp    11dc <main+0x5c>
movl   $0x1,0xc(%rsp)
jmp    11dc <main+0x5c>
xor    %eax,%eax
add    $0x18,%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_ALL = 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"
@STATX_BASIC_STATS = global i32 0
@.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_ALL
store i32 %12, i32* %10
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i32 1
store i8** %14, i8*** %5
br label %15
15: ; preds = %101, %2
%16 = load i8**, i8*** %5
%17 = load i8*, i8** %16
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %104
19: ; preds = %15
%20 = load i8**, i8*** %5
%21 = load i8*, i8** %20
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %19
%25 = load i32, i32* %9
%26 = and i32 %25, -24577
store i32 %26, i32* %9
%27 = load i32, i32* %9
%28 = or i32 %27, 8192
store i32 %28, i32* %9
br label %101
29: ; preds = %19
%30 = load i8**, i8*** %5
%31 = load i8*, i8** %30
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %39
34: ; preds = %29
%35 = load i32, i32* %9
%36 = and i32 %35, -24577
store i32 %36, i32* %9
%37 = load i32, i32* %9
%38 = or i32 %37, 16384
store i32 %38, i32* %9
br label %101
39: ; preds = %29
%40 = load i8**, i8*** %5
%41 = load i8*, i8** %40
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %49
44: ; preds = %39
%45 = load i32, i32* @AT_SYMLINK_NOFOLLOW
%46 = xor i32 %45, -1
%47 = load i32, i32* %9
%48 = and i32 %47, %46
store i32 %48, i32* %9
br label %101
49: ; preds = %39
%50 = load i8**, i8*** %5
%51 = load i8*, i8** %50
%52 = call i64 @strcmp(i8* %51, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %59
54: ; preds = %49
%55 = load i32, i32* @STATX_BASIC_STATS
%56 = xor i32 %55, -1
%57 = load i32, i32* %10
%58 = and i32 %57, %56
store i32 %58, i32* %10
br label %101
59: ; preds = %49
%60 = load i8**, i8*** %5
%61 = load i8*, i8** %60
%62 = call i64 @strcmp(i8* %61, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %68
64: ; preds = %59
%65 = load i32, i32* @AT_NO_AUTOMOUNT
%66 = load i32, i32* %9
%67 = or i32 %66, %65
store i32 %67, i32* %9
br label %101
68: ; preds = %59
%69 = load i8**, i8*** %5
%70 = load i8*, i8** %69
%71 = call i64 @strcmp(i8* %70, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%72 = icmp eq i64 %71, 0
br i1 %72, label %73, label %74
73: ; preds = %68
store i32 1, i32* %8
br label %101
74: ; preds = %68
%75 = call i32 @memset(%struct.statx* %6, i32 191, i32 4)
%76 = load i32, i32* @AT_FDCWD
%77 = load i8**, i8*** %5
%78 = load i8*, i8** %77
%79 = load i32, i32* %9
%80 = load i32, i32* %10
%81 = call i32 @statx(i32 %76, i8* %78, i32 %79, i32 %80, %struct.statx* %6)
store i32 %81, i32* %7
%82 = load i8**, i8*** %5
%83 = load i8*, i8** %82
%84 = load i32, i32* %7
%85 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %83, i32 %84)
%86 = load i32, i32* %7
%87 = icmp slt i32 %86, 0
br i1 %87, label %88, label %93
88: ; preds = %74
%89 = load i8**, i8*** %5
%90 = load i8*, i8** %89
%91 = call i32 @perror(i8* %90)
%92 = call i32 @exit(i32 1)
unreachable
93: ; preds = %74
%94 = load i32, i32* %8
%95 = icmp ne i32 %94, 0
br i1 %95, label %96, label %99
96: ; preds = %93
%97 = bitcast %struct.statx* %6 to i64*
%98 = call i32 @dump_hex(i64* %97, i32 0, i32 4)
br label %99
99: ; preds = %96, %93
%100 = call i32 @dump_statx(%struct.statx* %6)
br label %101
101: ; preds = %99, %73, %64, %54, %44, %34, %24
%102 = load i8**, i8*** %5
%103 = getelementptr inbounds i8*, i8** %102, i32 1
store i8** %103, i8*** %5
br label %15
104: ; preds = %15
ret i32 0
}

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