#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;
scalar_t__ fprintf(int /*<<< orphan*/ *, char *, char *, char *, char *, char *,
                   int, int);
scalar_t__ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/, int /*<<< orphan*/);
int addmntent(FILE *f, const struct mntent *mnt) {
  if (fseek(f, 0, SEEK_END))
    return 1;
  return fprintf(f, "%s\t%s\t%s\t%s\t%d\t%d\n", mnt->mnt_fsname, mnt->mnt_dir,
                 mnt->mnt_type, mnt->mnt_opts, mnt->mnt_freq,
                 mnt->mnt_passno) < 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
je     115a <addmntent+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    11af <addmntent+0x8f>
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    $0x0,%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-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>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    1175 <addmntent+0x55>
mov    (%rbx),%rdx
mov    0x8(%rbx),%rcx
mov    0x10(%rbx),%r8
mov    0x18(%rbx),%r9
mov    0x20(%rbx),%eax
mov    0x24(%rbx),%ebx
lea    0xe9d(%rip),%rsi
mov    %r14,%rdi
push   %rbx
push   %rax
call   1030 <fprintf@plt>
add    $0x10,%rsp
shr    $0x3f,%rax
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\09%s\09%s\09%s\09%d\09%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 ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %3
br label %34
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 i64 @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 i64 %31, 0
%33 = zext i1 %32 to i32
store i32 %33, i32* %3
br label %34
34: ; preds = %11, %10
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
%struct.mntent = type { i8*, i8*, i8*, i8*, i32, i32 }
@SEEK_END = global i32 0
@.str = [19 x i8] c"%s\09%s\09%s\09%s\09%d\09%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 eq i64 %4, 0
br i1 %5, label %6, label %22
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 i64 @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 = lshr i64 %19, 63
%21 = trunc i64 %20 to i32
br label %22
22: ; preds = %2, %6
%23 = phi i32 [ %21, %6 ], [ 1, %2 ]
ret i32 %23
}