#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 mntent {
  int /*<<< orphan*/ mnt_dir;
};
typedef int /*<<< orphan*/ path;
typedef int /*<<< orphan*/ a;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EINVAL;
int PATH_MAX;
char *au_decode_mntpnt(char *, char *, int);
int /*<<< orphan*/ copy_ent(struct mntent *, struct mntent *);
int /*<<< orphan*/ endmntent(int /*<<< orphan*/ *);
int errno;
int /*<<< orphan*/ error_at_line(int, int, char *, int, char *, ...);
struct mntent *getmntent_r(int /*<<< orphan*/ *, struct mntent *, char *, int);
int /*<<< orphan*/ memset(struct mntent *, int /*<<< orphan*/, int);
int /*<<< orphan*/ *setmntent(char *, char *);
int /*<<< orphan*/ strcmp(int /*<<< orphan*/, char *);
int au_proc_getmntent(char *mntpnt, struct mntent *rent) {
  int found;
  struct mntent *p, e;
  FILE *fp;
  char a[4096 + 1024], path[PATH_MAX], *decoded;
  decoded = au_decode_mntpnt(mntpnt, path, sizeof(path));
  if (!decoded)
    do {
      if (!errno)
        errno = -1;
      error_at_line(errno, errno,
                    "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                    "outputs/2022-01-22/02-19-57/repos/JanLuca/"
                    "aufs-tools-debian/refs/heads/master/proc_mnt.c",
                    79, "au_decode_mntpnt");
    } while (0);
  fp = setmntent("/proc/self/mounts", "r");
  if (!fp)
    do {
      if (!errno)
        errno = -1;
      error_at_line(errno, errno,
                    "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                    "outputs/2022-01-22/02-19-57/repos/JanLuca/"
                    "aufs-tools-debian/refs/heads/master/proc_mnt.c",
                    83, "/proc/self/mounts");
    } while (0);
  memset(rent, 0, sizeof(*rent));
  found = 0;
  while ((p = getmntent_r(fp, &e, a, sizeof(a))))
    if (!strcmp(p->mnt_dir, decoded)) {
      do {
      } while (0);
      copy_ent(rent, p);
      found = 1;
    }
  endmntent(fp);
  if (!found) {
    errno = EINVAL;
    do {
      if (!errno)
        errno = -1;
      error_at_line(errno, errno,
                    "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                    "outputs/2022-01-22/02-19-57/repos/JanLuca/"
                    "aufs-tools-debian/refs/heads/master/proc_mnt.c",
                    100, "%s, %s", mntpnt, decoded);
    } while (0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<au_proc_getmntent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1450,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e56(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x1438(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rsi
sub    %rcx,%rsi
mov    %rsi,%rsp
mov    %rax,-0x1440(%rbp)
mov    -0x8(%rbp),%rdi
mov    %eax,%edx
call   1070 <au_decode_mntpnt@plt>
mov    %rax,-0x1448(%rbp)
cmpq   $0x0,-0x1448(%rbp)
jne    1239 <au_proc_getmntent+0xb9>
jmp    11e6 <au_proc_getmntent+0x66>
mov    0x2deb(%rip),%rax
cmpl   $0x0,(%rax)
jne    1203 <au_proc_getmntent+0x83>
mov    0x2ddb(%rip),%rax
movl   $0xffffffff,(%rax)
mov    0x2dce(%rip),%rax
mov    (%rax),%edi
mov    0x2dc5(%rip),%rax
mov    (%rax),%esi
lea    0xde4(%rip),%rdx
mov    $0x4f,%ecx
lea    0xe69(%rip),%r8
mov    $0x0,%al
call   1040 <error_at_line@plt>
jmp    1234 <au_proc_getmntent+0xb4>
jmp    1239 <au_proc_getmntent+0xb9>
lea    0xe62(%rip),%rdi
lea    0xe6d(%rip),%rsi
call   10a0 <setmntent@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12b3 <au_proc_getmntent+0x133>
jmp    1260 <au_proc_getmntent+0xe0>
mov    0x2d71(%rip),%rax
cmpl   $0x0,(%rax)
jne    127d <au_proc_getmntent+0xfd>
mov    0x2d61(%rip),%rax
movl   $0xffffffff,(%rax)
mov    0x2d54(%rip),%rax
mov    (%rax),%edi
mov    0x2d4b(%rip),%rax
mov    (%rax),%esi
lea    0xd6a(%rip),%rdx
mov    $0x53,%ecx
lea    0xe00(%rip),%r8
mov    $0x0,%al
call   1040 <error_at_line@plt>
jmp    12ae <au_proc_getmntent+0x12e>
jmp    12b3 <au_proc_getmntent+0x133>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1080 <memset@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x30(%rbp),%rdi
lea    -0x1430(%rbp),%rdx
lea    -0x28(%rbp),%rsi
mov    $0x1400,%ecx
call   1050 <getmntent_r@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     1334 <au_proc_getmntent+0x1b4>
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
mov    -0x1448(%rbp),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    132f <au_proc_getmntent+0x1af>
jmp    1311 <au_proc_getmntent+0x191>
jmp    1316 <au_proc_getmntent+0x196>
jmp    131b <au_proc_getmntent+0x19b>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1060 <copy_ent@plt>
movl   $0x1,-0x14(%rbp)
jmp    12ca <au_proc_getmntent+0x14a>
mov    -0x30(%rbp),%rdi
call   1030 <endmntent@plt>
cmpl   $0x0,-0x14(%rbp)
jne    13c3 <au_proc_getmntent+0x243>
mov    0x2c82(%rip),%rax
mov    (%rax),%ecx
mov    0x2c81(%rip),%rax
mov    %ecx,(%rax)
mov    0x2c78(%rip),%rax
cmpl   $0x0,(%rax)
jne    1376 <au_proc_getmntent+0x1f6>
mov    0x2c68(%rip),%rax
movl   $0xffffffff,(%rax)
mov    0x2c5b(%rip),%rax
mov    (%rax),%edi
mov    0x2c52(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%r9
mov    -0x1448(%rbp),%rax
lea    0xc66(%rip),%rdx
mov    $0x64,%ecx
lea    0xd10(%rip),%r8
sub    $0x10,%rsp
mov    %rax,(%rsp)
mov    $0x0,%al
call   1040 <error_at_line@plt>
add    $0x10,%rsp
jmp    13be <au_proc_getmntent+0x23e>
jmp    13c3 <au_proc_getmntent+0x243>
mov    -0x1438(%rbp),%rax
mov    %rax,%rsp
xor    %eax,%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<au_proc_getmntent>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1428,%rsp
mov    %rsi,-0x38(%rbp)
mov    %rdi,%r13
mov    %rsp,%r14
mov    0x2e4b(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rsi
mov    %rdx,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rsi
mov    %rsi,%rsp
call   1070 <au_decode_mntpnt@plt>
mov    %rax,%r12
test   %rax,%rax
jne    11fc <au_proc_getmntent+0x7c>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
test   %edi,%edi
jne    11e0 <au_proc_getmntent+0x60>
movl   $0xffffffff,(%rax)
mov    $0xffffffff,%edi
lea    0xe19(%rip),%rdx
lea    0xea3(%rip),%r8
mov    %edi,%esi
mov    $0x4f,%ecx
xor    %eax,%eax
call   1040 <error_at_line@plt>
lea    0xe9f(%rip),%rdi
lea    0xeaa(%rip),%rsi
call   10a0 <setmntent@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    124b <au_proc_getmntent+0xcb>
mov    0x2dba(%rip),%rax
mov    (%rax),%edi
test   %edi,%edi
jne    122f <au_proc_getmntent+0xaf>
movl   $0xffffffff,(%rax)
mov    $0xffffffff,%edi
lea    0xdca(%rip),%rdx
lea    0xe65(%rip),%r8
mov    %edi,%esi
mov    $0x53,%ecx
xor    %eax,%eax
call   1040 <error_at_line@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1080 <memset@plt>
lea    -0x30(%rbp),%rsi
lea    -0x1450(%rbp),%rdx
mov    %rbx,%rdi
mov    $0x1400,%ecx
call   1050 <getmntent_r@plt>
test   %rax,%rax
je     12f7 <au_proc_getmntent+0x177>
mov    %rax,%r15
mov    %r13,-0x40(%rbp)
mov    %r14,-0x48(%rbp)
lea    -0x30(%rbp),%r13
lea    -0x1450(%rbp),%r14
jmp    12bb <au_proc_getmntent+0x13b>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
mov    $0x1400,%ecx
call   1050 <getmntent_r@plt>
mov    %rax,%r15
test   %rax,%rax
je     12df <au_proc_getmntent+0x15f>
mov    (%r15),%edi
mov    %r12,%rsi
call   1090 <strcmp@plt>
test   %eax,%eax
jne    12a0 <au_proc_getmntent+0x120>
mov    -0x38(%rbp),%rdi
mov    %r15,%rsi
call   1060 <copy_ent@plt>
movl   $0x1,-0x2c(%rbp)
jmp    12a0 <au_proc_getmntent+0x120>
mov    %rbx,%rdi
call   1030 <endmntent@plt>
cmpl   $0x0,-0x2c(%rbp)
mov    -0x48(%rbp),%r14
mov    -0x40(%rbp),%r13
jne    1341 <au_proc_getmntent+0x1c1>
jmp    12ff <au_proc_getmntent+0x17f>
mov    %rbx,%rdi
call   1030 <endmntent@plt>
mov    0x2cca(%rip),%rax
mov    (%rax),%eax
cmp    $0x1,%eax
sbb    %edi,%edi
or     %eax,%edi
mov    0x2cc2(%rip),%rax
mov    %edi,(%rax)
sub    $0x8,%rsp
lea    0xcdd(%rip),%rdx
lea    0xd8c(%rip),%r8
mov    %edi,%esi
mov    $0x64,%ecx
mov    %r13,%r9
xor    %eax,%eax
push   %r12
call   1040 <error_at_line@plt>
add    $0x10,%rsp
mov    %r14,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.mntent = type { i32 }
@PATH_MAX = global i32 0
@errno = global i32 0
@.str = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/JanLuca/aufs-tools-debian/refs/heads/master/proc_mnt.c\00"
@.str.1 = [17 x i8] c"au_decode_mntpnt\00"
@.str.2 = [18 x i8] c"/proc/self/mounts\00"
@.str.3 = [2 x i8] c"r\00"
@EINVAL = global i32 0
@.str.4 = [7 x i8] c"%s, %s\00"
define i32 @au_proc_getmntent(i8* %0, %struct.mntent* %1) {
%3 = alloca i8*
%4 = alloca %struct.mntent*
%5 = alloca i32
%6 = alloca %struct.mntent*
%7 = alloca %struct.mntent
%8 = alloca i32*
%9 = alloca [5120 x i8]
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i8*
store i8* %0, i8** %3
store %struct.mntent* %1, %struct.mntent** %4
%13 = load i32, i32* @PATH_MAX
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %10
%16 = alloca i8, i64 %14
store i64 %14, i64* %11
%17 = load i8*, i8** %3
%18 = trunc i64 %14 to i32
%19 = call i8* @au_decode_mntpnt(i8* %17, i8* %16, i32 %18)
store i8* %19, i8** %12
%20 = load i8*, i8** %12
%21 = icmp ne i8* %20, null
br i1 %21, label %33, label %22
22: ; preds = %2
br label %23
23: ; preds = %22
%24 = load i32, i32* @errno
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %23
store i32 -1, i32* @errno
br label %27
27: ; preds = %26, %23
%28 = load i32, i32* @errno
%29 = load i32, i32* @errno
%30 = call i32 (i32, i32, i8*, i32, i8*, ...) @error_at_line(i32 %28, i32 %29, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i32 79, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %31
31: ; preds = %27
br label %32
32: ; preds = %31
br label %33
33: ; preds = %32, %2
%34 = call i32* @setmntent(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %34, i32** %8
%35 = load i32*, i32** %8
%36 = icmp ne i32* %35, null
br i1 %36, label %48, label %37
37: ; preds = %33
br label %38
38: ; preds = %37
%39 = load i32, i32* @errno
%40 = icmp ne i32 %39, 0
br i1 %40, label %42, label %41
41: ; preds = %38
store i32 -1, i32* @errno
br label %42
42: ; preds = %41, %38
%43 = load i32, i32* @errno
%44 = load i32, i32* @errno
%45 = call i32 (i32, i32, i8*, i32, i8*, ...) @error_at_line(i32 %43, i32 %44, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i32 83, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %46
46: ; preds = %42
br label %47
47: ; preds = %46
br label %48
48: ; preds = %47, %33
%49 = load %struct.mntent*, %struct.mntent** %4
%50 = call i32 @memset(%struct.mntent* %49, i32 0, i32 4)
store i32 0, i32* %5
br label %51
51: ; preds = %70, %48
%52 = load i32*, i32** %8
%53 = getelementptr inbounds [5120 x i8], [5120 x i8]* %9, i64 0, i64 0
%54 = call %struct.mntent* @getmntent_r(i32* %52, %struct.mntent* %7, i8* %53, i32 5120)
store %struct.mntent* %54, %struct.mntent** %6
%55 = icmp ne %struct.mntent* %54, null
br i1 %55, label %56, label %71
56: ; preds = %51
%57 = load %struct.mntent*, %struct.mntent** %6
%58 = getelementptr inbounds %struct.mntent, %struct.mntent* %57, i32 0, i32 0
%59 = load i32, i32* %58
%60 = load i8*, i8** %12
%61 = call i32 @strcmp(i32 %59, i8* %60)
%62 = icmp ne i32 %61, 0
br i1 %62, label %70, label %63
63: ; preds = %56
br label %64
64: ; preds = %63
br label %65
65: ; preds = %64
br label %66
66: ; preds = %65
%67 = load %struct.mntent*, %struct.mntent** %4
%68 = load %struct.mntent*, %struct.mntent** %6
%69 = call i32 @copy_ent(%struct.mntent* %67, %struct.mntent* %68)
store i32 1, i32* %5
br label %70
70: ; preds = %66, %56
br label %51
71: ; preds = %51
%72 = load i32*, i32** %8
%73 = call i32 @endmntent(i32* %72)
%74 = load i32, i32* %5
%75 = icmp ne i32 %74, 0
br i1 %75, label %90, label %76
76: ; preds = %71
%77 = load i32, i32* @EINVAL
store i32 %77, i32* @errno
br label %78
78: ; preds = %76
%79 = load i32, i32* @errno
%80 = icmp ne i32 %79, 0
br i1 %80, label %82, label %81
81: ; preds = %78
store i32 -1, i32* @errno
br label %82
82: ; preds = %81, %78
%83 = load i32, i32* @errno
%84 = load i32, i32* @errno
%85 = load i8*, i8** %3
%86 = load i8*, i8** %12
%87 = call i32 (i32, i32, i8*, i32, i8*, ...) @error_at_line(i32 %83, i32 %84, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i32 100, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %85, i8* %86)
br label %88
88: ; preds = %82
br label %89
89: ; preds = %88
br label %90
90: ; preds = %89, %71
%91 = load i8*, i8** %10
ret i32 0
}

LLVM IR (-O2):
%struct.mntent = type { i32 }
@PATH_MAX = global i32 0
@errno = global i32 0
@.str = [145 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/JanLuca/aufs-tools-debian/refs/heads/master/proc_mnt.c\00"
@.str.1 = [17 x i8] c"au_decode_mntpnt\00"
@.str.2 = [18 x i8] c"/proc/self/mounts\00"
@.str.3 = [2 x i8] c"r\00"
@EINVAL = global i32 0
@.str.4 = [7 x i8] c"%s, %s\00"
define i32 @au_proc_getmntent(i8* %0, %struct.mntent* %1) {
%3 = alloca %struct.mntent
%4 = alloca [5120 x i8]
%5 = bitcast %struct.mntent* %3 to i8*
%6 = getelementptr inbounds [5120 x i8], [5120 x i8]* %4, i64 0, i64 0
%7 = load i32, i32* @PATH_MAX
%8 = zext i32 %7 to i64
%9 = tail call i8* @llvm.stacksave()
%10 = alloca i8, i64 %8
%11 = call i8* @au_decode_mntpnt(i8* %0, i8* %10, i32 %7)
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %20
13: ; preds = %2
%14 = load i32, i32* @errno
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 -1, i32* @errno
br label %17
17: ; preds = %16, %13
%18 = phi i32 [ -1, %16 ], [ %14, %13 ]
%19 = call i32 (i32, i32, i8*, i32, i8*, ...) @error_at_line(i32 %18, i32 %18, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i32 79, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %17, %2
%21 = call i32* @setmntent(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %30
23: ; preds = %20
%24 = load i32, i32* @errno
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 -1, i32* @errno
br label %27
27: ; preds = %26, %23
%28 = phi i32 [ -1, %26 ], [ %24, %23 ]
%29 = call i32 (i32, i32, i8*, i32, i8*, ...) @error_at_line(i32 %28, i32 %28, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i32 83, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
br label %30
30: ; preds = %27, %20
%31 = call i32 @memset(%struct.mntent* %1, i32 0, i32 4)
%32 = call %struct.mntent* @getmntent_r(i32* %21, %struct.mntent* %3, i8* %6, i32 5120)
%33 = icmp eq %struct.mntent* %32, null
br i1 %33, label %34, label %36
34: ; preds = %30
%35 = call i32 @endmntent(i32* %21)
br label %52
36: ; preds = %30, %45
%37 = phi %struct.mntent* [ %47, %45 ], [ %32, %30 ]
%38 = phi i32 [ %46, %45 ], [ 0, %30 ]
%39 = getelementptr inbounds %struct.mntent, %struct.mntent* %37, i64 0, i32 0
%40 = load i32, i32* %39
%41 = call i32 @strcmp(i32 %40, i8* %11)
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %36
%44 = call i32 @copy_ent(%struct.mntent* %1, %struct.mntent* %37)
br label %45
45: ; preds = %43, %36
%46 = phi i32 [ %38, %36 ], [ 1, %43 ]
%47 = call %struct.mntent* @getmntent_r(i32* %21, %struct.mntent* %3, i8* %6, i32 5120)
%48 = icmp eq %struct.mntent* %47, null
br i1 %48, label %49, label %36
49: ; preds = %45
%50 = call i32 @endmntent(i32* %21)
%51 = icmp eq i32 %46, 0
br i1 %51, label %52, label %57
52: ; preds = %34, %49
%53 = load i32, i32* @EINVAL
%54 = icmp eq i32 %53, 0
%55 = select i1 %54, i32 -1, i32 %53
store i32 %55, i32* @errno
%56 = call i32 (i32, i32, i8*, i32, i8*, ...) @error_at_line(i32 %55, i32 %55, i8* getelementptr inbounds ([145 x i8], [145 x i8]* @.str, i64 0, i64 0), i32 100, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %0, i8* %11)
br label %57
57: ; preds = %52, %49
ret i32 0
}