#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 {
  char *mnt_fsname;
  char *mnt_dir;
  char *mnt_type;
  char *mnt_opts;
  int mnt_freq;
  int mnt_passno;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int fprintf(int /*<<< orphan*/ *, char *, char *, char *, char *, char *, int,
            int);
scalar_t__ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/, int /*<<< orphan*/);
int addmntent(FILE *filep, const struct mntent *mnt) {
  if (fseek(filep, 0, SEEK_END) < 0)
    return 1;
  if (fprintf(filep, "%s %s %s %s %d %d\n", mnt->mnt_fsname, mnt->mnt_dir,
              mnt->mnt_type, mnt->mnt_opts, mnt->mnt_freq, mnt->mnt_passno) < 1)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<addmntent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2ead(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
cmp    $0x0,%rax
jge    115a <addmntent+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    11bc <addmntent+0x9c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%r8
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%r9
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%r10d
mov    -0x18(%rbp),%rax
mov    0x24(%rax),%eax
lea    0xe6d(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <fprintf@plt>
cmp    $0x1,%eax
jge    11b5 <addmntent+0x95>
movl   $0x1,-0x4(%rbp)
jmp    11bc <addmntent+0x9c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addmntent>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    0x2eb7(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
test   %rax,%rax
js     1174 <addmntent+0x54>
mov    (%rbx),%rdx
mov    0x8(%rbx),%rcx
mov    0x10(%rbx),%r8
mov    0x18(%rbx),%r9
mov    0x20(%rbx),%eax
mov    0x24(%rbx),%ebx
lea    0xea5(%rip),%rsi
mov    %r14,%rdi
push   %rbx
push   %rax
call   1030 <fprintf@plt>
add    $0x10,%rsp
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
setle  %al
jmp    1179 <addmntent+0x59>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.mntent = type { i8*, i8*, i8*, i8*, i32, i32 }
@SEEK_END = global i32 0
@.str = [19 x i8] c"%s %s %s %s %d %d\0A\00"
define i32 @addmntent(i32* %0, %struct.mntent* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca %struct.mntent*
store i32* %0, i32** %4
store %struct.mntent* %1, %struct.mntent** %5
%6 = load i32*, i32** %4
%7 = load i32, i32* @SEEK_END
%8 = call i64 @fseek(i32* %6, i32 0, i32 %7)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %3
br label %35
11: ; preds = %2
%12 = load i32*, i32** %4
%13 = load %struct.mntent*, %struct.mntent** %5
%14 = getelementptr inbounds %struct.mntent, %struct.mntent* %13, i32 0, i32 0
%15 = load i8*, i8** %14
%16 = load %struct.mntent*, %struct.mntent** %5
%17 = getelementptr inbounds %struct.mntent, %struct.mntent* %16, i32 0, i32 1
%18 = load i8*, i8** %17
%19 = load %struct.mntent*, %struct.mntent** %5
%20 = getelementptr inbounds %struct.mntent, %struct.mntent* %19, i32 0, i32 2
%21 = load i8*, i8** %20
%22 = load %struct.mntent*, %struct.mntent** %5
%23 = getelementptr inbounds %struct.mntent, %struct.mntent* %22, i32 0, i32 3
%24 = load i8*, i8** %23
%25 = load %struct.mntent*, %struct.mntent** %5
%26 = getelementptr inbounds %struct.mntent, %struct.mntent* %25, i32 0, i32 4
%27 = load i32, i32* %26
%28 = load %struct.mntent*, %struct.mntent** %5
%29 = getelementptr inbounds %struct.mntent, %struct.mntent* %28, i32 0, i32 5
%30 = load i32, i32* %29
%31 = call i32 @fprintf(i32* %12, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %18, i8* %21, i8* %24, i32 %27, i32 %30)
%32 = icmp slt i32 %31, 1
br i1 %32, label %33, label %34
33: ; preds = %11
store i32 1, i32* %3
br label %35
34: ; preds = %11
store i32 0, i32* %3
br label %35
35: ; preds = %34, %33, %10
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
%struct.mntent = type { i8*, i8*, i8*, i8*, i32, i32 }
@SEEK_END = global i32 0
@.str = [19 x i8] c"%s %s %s %s %d %d\0A\00"
define i32 @addmntent(i32* nocapture %0, %struct.mntent* nocapture %1) {
%3 = load i32, i32* @SEEK_END
%4 = tail call i64 @fseek(i32* %0, i32 0, i32 %3)
%5 = icmp slt i64 %4, 0
br i1 %5, label %22, label %6
6: ; preds = %2
%7 = getelementptr inbounds %struct.mntent, %struct.mntent* %1, i64 0, i32 0
%8 = load i8*, i8** %7
%9 = getelementptr inbounds %struct.mntent, %struct.mntent* %1, i64 0, i32 1
%10 = load i8*, i8** %9
%11 = getelementptr inbounds %struct.mntent, %struct.mntent* %1, i64 0, i32 2
%12 = load i8*, i8** %11
%13 = getelementptr inbounds %struct.mntent, %struct.mntent* %1, i64 0, i32 3
%14 = load i8*, i8** %13
%15 = getelementptr inbounds %struct.mntent, %struct.mntent* %1, i64 0, i32 4
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.mntent, %struct.mntent* %1, i64 0, i32 5
%18 = load i32, i32* %17
%19 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %10, i8* %12, i8* %14, i32 %16, i32 %18)
%20 = icmp slt i32 %19, 1
%21 = zext i1 %20 to i32
br label %22
22: ; preds = %6, %2
%23 = phi i32 [ 1, %2 ], [ %21, %6 ]
ret i32 %23
}