#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 stat {
  int /*<<< orphan*/ st_rdev;
  int /*<<< orphan*/ st_mode;
};
struct mntent {
  char *mnt_type;
  char *mnt_dir;
  int /*<<< orphan*/ mnt_fsname;
};
typedef int /*<<< orphan*/ errdir;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
unsigned int FIFREEZE;
unsigned int FITHAW;
int /*<<< orphan*/ LOG_ERR;
scalar_t__ LOOP_MAJOR;
int /*<<< orphan*/ MNTOPT_RO;
scalar_t__ S_ISBLK(int /*<<< orphan*/);
#define VSS_OP_FREEZE 129
#define VSS_OP_THAW 128
int /*<<< orphan*/ endmntent(int /*<<< orphan*/ *);
int errno;
struct mntent *getmntent(int /*<<< orphan*/ *);
int /*<<< orphan*/ *hasmntopt(struct mntent *, int /*<<< orphan*/);
scalar_t__ major(int /*<<< orphan*/);
int /*<<< orphan*/ *setmntent(char *, char *);
int stat(int /*<<< orphan*/, struct stat *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strerror(int);
int /*<<< orphan*/ strlen(char *);
scalar_t__ strncmp(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, ...);
int vss_do_freeze(char *, unsigned int);
int vss_operate(int operation) {
  char match[] = "/dev/";
  FILE *mounts;
  struct mntent *ent;
  struct stat sb;
  char errdir[1024] = {0};
  unsigned int cmd;
  int error = 0, root_seen = 0, save_errno = 0;
  switch (operation) {
  case VSS_OP_FREEZE:
    cmd = FIFREEZE;
    break;
  case VSS_OP_THAW:
    cmd = FITHAW;
    break;
  default:
    return -1;
  }
  mounts = setmntent("/proc/mounts", "r");
  if (mounts == NULL)
    return -1;
  while ((ent = getmntent(mounts))) {
    if (strncmp(ent->mnt_fsname, match, strlen(match)))
      continue;
    if (stat(ent->mnt_fsname, &sb) == -1)
      continue;
    if (S_ISBLK(sb.st_mode) && major(sb.st_rdev) == LOOP_MAJOR)
      continue;
    if (hasmntopt(ent, MNTOPT_RO) != NULL)
      continue;
    if (strcmp(ent->mnt_type, "vfat") == 0)
      continue;
    if (strcmp(ent->mnt_dir, "/") == 0) {
      root_seen = 1;
      continue;
    }
    error |= vss_do_freeze(ent->mnt_dir, cmd);
    if (error && operation == VSS_OP_FREEZE)
      goto err;
  }
  endmntent(mounts);
  if (root_seen) {
    error |= vss_do_freeze("/", cmd);
    if (error && operation == VSS_OP_FREEZE)
      goto err;
  }
  goto out;
err:
  save_errno = errno;
  if (ent) {
    strncpy(errdir, ent->mnt_dir, sizeof(errdir) - 1);
    endmntent(mounts);
  }
  vss_operate(VSS_OP_THAW);
  if (ent)
    syslog(LOG_ERR, "FREEZE of %s failed; error:%d %s", errdir, save_errno,
           strerror(save_errno));
  else
    syslog(LOG_ERR, "FREEZE of / failed; error:%d %s", save_errno,
           strerror(save_errno));
out:
  return error;
}


x86 assembly (clang, -O0):
<vss_operate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x470,%rsp
mov    %edi,-0x8(%rbp)
movw   $0x2f,-0xc(%rbp)
movl   $0x7665642f,-0x10(%rbp)
lea    -0x430(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
movl   $0x0,-0x438(%rbp)
movl   $0x0,-0x43c(%rbp)
movl   $0x0,-0x440(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x444(%rbp)
sub    $0x80,%eax
je     128f <vss_operate+0x8f>
jmp    1265 <vss_operate+0x65>
mov    -0x444(%rbp),%eax
sub    $0x81,%eax
jne    12a3 <vss_operate+0xa3>
jmp    127b <vss_operate+0x7b>
mov    0x2d56(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x434(%rbp)
jmp    12af <vss_operate+0xaf>
mov    0x2d22(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x434(%rbp)
jmp    12af <vss_operate+0xaf>
movl   $0xffffffff,-0x4(%rbp)
jmp    1598 <vss_operate+0x398>
lea    0xd50(%rip),%rdi
lea    0xd56(%rip),%rsi
call   10d0 <setmntent@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    12dd <vss_operate+0xdd>
movl   $0xffffffff,-0x4(%rbp)
jmp    1598 <vss_operate+0x398>
jmp    12e2 <vss_operate+0xe2>
mov    -0x18(%rbp),%rdi
call   10c0 <getmntent@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     143d <vss_operate+0x23d>
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%eax
mov    %eax,-0x454(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x450(%rbp)
lea    -0x10(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x454(%rbp),%edi
mov    -0x450(%rbp),%rsi
mov    %eax,%edx
call   1050 <strncmp@plt>
cmp    $0x0,%rax
je     133d <vss_operate+0x13d>
jmp    12e2 <vss_operate+0xe2>
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%edi
lea    -0x28(%rbp),%rsi
call   10b0 <stat@plt>
cmp    $0xffffffff,%eax
jne    135b <vss_operate+0x15b>
jmp    12e2 <vss_operate+0xe2>
mov    -0x24(%rbp),%edi
call   10f0 <S_ISBLK@plt>
cmp    $0x0,%rax
je     138a <vss_operate+0x18a>
mov    -0x28(%rbp),%edi
call   1070 <major@plt>
mov    0x2c64(%rip),%rcx
cmp    (%rcx),%rax
jne    138a <vss_operate+0x18a>
jmp    12e2 <vss_operate+0xe2>
mov    -0x20(%rbp),%rdi
mov    0x2c53(%rip),%rax
mov    (%rax),%esi
call   1120 <hasmntopt@plt>
cmp    $0x0,%rax
je     13ab <vss_operate+0x1ab>
jmp    12e2 <vss_operate+0xe2>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
lea    0xc5c(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    13cd <vss_operate+0x1cd>
jmp    12e2 <vss_operate+0xe2>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xc28(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    13fa <vss_operate+0x1fa>
movl   $0x1,-0x43c(%rbp)
jmp    12e2 <vss_operate+0xe2>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x434(%rbp),%esi
call   1090 <vss_do_freeze@plt>
or     -0x438(%rbp),%eax
mov    %eax,-0x438(%rbp)
cmpl   $0x0,-0x438(%rbp)
je     1438 <vss_operate+0x238>
cmpl   $0x81,-0x8(%rbp)
jne    1438 <vss_operate+0x238>
jmp    149a <vss_operate+0x29a>
jmp    12e2 <vss_operate+0xe2>
mov    -0x18(%rbp),%rdi
call   1030 <endmntent@plt>
cmpl   $0x0,-0x43c(%rbp)
je     1495 <vss_operate+0x295>
mov    -0x434(%rbp),%esi
lea    0xba4(%rip),%rdi
call   1090 <vss_do_freeze@plt>
or     -0x438(%rbp),%eax
mov    %eax,-0x438(%rbp)
cmpl   $0x0,-0x438(%rbp)
je     1490 <vss_operate+0x290>
cmpl   $0x81,-0x8(%rbp)
jne    1490 <vss_operate+0x290>
jmp    149a <vss_operate+0x29a>
jmp    1495 <vss_operate+0x295>
jmp    158f <vss_operate+0x38f>
mov    0x2b27(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x440(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     14d6 <vss_operate+0x2d6>
lea    -0x430(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x3ff,%edx
call   1040 <strncpy@plt>
mov    -0x18(%rbp),%rdi
call   1030 <endmntent@plt>
mov    $0x80,%edi
call   1100 <vss_operate@plt>
cmpq   $0x0,-0x20(%rbp)
je     1548 <vss_operate+0x348>
mov    0x2abe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x464(%rbp)
lea    -0x430(%rbp),%rax
mov    %rax,-0x460(%rbp)
mov    -0x440(%rbp),%eax
mov    %eax,-0x458(%rbp)
mov    -0x440(%rbp),%edi
call   1110 <strerror@plt>
mov    -0x464(%rbp),%edi
mov    -0x460(%rbp),%rdx
mov    -0x458(%rbp),%ecx
mov    %eax,%r8d
lea    0xade(%rip),%rsi
mov    $0x0,%al
call   10e0 <syslog@plt>
jmp    158a <vss_operate+0x38a>
mov    0x2a61(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x46c(%rbp)
mov    -0x440(%rbp),%eax
mov    %eax,-0x468(%rbp)
mov    -0x440(%rbp),%edi
call   1110 <strerror@plt>
mov    -0x46c(%rbp),%edi
mov    -0x468(%rbp),%edx
mov    %eax,%ecx
lea    0xab8(%rip),%rsi
mov    $0x0,%al
call   10e0 <syslog@plt>
jmp    158f <vss_operate+0x38f>
mov    -0x438(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x470,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vss_operate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    %edi,%ebx
movw   $0x2f,0x14(%rsp)
movl   $0x7665642f,0x10(%rsp)
76
lea    0x20(%rsp),%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1080 <memset@plt>
mov    $0xffffffff,%r13d
cmp    $0x81,%ebx
je     1256 <vss_operate+0x56>
cmp    $0x80,%ebx
jne    146b <vss_operate+0x26b>
mov    0x2d64(%rip),%rax
jmp    125d <vss_operate+0x5d>
mov    0x2d7b(%rip),%rax
mov    (%rax),%r14d
lea    0xd9f(%rip),%rdi
lea    0xda5(%rip),%rsi
call   10d0 <setmntent@plt>
test   %rax,%rax
je     146b <vss_operate+0x26b>
mov    %rax,%rbp
mov    %r14d,0x4(%rsp)
mov    %ebx,0x8(%rsp)
xor    %eax,%eax
lea    0x10(%rsp),%r15
lea    0x18(%rsp),%r12
xor    %ecx,%ecx
mov    %eax,(%rsp)
mov    0x2d48(%rip),%r13
mov    %ecx,0xc(%rsp)
mov    %rbp,%rdi
call   10c0 <getmntent@plt>
test   %rax,%rax
je     13f9 <vss_operate+0x1f9>
mov    %rax,%r14
jmp    12e4 <vss_operate+0xe4>
mov    0x0(%r13),%esi
mov    %r14,%rdi
call   1120 <hasmntopt@plt>
test   %rax,%rax
je     1337 <vss_operate+0x137>
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   10c0 <getmntent@plt>
mov    %rax,%r14
test   %rax,%rax
je     13f9 <vss_operate+0x1f9>
mov    0x10(%r14),%ebx
mov    %r15,%rdi
call   1060 <strlen@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    %eax,%edx
call   1050 <strncmp@plt>
test   %rax,%rax
jne    12d0 <vss_operate+0xd0>
mov    0x10(%r14),%edi
mov    %r12,%rsi
call   10b0 <stat@plt>
cmp    $0xffffffff,%eax
je     12d0 <vss_operate+0xd0>
mov    0x1c(%rsp),%edi
call   10f0 <S_ISBLK@plt>
test   %rax,%rax
je     12ba <vss_operate+0xba>
mov    0x18(%rsp),%edi
call   1070 <major@plt>
mov    0x2cb0(%rip),%rcx
cmp    (%rcx),%rax
jne    12ba <vss_operate+0xba>
jmp    12d0 <vss_operate+0xd0>
mov    (%r14),%rdi
lea    0xcd4(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     12d0 <vss_operate+0xd0>
mov    0x8(%r14),%rdi
lea    0xcae(%rip),%rsi
call   10a0 <strcmp@plt>
mov    $0x1,%ecx
test   %rax,%rax
je     12a0 <vss_operate+0xa0>
mov    0x8(%r14),%rdi
mov    0x4(%rsp),%esi
call   1090 <vss_do_freeze@plt>
mov    %eax,%r13d
or     (%rsp),%r13d
mov    %r13d,%eax
cmpl   $0x81,0x8(%rsp)
mov    0xc(%rsp),%ecx
jne    1296 <vss_operate+0x96>
mov    %r13d,%eax
test   %r13d,%r13d
je     1296 <vss_operate+0x96>
mov    0x2c23(%rip),%rax
mov    (%rax),%ebx
mov    0x8(%r14),%rsi
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    $0x3ff,%edx
call   1040 <strncpy@plt>
mov    %rbp,%rdi
call   1030 <endmntent@plt>
mov    $0x80,%edi
call   1100 <vss_operate@plt>
mov    0x2bda(%rip),%rax
mov    (%rax),%ebp
mov    %ebx,%edi
call   1110 <strerror@plt>
lea    0xc34(%rip),%rsi
mov    %ebp,%edi
mov    %r14,%rdx
mov    %ebx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   10e0 <syslog@plt>
jmp    146b <vss_operate+0x26b>
mov    %rbp,%rdi
call   1030 <endmntent@plt>
cmpl   $0x0,0xc(%rsp)
je     1467 <vss_operate+0x267>
lea    0xbf5(%rip),%rdi
mov    0x4(%rsp),%esi
call   1090 <vss_do_freeze@plt>
mov    %eax,%r13d
or     (%rsp),%r13d
cmpl   $0x81,0x8(%rsp)
jne    146b <vss_operate+0x26b>
test   %r13d,%r13d
je     146b <vss_operate+0x26b>
mov    0x2b93(%rip),%rax
mov    (%rax),%ebx
mov    $0x80,%edi
call   1100 <vss_operate@plt>
mov    0x2b68(%rip),%rax
mov    (%rax),%ebp
mov    %ebx,%edi
call   1110 <strerror@plt>
lea    0xbe3(%rip),%rsi
mov    %ebp,%edi
mov    %ebx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   10e0 <syslog@plt>
jmp    146b <vss_operate+0x26b>
mov    (%rsp),%r13d
mov    %r13d,%eax
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.mntent = type { i8*, i8*, i32 }
%struct.stat = type { i32, i32 }
@__const.vss_operate.match = [6 x i8] c"/dev/\00"
@FIFREEZE = global i32 0
@FITHAW = global i32 0
@.str = [13 x i8] c"/proc/mounts\00"
@.str.1 = [2 x i8] c"r\00"
@LOOP_MAJOR = global i64 0
@MNTOPT_RO = global i32 0
@.str.2 = [5 x i8] c"vfat\00"
@.str.3 = [2 x i8] c"/\00"
@errno = global i32 0
@LOG_ERR = global i32 0
@.str.4 = [33 x i8] c"FREEZE of %s failed; error:%d %s\00"
@.str.5 = [32 x i8] c"FREEZE of / failed; error:%d %s\00"
define i32 @vss_operate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [6 x i8]
%5 = alloca i32*
%6 = alloca %struct.mntent*
%7 = alloca %struct.stat
%8 = alloca [1024 x i8]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %3
%13 = bitcast [6 x i8]* %4 to i8*
%14 = bitcast [1024 x i8]* %8 to i8*
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
%15 = load i32, i32* %3
switch i32 %15, label %20 [
i32 129, label %16
i32 128, label %18
]
16: ; preds = %1
%17 = load i32, i32* @FIFREEZE
store i32 %17, i32* %9
br label %21
18: ; preds = %1
%19 = load i32, i32* @FITHAW
store i32 %19, i32* %9
br label %21
20: ; preds = %1
store i32 -1, i32* %2
br label %145
21: ; preds = %18, %16
%22 = call i32* @setmntent(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %22, i32** %5
%23 = load i32*, i32** %5
%24 = icmp eq i32* %23, null
br i1 %24, label %25, label %26
25: ; preds = %21
store i32 -1, i32* %2
br label %145
26: ; preds = %21
br label %27
27: ; preds = %94, %79, %72, %65, %59, %47, %40, %26
%28 = load i32*, i32** %5
%29 = call %struct.mntent* @getmntent(i32* %28)
store %struct.mntent* %29, %struct.mntent** %6
%30 = icmp ne %struct.mntent* %29, null
br i1 %30, label %31, label %95
31: ; preds = %27
%32 = load %struct.mntent*, %struct.mntent** %6
%33 = getelementptr inbounds %struct.mntent, %struct.mntent* %32, i32 0, i32 2
%34 = load i32, i32* %33
%35 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%36 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%37 = call i32 @strlen(i8* %36)
%38 = call i64 @strncmp(i32 %34, i8* %35, i32 %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %31
br label %27
41: ; preds = %31
%42 = load %struct.mntent*, %struct.mntent** %6
%43 = getelementptr inbounds %struct.mntent, %struct.mntent* %42, i32 0, i32 2
%44 = load i32, i32* %43
%45 = call i32 @stat(i32 %44, %struct.stat* %7)
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %48
47: ; preds = %41
br label %27
48: ; preds = %41
%49 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 1
%50 = load i32, i32* %49
%51 = call i64 @S_ISBLK(i32 %50)
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %60
53: ; preds = %48
%54 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%55 = load i32, i32* %54
%56 = call i64 @major(i32 %55)
%57 = load i64, i64* @LOOP_MAJOR
%58 = icmp eq i64 %56, %57
br i1 %58, label %59, label %60
59: ; preds = %53
br label %27
60: ; preds = %53, %48
%61 = load %struct.mntent*, %struct.mntent** %6
%62 = load i32, i32* @MNTOPT_RO
%63 = call i32* @hasmntopt(%struct.mntent* %61, i32 %62)
%64 = icmp ne i32* %63, null
br i1 %64, label %65, label %66
65: ; preds = %60
br label %27
66: ; preds = %60
%67 = load %struct.mntent*, %struct.mntent** %6
%68 = getelementptr inbounds %struct.mntent, %struct.mntent* %67, i32 0, i32 0
%69 = load i8*, i8** %68
%70 = call i64 @strcmp(i8* %69, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%71 = icmp eq i64 %70, 0
br i1 %71, label %72, label %73
72: ; preds = %66
br label %27
73: ; preds = %66
%74 = load %struct.mntent*, %struct.mntent** %6
%75 = getelementptr inbounds %struct.mntent, %struct.mntent* %74, i32 0, i32 1
%76 = load i8*, i8** %75
%77 = call i64 @strcmp(i8* %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%78 = icmp eq i64 %77, 0
br i1 %78, label %79, label %80
79: ; preds = %73
store i32 1, i32* %11
br label %27
80: ; preds = %73
%81 = load %struct.mntent*, %struct.mntent** %6
%82 = getelementptr inbounds %struct.mntent, %struct.mntent* %81, i32 0, i32 1
%83 = load i8*, i8** %82
%84 = load i32, i32* %9
%85 = call i32 @vss_do_freeze(i8* %83, i32 %84)
%86 = load i32, i32* %10
%87 = or i32 %86, %85
store i32 %87, i32* %10
%88 = load i32, i32* %10
%89 = icmp ne i32 %88, 0
br i1 %89, label %90, label %94
90: ; preds = %80
%91 = load i32, i32* %3
%92 = icmp eq i32 %91, 129
br i1 %92, label %93, label %94
93: ; preds = %90
br label %113
94: ; preds = %90, %80
br label %27
95: ; preds = %27
%96 = load i32*, i32** %5
%97 = call i32 @endmntent(i32* %96)
%98 = load i32, i32* %11
%99 = icmp ne i32 %98, 0
br i1 %99, label %100, label %112
100: ; preds = %95
%101 = load i32, i32* %9
%102 = call i32 @vss_do_freeze(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %101)
%103 = load i32, i32* %10
%104 = or i32 %103, %102
store i32 %104, i32* %10
%105 = load i32, i32* %10
%106 = icmp ne i32 %105, 0
br i1 %106, label %107, label %111
107: ; preds = %100
%108 = load i32, i32* %3
%109 = icmp eq i32 %108, 129
br i1 %109, label %110, label %111
110: ; preds = %107
br label %113
111: ; preds = %107, %100
br label %112
112: ; preds = %111, %95
br label %143
113: ; preds = %110, %93
%114 = load i32, i32* @errno
store i32 %114, i32* %12
%115 = load %struct.mntent*, %struct.mntent** %6
%116 = icmp ne %struct.mntent* %115, null
br i1 %116, label %117, label %125
117: ; preds = %113
%118 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%119 = load %struct.mntent*, %struct.mntent** %6
%120 = getelementptr inbounds %struct.mntent, %struct.mntent* %119, i32 0, i32 1
%121 = load i8*, i8** %120
%122 = call i32 @strncpy(i8* %118, i8* %121, i32 1023)
%123 = load i32*, i32** %5
%124 = call i32 @endmntent(i32* %123)
br label %125
125: ; preds = %117, %113
%126 = call i32 @vss_operate(i32 128)
%127 = load %struct.mntent*, %struct.mntent** %6
%128 = icmp ne %struct.mntent* %127, null
br i1 %128, label %129, label %136
129: ; preds = %125
%130 = load i32, i32* @LOG_ERR
%131 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%132 = load i32, i32* %12
%133 = load i32, i32* %12
%134 = call i32 @strerror(i32 %133)
%135 = call i32 (i32, i8*, ...) @syslog(i32 %130, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %131, i32 %132, i32 %134)
br label %142
136: ; preds = %125
%137 = load i32, i32* @LOG_ERR
%138 = load i32, i32* %12
%139 = load i32, i32* %12
%140 = call i32 @strerror(i32 %139)
%141 = call i32 (i32, i8*, ...) @syslog(i32 %137, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 %138, i32 %140)
br label %142
142: ; preds = %136, %129
br label %143
143: ; preds = %142, %112
%144 = load i32, i32* %10
store i32 %144, i32* %2
br label %145
145: ; preds = %143, %25, %20
%146 = load i32, i32* %2
ret i32 %146
}

LLVM IR (-O2):
%struct.stat = type { i32, i32 }
%struct.mntent = type { i8*, i8*, i32 }
@__const.vss_operate.match = [6 x i8] c"/dev/\00"
@FIFREEZE = global i32 0
@FITHAW = global i32 0
@.str = [13 x i8] c"/proc/mounts\00"
@.str.1 = [2 x i8] c"r\00"
@LOOP_MAJOR = global i64 0
@MNTOPT_RO = global i32 0
@.str.2 = [5 x i8] c"vfat\00"
@.str.3 = [2 x i8] c"/\00"
@errno = global i32 0
@LOG_ERR = global i32 0
@.str.4 = [33 x i8] c"FREEZE of %s failed; error:%d %s\00"
@.str.5 = [32 x i8] c"FREEZE of / failed; error:%d %s\00"
define i32 @vss_operate(i32 %0) {
%2 = alloca [6 x i8]
%3 = alloca %struct.stat
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%6 = bitcast %struct.stat* %3 to i8*
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
switch i32 %0, label %93 [
i32 129, label %9
i32 128, label %8
]
8: ; preds = %1
br label %9
9: ; preds = %1, %8
%10 = phi i32* [ @FITHAW, %8 ], [ @FIFREEZE, %1 ]
%11 = load i32, i32* %10
%12 = tail call i32* @setmntent(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %93, label %14
14: ; preds = %9
%15 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 1
%16 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%17 = icmp eq i32 %0, 129
br label %18
18: ; preds = %14, %62
%19 = phi i32 [ 0, %14 ], [ %66, %62 ]
%20 = phi i32 [ 0, %14 ], [ %22, %62 ]
br label %21
21: ; preds = %18, %57
%22 = phi i32 [ %20, %18 ], [ 1, %57 ]
%23 = call %struct.mntent* @getmntent(i32* %12)
%24 = icmp eq %struct.mntent* %23, null
br i1 %24, label %69, label %25
25: ; preds = %21, %32
%26 = phi %struct.mntent* [ %33, %32 ], [ %23, %21 ]
%27 = getelementptr inbounds %struct.mntent, %struct.mntent* %26, i64 0, i32 2
%28 = load i32, i32* %27
%29 = call i32 @strlen(i8* %5)
%30 = call i64 @strncmp(i32 %28, i8* %5, i32 %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %25, %35, %43, %48, %52
%33 = call %struct.mntent* @getmntent(i32* %12)
%34 = icmp eq %struct.mntent* %33, null
br i1 %34, label %69, label %25
35: ; preds = %25
%36 = load i32, i32* %27
%37 = call i32 @stat(i32 %36, %struct.stat* %3)
%38 = icmp eq i32 %37, -1
br i1 %38, label %32, label %39
39: ; preds = %35
%40 = load i32, i32* %15
%41 = call i64 @S_ISBLK(i32 %40)
%42 = icmp eq i64 %41, 0
br i1 %42, label %48, label %43
43: ; preds = %39
%44 = load i32, i32* %16
%45 = call i64 @major(i32 %44)
%46 = load i64, i64* @LOOP_MAJOR
%47 = icmp eq i64 %45, %46
br i1 %47, label %32, label %48
48: ; preds = %43, %39
%49 = load i32, i32* @MNTOPT_RO
%50 = call i32* @hasmntopt(%struct.mntent* %26, i32 %49)
%51 = icmp eq i32* %50, null
br i1 %51, label %52, label %32
52: ; preds = %48
%53 = getelementptr inbounds %struct.mntent, %struct.mntent* %26, i64 0, i32 0
%54 = load i8*, i8** %53
%55 = call i64 @strcmp(i8* %54, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %32, label %57
57: ; preds = %52
%58 = getelementptr inbounds %struct.mntent, %struct.mntent* %26, i64 0, i32 1
%59 = load i8*, i8** %58
%60 = call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
br i1 %61, label %21, label %62
62: ; preds = %57
%63 = getelementptr inbounds %struct.mntent, %struct.mntent* %26, i64 0, i32 1
%64 = load i8*, i8** %63
%65 = call i32 @vss_do_freeze(i8* %64, i32 %11)
%66 = or i32 %65, %19
%67 = icmp ne i32 %66, 0
%68 = and i1 %17, %67
br i1 %68, label %77, label %18
69: ; preds = %21, %32
%70 = call i32 @endmntent(i32* %12)
%71 = icmp eq i32 %22, 0
br i1 %71, label %93, label %72
72: ; preds = %69
%73 = call i32 @vss_do_freeze(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%74 = or i32 %73, %19
%75 = icmp ne i32 %74, 0
%76 = and i1 %17, %75
br i1 %76, label %87, label %93
77: ; preds = %62
%78 = getelementptr inbounds %struct.mntent, %struct.mntent* %26, i64 0, i32 1
%79 = load i32, i32* @errno
%80 = load i8*, i8** %78
%81 = call i32 @strncpy(i8* %7, i8* %80, i32 1023)
%82 = call i32 @endmntent(i32* %12)
%83 = call i32 @vss_operate(i32 128)
%84 = load i32, i32* @LOG_ERR
%85 = call i32 @strerror(i32 %79)
%86 = call i32 (i32, i8*, ...) @syslog(i32 %84, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* %7, i32 %79, i32 %85)
br label %93
87: ; preds = %72
%88 = load i32, i32* @errno
%89 = call i32 @vss_operate(i32 128)
%90 = load i32, i32* @LOG_ERR
%91 = call i32 @strerror(i32 %88)
%92 = call i32 (i32, i8*, ...) @syslog(i32 %90, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), i32 %88, i32 %91)
br label %93
93: ; preds = %72, %69, %87, %77, %9, %1
%94 = phi i32 [ -1, %1 ], [ -1, %9 ], [ %66, %77 ], [ %74, %87 ], [ %74, %72 ], [ %19, %69 ]
ret i32 %94
}