#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 */

/* Variables and functions */
int asprintf(char **, char *, char const *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int system(char *);
int volfile_change(const char *volname) {
  int ret = 0;
  char *cmd = NULL, *cmd1 = NULL;
  ret = asprintf(&cmd, "gluster volume set %s stat-prefetch off", volname);
  if (ret < 0) {
    fprintf(stderr, "cannot construct cli command string (%s)",
            strerror(errno));
    return ret;
  }
  ret = asprintf(&cmd1, "gluster volume set %s stat-prefetch on", volname);
  if (ret < 0) {
    fprintf(stderr, "cannot construct cli command string (%s)",
            strerror(errno));
    return ret;
  }
  ret = system(cmd);
  if (ret < 0) {
    fprintf(stderr, "stat-prefetch off on (%s) failed", volname);
    return ret;
  }
  ret = system(cmd1);
  if (ret < 0) {
    fprintf(stderr, "stat-prefetch on on (%s) failed", volname);
    return ret;
  }
  free(cmd);
  free(cmd1);
  return ret;
}


x86 assembly (clang, -O0):
<volfile_change>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rdx
lea    -0x20(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1060 <asprintf@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    11cb <volfile_change+0x7b>
mov    0x2e45(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x2c(%rbp),%edi
mov    %rax,%rdx
lea    0xe6d(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12af <volfile_change+0x15f>
mov    -0x10(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    0xe77(%rip),%rsi
call   1060 <asprintf@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1223 <volfile_change+0xd3>
mov    0x2ded(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x30(%rbp),%edi
mov    %rax,%rdx
lea    0xe15(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12af <volfile_change+0x15f>
mov    -0x20(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    125d <volfile_change+0x10d>
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe2b(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12af <volfile_change+0x15f>
mov    -0x28(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1297 <volfile_change+0x147>
mov    0x2d66(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe12(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    12af <volfile_change+0x15f>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<volfile_change>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r14
movq   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
lea    0xe8d(%rip),%rsi
lea    0x8(%rsp),%rdi
mov    %r14,%rdx
call   1060 <asprintf@plt>
test   %eax,%eax
js     11cc <volfile_change+0x7c>
lea    0xec6(%rip),%rsi
mov    %rsp,%rdi
mov    %r14,%rdx
call   1060 <asprintf@plt>
test   %eax,%eax
js     11cc <volfile_change+0x7c>
mov    0x8(%rsp),%rdi
call   1040 <system@plt>
test   %eax,%eax
js     11f3 <volfile_change+0xa3>
mov    (%rsp),%rdi
call   1040 <system@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1207 <volfile_change+0xb7>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
jmp    121f <volfile_change+0xcf>
mov    %eax,%ebx
mov    0x2e0b(%rip),%rax
mov    (%rax),%ebp
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xe3c(%rip),%rsi
mov    %ebp,%edi
mov    %rax,%rdx
jmp    121a <volfile_change+0xca>
mov    %eax,%ebx
mov    0x2de4(%rip),%rax
mov    (%rax),%edi
lea    0xe73(%rip),%rsi
jmp    1217 <volfile_change+0xc7>
mov    0x2dd2(%rip),%rax
mov    (%rax),%edi
lea    0xe82(%rip),%rsi
mov    %r14,%rdx
call   1050 <fprintf@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"gluster volume set %s stat-prefetch off\00"
@stderr = global i32 0
@.str.1 = [41 x i8] c"cannot construct cli command string (%s)\00"
@errno = global i32 0
@.str.2 = [39 x i8] c"gluster volume set %s stat-prefetch on\00"
@.str.3 = [33 x i8] c"stat-prefetch off on (%s) failed\00"
@.str.4 = [32 x i8] c"stat-prefetch on on (%s) failed\00"
define i32 @volfile_change(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i32 0, i32* %4
store i8* null, i8** %5
store i8* null, i8** %6
%7 = load i8*, i8** %3
%8 = call i32 @asprintf(i8** %5, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = load i32, i32* @errno
%14 = call i8* @strerror(i32 %13)
%15 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i32, i32* %4
store i32 %16, i32* %2
br label %54
17: ; preds = %1
%18 = load i8*, i8** %3
%19 = call i32 @asprintf(i8** %6, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %18)
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %17
%23 = load i32, i32* @stderr
%24 = load i32, i32* @errno
%25 = call i8* @strerror(i32 %24)
%26 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %25)
%27 = load i32, i32* %4
store i32 %27, i32* %2
br label %54
28: ; preds = %17
%29 = load i8*, i8** %5
%30 = call i32 @system(i8* %29)
store i32 %30, i32* %4
%31 = load i32, i32* %4
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %28
%34 = load i32, i32* @stderr
%35 = load i8*, i8** %3
%36 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* %35)
%37 = load i32, i32* %4
store i32 %37, i32* %2
br label %54
38: ; preds = %28
%39 = load i8*, i8** %6
%40 = call i32 @system(i8* %39)
store i32 %40, i32* %4
%41 = load i32, i32* %4
%42 = icmp slt i32 %41, 0
br i1 %42, label %43, label %48
43: ; preds = %38
%44 = load i32, i32* @stderr
%45 = load i8*, i8** %3
%46 = call i32 @fprintf(i32 %44, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %45)
%47 = load i32, i32* %4
store i32 %47, i32* %2
br label %54
48: ; preds = %38
%49 = load i8*, i8** %5
%50 = call i32 @free(i8* %49)
%51 = load i8*, i8** %6
%52 = call i32 @free(i8* %51)
%53 = load i32, i32* %4
store i32 %53, i32* %2
br label %54
54: ; preds = %48, %43, %33, %22, %11
%55 = load i32, i32* %2
ret i32 %55
}

LLVM IR (-O2):
@.str = [40 x i8] c"gluster volume set %s stat-prefetch off\00"
@stderr = global i32 0
@.str.1 = [41 x i8] c"cannot construct cli command string (%s)\00"
@errno = global i32 0
@.str.2 = [39 x i8] c"gluster volume set %s stat-prefetch on\00"
@.str.3 = [33 x i8] c"stat-prefetch off on (%s) failed\00"
@.str.4 = [32 x i8] c"stat-prefetch on on (%s) failed\00"
define i32 @volfile_change(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%5 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%6 = call i32 @asprintf(i8** %2, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %0)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i32, i32* @errno
%11 = call i8* @strerror(i32 %10)
%12 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %11)
br label %40
13: ; preds = %1
%14 = call i32 @asprintf(i8** %3, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = load i32, i32* @stderr
%18 = load i32, i32* @errno
%19 = call i8* @strerror(i32 %18)
%20 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %40
21: ; preds = %13
%22 = load i8*, i8** %2
%23 = call i32 @system(i8* %22)
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = load i32, i32* @stderr
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i8* %0)
br label %40
28: ; preds = %21
%29 = load i8*, i8** %3
%30 = call i32 @system(i8* %29)
%31 = icmp slt i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %28
%33 = load i32, i32* @stderr
%34 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* %0)
br label %40
35: ; preds = %28
%36 = load i8*, i8** %2
%37 = call i32 @free(i8* %36)
%38 = load i8*, i8** %3
%39 = call i32 @free(i8* %38)
br label %40
40: ; preds = %35, %32, %25, %16, %8
%41 = phi i32 [ %6, %8 ], [ %14, %16 ], [ %23, %25 ], [ %30, %32 ], [ %30, %35 ]
ret i32 %41
}