#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 */
typedef int uint8_t;
typedef int uint32_t;
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ close_master_conn(int);
int /*<<< orphan*/ free(int *);
int get32bit(int const **);
int getuid();
int *malloc(int);
char *mfsstrerr(int const);
int open_master_conn(char const *, int *, int /*<<< orphan*/ *,
                     int /*<<< orphan*/ *, int /*<<< orphan*/, int);
int /*<<< orphan*/ print_number(char *, char *, int, int, int /*<<< orphan*/,
                                int);
int /*<<< orphan*/ printf(char *, char const *, ...);
int /*<<< orphan*/ put32bit(int **, int);
int /*<<< orphan*/ put8bit(int **, int);
int tcptoread(int, int *, int, int);
int tcptowrite(int, int *, int, int);
int set_eattr(const char *fname, uint8_t eattr, uint8_t mode) {
  uint8_t reqbuff[22], *wptr, *buff;
  const uint8_t *rptr;
  uint32_t cmd, leng, inode, uid;
  uint32_t changed, notchanged, notpermitted;
  int fd;
  fd = open_master_conn(fname, &inode, NULL, NULL, 0, 1);
  if (fd < 0) {
    return -1;
  }
  uid = getuid();
  wptr = reqbuff;
  put32bit(&wptr, (0 + 474));
  put32bit(&wptr, 14);
  put32bit(&wptr, 0);
  put32bit(&wptr, inode);
  put32bit(&wptr, uid);
  put8bit(&wptr, eattr);
  put8bit(&wptr, mode);
  if (tcptowrite(fd, reqbuff, 22, 10000) != 22) {
    printf("%s: master query: send error\n", fname);
    close_master_conn(1);
    return -1;
  }
  if (tcptoread(fd, reqbuff, 8, 10000) != 8) {
    printf("%s: master query: receive error\n", fname);
    close_master_conn(1);
    return -1;
  }
  rptr = reqbuff;
  cmd = get32bit(&rptr);
  leng = get32bit(&rptr);
  if (cmd != (0 + 475)) {
    printf("%s: master query: wrong answer (type)\n", fname);
    close_master_conn(1);
    return -1;
  }
  buff = malloc(leng);
  if (tcptoread(fd, buff, leng, 10000) != (int32_t)leng) {
    printf("%s: master query: receive error\n", fname);
    free(buff);
    close_master_conn(1);
    return -1;
  }
  close_master_conn(0);
  rptr = buff;
  cmd = get32bit(&rptr);
  if (cmd != 0) {
    printf("%s: master query: wrong answer (queryid)\n", fname);
    free(buff);
    return -1;
  }
  leng -= 4;
  if (leng == 1) {
    printf("%s: %s\n", fname, mfsstrerr(*rptr));
    free(buff);
    return -1;
  } else if (leng != 12) {
    printf("%s: master query: wrong answer (leng)\n", fname);
    free(buff);
    return -1;
  }
  changed = get32bit(&rptr);
  notchanged = get32bit(&rptr);
  notpermitted = get32bit(&rptr);
  if ((mode & 4) == 0) {
    if (changed) {
      printf("%s: attribute(s) changed\n", fname);
    } else {
      printf("%s: attribute(s) not changed\n", fname);
    }
  } else {
    printf("%s:\n", fname);
    print_number(" inodes with attributes changed:     ", "\n", changed, 1, 0,
                 1);
    print_number(" inodes with attributes not changed: ", "\n", notchanged, 1,
                 0, 1);
    print_number(" inodes with permission denied:      ", "\n", notpermitted, 1,
                 0, 1);
  }
  free(buff);
  return 0;
}


