#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 */
struct mntent *getmntent(int /*<<< orphan*/ *);
int /*<<< orphan*/ *setmntent(char *, char *);
int main(void) {
  struct mntent *m;
  FILE *f;
  char *fsname, *dir, *type, *opts;
  int freq, passno;
  f = setmntent("/etc/fstab", "r");
  m = getmntent(f);
  fsname = m->mnt_fsname;
  dir = m->mnt_dir;
  type = m->mnt_type;
  opts = m->mnt_opts;
  freq = m->mnt_freq;
  passno = m->mnt_passno;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    0xece(%rip),%rsi
call   1040 <setmntent@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <getmntent@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x24(%rax),%eax
mov    %eax,-0x40(%rbp)
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xedc(%rip),%rsi
call   1040 <setmntent@plt>
mov    %rax,%rdi
call   1030 <getmntent@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.mntent = type { i8*, i8*, i8*, i8*, i32, i32 }
@.str = [11 x i8] c"/etc/fstab\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.mntent*
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = call i32* @setmntent(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %3
%11 = load i32*, i32** %3
%12 = call %struct.mntent* @getmntent(i32* %11)
store %struct.mntent* %12, %struct.mntent** %2
%13 = load %struct.mntent*, %struct.mntent** %2
%14 = getelementptr inbounds %struct.mntent, %struct.mntent* %13, i32 0, i32 0
%15 = load i8*, i8** %14
store i8* %15, i8** %4
%16 = load %struct.mntent*, %struct.mntent** %2
%17 = getelementptr inbounds %struct.mntent, %struct.mntent* %16, i32 0, i32 1
%18 = load i8*, i8** %17
store i8* %18, i8** %5
%19 = load %struct.mntent*, %struct.mntent** %2
%20 = getelementptr inbounds %struct.mntent, %struct.mntent* %19, i32 0, i32 2
%21 = load i8*, i8** %20
store i8* %21, i8** %6
%22 = load %struct.mntent*, %struct.mntent** %2
%23 = getelementptr inbounds %struct.mntent, %struct.mntent* %22, i32 0, i32 3
%24 = load i8*, i8** %23
store i8* %24, i8** %7
%25 = load %struct.mntent*, %struct.mntent** %2
%26 = getelementptr inbounds %struct.mntent, %struct.mntent* %25, i32 0, i32 4
%27 = load i32, i32* %26
store i32 %27, i32* %8
%28 = load %struct.mntent*, %struct.mntent** %2
%29 = getelementptr inbounds %struct.mntent, %struct.mntent* %28, i32 0, i32 5
%30 = load i32, i32* %29
store i32 %30, i32* %9
ret i32 0
}

LLVM IR (-O2):
%struct.mntent = type { i8*, i8*, i8*, i8*, i32, i32 }
@.str = [11 x i8] c"/etc/fstab\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @main() {
%1 = tail call i32* @setmntent(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call %struct.mntent* @getmntent(i32* %1)
ret i32 0
}