#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;
  int /*<<< orphan*/ mnt_fsname;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
struct mntent *iterator(char *, int /*<<< orphan*/ **);
int /*<<< orphan*/ iterator_end(int /*<<< orphan*/ **);
int /*<<< orphan*/ strcmp(char *, int /*<<< orphan*/);
int /*<<< orphan*/ umount(int /*<<< orphan*/);
void unmount_tmpfs(void) {
  struct mntent *mnt;
  FILE *fp = NULL;
  while ((mnt = iterator("/proc/mounts", &fp))) {
    if (!strcmp("tmpfs", mnt->mnt_fsname) && !umount(mnt->mnt_dir))
      iterator_end(&fp);
  }
}


x86 assembly (clang, -O0):
<unmount_tmpfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x10(%rbp)
lea    0xea9(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <iterator@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     11ac <unmount_tmpfs+0x6c>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%esi
lea    0xe91(%rip),%rdi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11a7 <unmount_tmpfs+0x67>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <umount@plt>
cmp    $0x0,%eax
jne    11a7 <unmount_tmpfs+0x67>
lea    -0x10(%rbp),%rdi
call   1060 <iterator_end@plt>
jmp    1150 <unmount_tmpfs+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unmount_tmpfs>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movq   $0x0,(%rsp)
lea    0xea9(%rip),%rdi
mov    %rsp,%rsi
call   1050 <iterator@plt>
test   %rax,%rax
je     11b7 <unmount_tmpfs+0x77>
mov    %rax,%rbx
lea    0xe9f(%rip),%r14
mov    %rsp,%r12
lea    0xe88(%rip),%r15
jmp    1193 <unmount_tmpfs+0x53>
nopw   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <iterator@plt>
mov    %rax,%rbx
test   %rax,%rax
je     11b7 <unmount_tmpfs+0x77>
mov    0x4(%rbx),%esi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    1180 <unmount_tmpfs+0x40>
mov    (%rbx),%edi
call   1030 <umount@plt>
test   %eax,%eax
jne    1180 <unmount_tmpfs+0x40>
mov    %r12,%rdi
call   1060 <iterator_end@plt>
jmp    1180 <unmount_tmpfs+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.mntent = type { i32, i32 }
@.str = [13 x i8] c"/proc/mounts\00"
@.str.1 = [6 x i8] c"tmpfs\00"
define void @unmount_tmpfs() {
%1 = alloca %struct.mntent*
%2 = alloca i32*
store i32* null, i32** %2
br label %3
3: ; preds = %20, %0
%4 = call %struct.mntent* @iterator(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32** %2)
store %struct.mntent* %4, %struct.mntent** %1
%5 = icmp ne %struct.mntent* %4, null
br i1 %5, label %6, label %21
6: ; preds = %3
%7 = load %struct.mntent*, %struct.mntent** %1
%8 = getelementptr inbounds %struct.mntent, %struct.mntent* %7, i32 0, i32 1
%9 = load i32, i32* %8
%10 = call i32 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %20, label %12
12: ; preds = %6
%13 = load %struct.mntent*, %struct.mntent** %1
%14 = getelementptr inbounds %struct.mntent, %struct.mntent* %13, i32 0, i32 0
%15 = load i32, i32* %14
%16 = call i32 @umount(i32 %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %12
%19 = call i32 @iterator_end(i32** %2)
br label %20
20: ; preds = %18, %12, %6
br label %3
21: ; preds = %3
ret void
}

LLVM IR (-O2):
%struct.mntent = type { i32, i32 }
@.str = [13 x i8] c"/proc/mounts\00"
@.str.1 = [6 x i8] c"tmpfs\00"
define void @unmount_tmpfs() {
%1 = alloca i32*
%2 = bitcast i32** %1 to i8*
store i32* null, i32** %1
%3 = call %struct.mntent* @iterator(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32** %1)
%4 = icmp eq %struct.mntent* %3, null
br i1 %4, label %21, label %5
5: ; preds = %0, %18
%6 = phi %struct.mntent* [ %19, %18 ], [ %3, %0 ]
%7 = getelementptr inbounds %struct.mntent, %struct.mntent* %6, i64 0, i32 1
%8 = load i32, i32* %7
%9 = call i32 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %5
%12 = getelementptr inbounds %struct.mntent, %struct.mntent* %6, i64 0, i32 0
%13 = load i32, i32* %12
%14 = call i32 @umount(i32 %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 @iterator_end(i32** %1)
br label %18
18: ; preds = %16, %11, %5
%19 = call %struct.mntent* @iterator(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32** %1)
%20 = icmp eq %struct.mntent* %19, null
br i1 %20, label %21, label %5
21: ; preds = %18, %0
ret void
}