x86 assembly (clang, -O0):
<set_eattr>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x94(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
xor    %r8d,%r8d
mov    $0x1,%r9d
mov    %rcx,%rdx
call   10f0 <open_master_conn@plt>
mov    %eax,-0xa8(%rbp)
cmpl   $0x0,-0xa8(%rbp)
jge    1224 <set_eattr+0x54>
movl   $0xffffffff,-0x4(%rbp)
jmp    15fb <set_eattr+0x42b>
mov    $0x0,%al
call   1080 <getuid@plt>
mov    %eax,-0x98(%rbp)
lea    -0x70(%rbp),%rax
mov    %rax,-0x78(%rbp)
lea    -0x78(%rbp),%rdi
mov    $0x1da,%esi
call   10d0 <put32bit@plt>
lea    -0x78(%rbp),%rdi
mov    $0xe,%esi
call   10d0 <put32bit@plt>
lea    -0x78(%rbp),%rdi
xor    %esi,%esi
call   10d0 <put32bit@plt>
mov    -0x94(%rbp),%esi
lea    -0x78(%rbp),%rdi
call   10d0 <put32bit@plt>
mov    -0x98(%rbp),%esi
lea    -0x78(%rbp),%rdi
call   10d0 <put32bit@plt>
mov    -0x14(%rbp),%esi
lea    -0x78(%rbp),%rdi
call   1040 <put8bit@plt>
mov    -0x18(%rbp),%esi
lea    -0x78(%rbp),%rdi
call   1040 <put8bit@plt>
mov    -0xa8(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x16,%edx
mov    $0x2710,%ecx
call   10e0 <tcptowrite@plt>
cmp    $0x16,%eax
je     12e0 <set_eattr+0x110>
mov    -0x10(%rbp),%rsi
lea    0xd3d(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x1,%edi
call   1070 <close_master_conn@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    15fb <set_eattr+0x42b>
mov    -0xa8(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x8,%edx
mov    $0x2710,%ecx
call   10a0 <tcptoread@plt>
cmp    $0x8,%eax
je     132a <set_eattr+0x15a>
mov    -0x10(%rbp),%rsi
lea    0xd11(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x1,%edi
call   1070 <close_master_conn@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    15fb <set_eattr+0x42b>
lea    -0x70(%rbp),%rax
mov    %rax,-0x88(%rbp)
lea    -0x88(%rbp),%rdi
call   1060 <get32bit@plt>
mov    %eax,-0x8c(%rbp)
lea    -0x88(%rbp),%rdi
call   1060 <get32bit@plt>
mov    %eax,-0x90(%rbp)
cmpl   $0x1db,-0x8c(%rbp)
je     1391 <set_eattr+0x1c1>
mov    -0x10(%rbp),%rsi
lea    0xccb(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x1,%edi
call   1070 <close_master_conn@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    15fb <set_eattr+0x42b>
mov    -0x90(%rbp),%edi
call   10b0 <malloc@plt>
mov    %rax,-0x80(%rbp)
mov    -0xa8(%rbp),%edi
mov    -0x80(%rbp),%rsi
mov    -0x90(%rbp),%edx
mov    $0x2710,%ecx
call   10a0 <tcptoread@plt>
cmp    -0x90(%rbp),%eax
je     13f7 <set_eattr+0x227>
mov    -0x10(%rbp),%rsi
lea    0xc4d(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
mov    $0x1,%edi
call   1070 <close_master_conn@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    15fb <set_eattr+0x42b>
xor    %edi,%edi
call   1070 <close_master_conn@plt>
mov    -0x80(%rbp),%rax
mov    %rax,-0x88(%rbp)
lea    -0x88(%rbp),%rdi
call   1060 <get32bit@plt>
mov    %eax,-0x8c(%rbp)
cmpl   $0x0,-0x8c(%rbp)
je     144f <set_eattr+0x27f>
mov    -0x10(%rbp),%rsi
lea    0xc33(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    15fb <set_eattr+0x42b>
mov    -0x90(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0x90(%rbp)
cmpl   $0x1,-0x90(%rbp)
jne    14b1 <set_eattr+0x2e1>
mov    -0x10(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x88(%rbp),%rax
mov    (%rax),%edi
call   1050 <mfsstrerr@plt>
mov    -0xb0(%rbp),%rsi
mov    %rax,%rdx
lea    0xbfb(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    15fb <set_eattr+0x42b>
cmpl   $0xc,-0x90(%rbp)
je     14e5 <set_eattr+0x315>
mov    -0x10(%rbp),%rsi
lea    0xbcf(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    15fb <set_eattr+0x42b>
jmp    14ea <set_eattr+0x31a>
lea    -0x88(%rbp),%rdi
call   1060 <get32bit@plt>
mov    %eax,-0x9c(%rbp)
lea    -0x88(%rbp),%rdi
call   1060 <get32bit@plt>
mov    %eax,-0xa0(%rbp)
lea    -0x88(%rbp),%rdi
call   1060 <get32bit@plt>
mov    %eax,-0xa4(%rbp)
mov    -0x18(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
jne    156a <set_eattr+0x39a>
cmpl   $0x0,-0x9c(%rbp)
je     1553 <set_eattr+0x383>
mov    -0x10(%rbp),%rsi
lea    0xb78(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    1565 <set_eattr+0x395>
mov    -0x10(%rbp),%rsi
lea    0xb7b(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    15eb <set_eattr+0x41b>
mov    -0x10(%rbp),%rsi
lea    0xb82(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x9c(%rbp),%edx
lea    0xb73(%rip),%rdi
lea    0xafe(%rip),%rsi
mov    $0x1,%r9d
xor    %r8d,%r8d
mov    %r9d,%ecx
call   10c0 <print_number@plt>
mov    -0xa0(%rbp),%edx
lea    0xb74(%rip),%rdi
lea    0xad9(%rip),%rsi
mov    $0x1,%r9d
xor    %r8d,%r8d
mov    %r9d,%ecx
call   10c0 <print_number@plt>
mov    -0xa4(%rbp),%edx
lea    0xb75(%rip),%rdi
lea    0xab4(%rip),%rsi
mov    $0x1,%r9d
xor    %r8d,%r8d
mov    %r9d,%ecx
call   10c0 <print_number@plt>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_eattr>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %edx,%ebx
mov    %esi,%r13d
mov    %rdi,%rbp
lea    0x14(%rsp),%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    $0x1,%r9d
call   10f0 <open_master_conn@plt>
mov    %eax,%r14d
mov    $0xffffffff,%eax
test   %r14d,%r14d
js     1371 <set_eattr+0x1a1>
mov    %rbp,(%rsp)
xor    %eax,%eax
call   1080 <getuid@plt>
mov    %eax,%r12d
lea    0x20(%rsp),%rbp
mov    %rbp,0x18(%rsp)
lea    0x18(%rsp),%r15
mov    %r15,%rdi
mov    $0x1da,%esi
call   10d0 <put32bit@plt>
mov    %r15,%rdi
mov    $0xe,%esi
call   10d0 <put32bit@plt>
mov    %r15,%rdi
xor    %esi,%esi
call   10d0 <put32bit@plt>
mov    0x14(%rsp),%esi
mov    %r15,%rdi
call   10d0 <put32bit@plt>
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebx,%r12d
call   10d0 <put32bit@plt>
mov    %r15,%rdi
mov    %r13d,%esi
call   1040 <put8bit@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   1040 <put8bit@plt>
mov    %r14d,%edi
mov    %rbp,%rsi
mov    $0x16,%edx
mov    $0x2710,%ecx
call   10e0 <tcptowrite@plt>
cmp    $0x16,%eax
jne    133e <set_eattr+0x16e>
lea    0x20(%rsp),%rbx
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x8,%edx
mov    $0x2710,%ecx
call   10a0 <tcptoread@plt>
cmp    $0x8,%eax
jne    1347 <set_eattr+0x177>
mov    %rbx,0x8(%rsp)
lea    0x8(%rsp),%rbp
mov    %rbp,%rdi
call   1060 <get32bit@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1060 <get32bit@plt>
cmp    $0x1db,%ebx
jne    1350 <set_eattr+0x180>
mov    %eax,%r15d
mov    %eax,%edi
call   10b0 <malloc@plt>
mov    %rax,%r13
mov    %r14d,%edi
mov    %rax,%rsi
mov    %r15d,%edx
mov    $0x2710,%ecx
call   10a0 <tcptoread@plt>
cmp    %r15d,%eax
jne    1380 <set_eattr+0x1b0>
xor    %edi,%edi
call   1070 <close_master_conn@plt>
mov    %r13,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1060 <get32bit@plt>
test   %eax,%eax
je     139c <set_eattr+0x1cc>
lea    0xd3d(%rip),%rdi
mov    (%rsp),%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %r13,%rdi
call   1030 <free@plt>
jmp    136c <set_eattr+0x19c>
lea    0xcbb(%rip),%rdi
jmp    1357 <set_eattr+0x187>
lea    0xcd0(%rip),%rdi
jmp    1357 <set_eattr+0x187>
lea    0xce8(%rip),%rdi
mov    (%rsp),%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%edi
call   1070 <close_master_conn@plt>
mov    $0xffffffff,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc97(%rip),%rdi
mov    (%rsp),%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %r13,%rdi
call   1030 <free@plt>
jmp    1362 <set_eattr+0x192>
cmp    $0x10,%r15d
je     13ce <set_eattr+0x1fe>
cmp    $0x5,%r15d
jne    140e <set_eattr+0x23e>
mov    0x8(%rsp),%rax
mov    (%rax),%edi
call   1050 <mfsstrerr@plt>
lea    0xcd5(%rip),%rdi
mov    (%rsp),%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <printf@plt>
jmp    1334 <set_eattr+0x164>
lea    0x8(%rsp),%rbp
mov    %rbp,%rdi
call   1060 <get32bit@plt>
mov    %eax,%r14d
mov    %rbp,%rdi
call   1060 <get32bit@plt>
mov    %r12d,%ebx
mov    %eax,%r12d
mov    %rbp,%rdi
call   1060 <get32bit@plt>
test   $0x4,%bl
jne    141a <set_eattr+0x24a>
test   %r14d,%r14d
je     1498 <set_eattr+0x2c8>
lea    0xcb6(%rip),%rdi
jmp    149f <set_eattr+0x2cf>
lea    0xc83(%rip),%rdi
jmp    1329 <set_eattr+0x159>
mov    %eax,%r15d
lea    0xcd3(%rip),%rdi
mov    (%rsp),%rsi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xcc6(%rip),%rdi
lea    0xc51(%rip),%rbp
mov    %rbp,%rsi
mov    %r14d,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
mov    $0x1,%r9d
call   10c0 <print_number@plt>
lea    0xcc5(%rip),%rdi
mov    %rbp,%rsi
mov    %r12d,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
mov    $0x1,%r9d
call   10c0 <print_number@plt>
lea    0xccb(%rip),%rdi
mov    %rbp,%rsi
mov    %r15d,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
mov    $0x1,%r9d
call   10c0 <print_number@plt>
jmp    14aa <set_eattr+0x2da>
lea    0xc3a(%rip),%rdi
mov    (%rsp),%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %r13,%rdi
call   1030 <free@plt>
xor    %eax,%eax
jmp    1371 <set_eattr+0x1a1>

LLVM IR (-O0):
@.str = [30 x i8] c"%s: master query: send error\0A\00"
@.str.1 = [33 x i8] c"%s: master query: receive error\0A\00"
@.str.2 = [39 x i8] c"%s: master query: wrong answer (type)\0A\00"
@.str.3 = [42 x i8] c"%s: master query: wrong answer (queryid)\0A\00"
@.str.4 = [8 x i8] c"%s: %s\0A\00"
@.str.5 = [39 x i8] c"%s: master query: wrong answer (leng)\0A\00"
@.str.6 = [26 x i8] c"%s: attribute(s) changed\0A\00"
@.str.7 = [30 x i8] c"%s: attribute(s) not changed\0A\00"
@.str.8 = [5 x i8] c"%s:\0A\00"
@.str.9 = [38 x i8] c" inodes with attributes changed: \00"
@.str.10 = [2 x i8] c"\0A\00"
@.str.11 = [38 x i8] c" inodes with attributes not changed: \00"
@.str.12 = [38 x i8] c" inodes with permission denied: \00"
define i32 @set_eattr(i8* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca [22 x i32]
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%20 = load i8*, i8** %5
%21 = call i32 @open_master_conn(i8* %20, i32* %14, i32* null, i32* null, i32 0, i32 1)
store i32 %21, i32* %19
%22 = load i32, i32* %19
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %3
store i32 -1, i32* %4
br label %143
25: ; preds = %3
%26 = call i32 (...) @getuid()
store i32 %26, i32* %15
%27 = getelementptr inbounds [22 x i32], [22 x i32]* %8, i64 0, i64 0
store i32* %27, i32** %9
%28 = call i32 @put32bit(i32** %9, i32 474)
%29 = call i32 @put32bit(i32** %9, i32 14)
%30 = call i32 @put32bit(i32** %9, i32 0)
%31 = load i32, i32* %14
%32 = call i32 @put32bit(i32** %9, i32 %31)
%33 = load i32, i32* %15
%34 = call i32 @put32bit(i32** %9, i32 %33)
%35 = load i32, i32* %6
%36 = call i32 @put8bit(i32** %9, i32 %35)
%37 = load i32, i32* %7
%38 = call i32 @put8bit(i32** %9, i32 %37)
%39 = load i32, i32* %19
%40 = getelementptr inbounds [22 x i32], [22 x i32]* %8, i64 0, i64 0
%41 = call i32 @tcptowrite(i32 %39, i32* %40, i32 22, i32 10000)
%42 = icmp ne i32 %41, 22
br i1 %42, label %43, label %47
43: ; preds = %25
%44 = load i8*, i8** %5
%45 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %44)
%46 = call i32 @close_master_conn(i32 1)
store i32 -1, i32* %4
br label %143
47: ; preds = %25
%48 = load i32, i32* %19
%49 = getelementptr inbounds [22 x i32], [22 x i32]* %8, i64 0, i64 0
%50 = call i32 @tcptoread(i32 %48, i32* %49, i32 8, i32 10000)
%51 = icmp ne i32 %50, 8
br i1 %51, label %52, label %56
52: ; preds = %47
%53 = load i8*, i8** %5
%54 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %53)
%55 = call i32 @close_master_conn(i32 1)
store i32 -1, i32* %4
br label %143
56: ; preds = %47
%57 = getelementptr inbounds [22 x i32], [22 x i32]* %8, i64 0, i64 0
store i32* %57, i32** %11
%58 = call i32 @get32bit(i32** %11)
store i32 %58, i32* %12
%59 = call i32 @get32bit(i32** %11)
store i32 %59, i32* %13
%60 = load i32, i32* %12
%61 = icmp ne i32 %60, 475
br i1 %61, label %62, label %66
62: ; preds = %56
%63 = load i8*, i8** %5
%64 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %63)
%65 = call i32 @close_master_conn(i32 1)
store i32 -1, i32* %4
br label %143
66: ; preds = %56
%67 = load i32, i32* %13
%68 = call i32* @malloc(i32 %67)
store i32* %68, i32** %10
%69 = load i32, i32* %19
%70 = load i32*, i32** %10
%71 = load i32, i32* %13
%72 = call i32 @tcptoread(i32 %69, i32* %70, i32 %71, i32 10000)
%73 = load i32, i32* %13
%74 = icmp ne i32 %72, %73
br i1 %74, label %75, label %81
75: ; preds = %66
%76 = load i8*, i8** %5
%77 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %76)
%78 = load i32*, i32** %10
%79 = call i32 @free(i32* %78)
%80 = call i32 @close_master_conn(i32 1)
store i32 -1, i32* %4
br label %143
81: ; preds = %66
%82 = call i32 @close_master_conn(i32 0)
%83 = load i32*, i32** %10
store i32* %83, i32** %11
%84 = call i32 @get32bit(i32** %11)
store i32 %84, i32* %12
%85 = load i32, i32* %12
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %92
87: ; preds = %81
%88 = load i8*, i8** %5
%89 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8* %88)
%90 = load i32*, i32** %10
%91 = call i32 @free(i32* %90)
store i32 -1, i32* %4
br label %143
92: ; preds = %81
%93 = load i32, i32* %13
%94 = sub nsw i32 %93, 4
store i32 %94, i32* %13
%95 = load i32, i32* %13
%96 = icmp eq i32 %95, 1
br i1 %96, label %97, label %105
97: ; preds = %92
%98 = load i8*, i8** %5
%99 = load i32*, i32** %11
%100 = load i32, i32* %99
%101 = call i8* @mfsstrerr(i32 %100)
%102 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %98, i8* %101)
%103 = load i32*, i32** %10
%104 = call i32 @free(i32* %103)
store i32 -1, i32* %4
br label %143
105: ; preds = %92
%106 = load i32, i32* %13
%107 = icmp ne i32 %106, 12
br i1 %107, label %108, label %113
108: ; preds = %105
%109 = load i8*, i8** %5
%110 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i8* %109)
%111 = load i32*, i32** %10
%112 = call i32 @free(i32* %111)
store i32 -1, i32* %4
br label %143
113: ; preds = %105
br label %114
114: ; preds = %113
%115 = call i32 @get32bit(i32** %11)
store i32 %115, i32* %16
%116 = call i32 @get32bit(i32** %11)
store i32 %116, i32* %17
%117 = call i32 @get32bit(i32** %11)
store i32 %117, i32* %18
%118 = load i32, i32* %7
%119 = and i32 %118, 4
%120 = icmp eq i32 %119, 0
br i1 %120, label %121, label %131
121: ; preds = %114
%122 = load i32, i32* %16
%123 = icmp ne i32 %122, 0
br i1 %123, label %124, label %127
124: ; preds = %121
%125 = load i8*, i8** %5
%126 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %125)
br label %130
127: ; preds = %121
%128 = load i8*, i8** %5
%129 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %128)
br label %130
130: ; preds = %127, %124
br label %140
131: ; preds = %114
%132 = load i8*, i8** %5
%133 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* %132)
%134 = load i32, i32* %16
%135 = call i32 @print_number(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32 %134, i32 1, i32 0, i32 1)
%136 = load i32, i32* %17
%137 = call i32 @print_number(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32 %136, i32 1, i32 0, i32 1)
%138 = load i32, i32* %18
%139 = call i32 @print_number(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32 %138, i32 1, i32 0, i32 1)
br label %140
140: ; preds = %131, %130
%141 = load i32*, i32** %10
%142 = call i32 @free(i32* %141)
store i32 0, i32* %4
br label %143
143: ; preds = %140, %108, %97, %87, %75, %62, %52, %43, %24
%144 = load i32, i32* %4
ret i32 %144
}

LLVM IR (-O2):
@.str = [30 x i8] c"%s: master query: send error\0A\00"
@.str.1 = [33 x i8] c"%s: master query: receive error\0A\00"
@.str.2 = [39 x i8] c"%s: master query: wrong answer (type)\0A\00"
@.str.3 = [42 x i8] c"%s: master query: wrong answer (queryid)\0A\00"
@.str.4 = [8 x i8] c"%s: %s\0A\00"
@.str.5 = [39 x i8] c"%s: master query: wrong answer (leng)\0A\00"
@.str.6 = [26 x i8] c"%s: attribute(s) changed\0A\00"
@.str.7 = [30 x i8] c"%s: attribute(s) not changed\0A\00"
@.str.8 = [5 x i8] c"%s:\0A\00"
@.str.9 = [38 x i8] c" inodes with attributes changed: \00"
@.str.10 = [2 x i8] c"\0A\00"
@.str.11 = [38 x i8] c" inodes with attributes not changed: \00"
@.str.12 = [38 x i8] c" inodes with permission denied: \00"
define i32 @set_eattr(i8* %0, i32 %1, i32 %2) {
%4 = alloca [22 x i32]
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = bitcast [22 x i32]* %4 to i8*
%9 = bitcast i32** %5 to i8*
%10 = bitcast i32** %6 to i8*
%11 = bitcast i32* %7 to i8*
%12 = call i32 @open_master_conn(i8* %0, i32* %7, i32* null, i32* null, i32 0, i32 1)
%13 = icmp slt i32 %12, 0
br i1 %13, label %87, label %14
14: ; preds = %3
%15 = call i32 (...) @getuid()
%16 = getelementptr inbounds [22 x i32], [22 x i32]* %4, i64 0, i64 0
store i32* %16, i32** %5
%17 = call i32 @put32bit(i32** %5, i32 474)
%18 = call i32 @put32bit(i32** %5, i32 14)
%19 = call i32 @put32bit(i32** %5, i32 0)
%20 = load i32, i32* %7
%21 = call i32 @put32bit(i32** %5, i32 %20)
%22 = call i32 @put32bit(i32** %5, i32 %15)
%23 = call i32 @put8bit(i32** %5, i32 %1)
%24 = call i32 @put8bit(i32** %5, i32 %2)
%25 = call i32 @tcptowrite(i32 %12, i32* %16, i32 22, i32 10000)
%26 = icmp eq i32 %25, 22
br i1 %26, label %30, label %27
27: ; preds = %14
%28 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %0)
%29 = call i32 @close_master_conn(i32 1)
br label %87
30: ; preds = %14
%31 = call i32 @tcptoread(i32 %12, i32* %16, i32 8, i32 10000)
%32 = icmp eq i32 %31, 8
br i1 %32, label %36, label %33
33: ; preds = %30
%34 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%35 = call i32 @close_master_conn(i32 1)
br label %87
36: ; preds = %30
store i32* %16, i32** %6
%37 = call i32 @get32bit(i32** %6)
%38 = call i32 @get32bit(i32** %6)
%39 = icmp eq i32 %37, 475
br i1 %39, label %43, label %40
40: ; preds = %36
%41 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%42 = call i32 @close_master_conn(i32 1)
br label %87
43: ; preds = %36
%44 = call i32* @malloc(i32 %38)
%45 = call i32 @tcptoread(i32 %12, i32* %44, i32 %38, i32 10000)
%46 = icmp eq i32 %45, %38
br i1 %46, label %51, label %47
47: ; preds = %43
%48 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%49 = call i32 @free(i32* %44)
%50 = call i32 @close_master_conn(i32 1)
br label %87
51: ; preds = %43
%52 = call i32 @close_master_conn(i32 0)
store i32* %44, i32** %6
%53 = call i32 @get32bit(i32** %6)
%54 = icmp eq i32 %53, 0
br i1 %54, label %58, label %55
55: ; preds = %51
%56 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%57 = call i32 @free(i32* %44)
br label %87
58: ; preds = %51
switch i32 %38, label %65 [
i32 5, label %59
i32 16, label %68
]
59: ; preds = %58
%60 = load i32*, i32** %6
%61 = load i32, i32* %60
%62 = call i8* @mfsstrerr(i32 %61)
%63 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* %0, i8* %62)
%64 = call i32 @free(i32* %44)
br label %87
65: ; preds = %58
%66 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), i8* %0)
%67 = call i32 @free(i32* %44)
br label %87
68: ; preds = %58
%69 = call i32 @get32bit(i32** %6)
%70 = call i32 @get32bit(i32** %6)
%71 = call i32 @get32bit(i32** %6)
%72 = and i32 %2, 4
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %80
74: ; preds = %68
%75 = icmp eq i32 %69, 0
br i1 %75, label %78, label %76
76: ; preds = %74
%77 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0), i8* %0)
br label %85
78: ; preds = %74
%79 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i8* %0)
br label %85
80: ; preds = %68
%81 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* %0)
%82 = call i32 @print_number(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32 %69, i32 1, i32 0, i32 1)
%83 = call i32 @print_number(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32 %70, i32 1, i32 0, i32 1)
%84 = call i32 @print_number(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32 %71, i32 1, i32 0, i32 1)
br label %85
85: ; preds = %76, %78, %80
%86 = call i32 @free(i32* %44)
br label %87
87: ; preds = %3, %85, %65, %59, %55, %47, %40, %33, %27
%88 = phi i32 [ -1, %27 ], [ -1, %33 ], [ -1, %40 ], [ -1, %47 ], [ -1, %55 ], [ -1, %59 ], [ -1, %65 ], [ 0, %85 ], [ -1, %3 ]
ret i32 %88
}