#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 /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ free_arg(char **);
int /*<<< orphan*/ logger(int, int /*<<< orphan*/, char *, int);
int run_script(char *, char **, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(char *, int, char *, unsigned int);
char *strdup(char *);
int quota_off(unsigned int veid, int force) {
  int i, ret;
  char buf[64];
  char *arg[5];
  i = 0;
  arg[i++] = strdup("/usr/sbin/vzquota");
  arg[i++] = strdup("off");
  snprintf(buf, sizeof(buf), "%d", veid);
  arg[i++] = strdup(buf);
  if (force)
    arg[i++] = strdup("-f");
  arg[i] = NULL;
  if ((ret = run_script("/usr/sbin/vzquota", arg, NULL, 0))) {
    if (ret != 6) {
      logger(-1, 0, "vzquota off failed [%d]", ret);
      ret = 66;
    }
  }
  free_arg(arg);
  return ret;
}


x86 assembly (clang, -O0):
<quota_off>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xe91(%rip),%rdi
call   1070 <strdup@plt>
mov    %rax,%rcx
mov    -0xc(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
cltq
mov    %rcx,-0x80(%rbp,%rax,8)
lea    0xe82(%rip),%rdi
call   1070 <strdup@plt>
mov    %rax,%rcx
mov    -0xc(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
cltq
mov    %rcx,-0x80(%rbp,%rax,8)
lea    -0x50(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    $0x40,%esi
lea    0xe59(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x50(%rbp),%rdi
call   1070 <strdup@plt>
mov    %rax,%rcx
mov    -0xc(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
cltq
mov    %rcx,-0x80(%rbp,%rax,8)
cmpl   $0x0,-0x8(%rbp)
je     120b <quota_off+0xbb>
lea    0xe28(%rip),%rdi
call   1070 <strdup@plt>
mov    %rax,%rcx
mov    -0xc(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
cltq
mov    %rcx,-0x80(%rbp,%rax,8)
movslq -0xc(%rbp),%rax
movq   $0x0,-0x80(%rbp,%rax,8)
lea    -0x80(%rbp),%rsi
lea    0xddd(%rip),%rdi
xor    %eax,%eax
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <run_script@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
je     1266 <quota_off+0x116>
cmpl   $0x6,-0x10(%rbp)
je     1261 <quota_off+0x111>
mov    -0x10(%rbp),%ecx
mov    $0xffffffff,%edi
xor    %esi,%esi
lea    0xdc7(%rip),%rdx
call   1050 <logger@plt>
movl   $0x42,-0x10(%rbp)
jmp    1266 <quota_off+0x116>
lea    -0x80(%rbp),%rdi
call   1060 <free_arg@plt>
mov    -0x10(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quota_off>:
push   %rbp
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %esi,%r14d
mov    %edi,%ebp
lea    0xe9c(%rip),%rdi
call   1070 <strdup@plt>
mov    %rax,(%rsp)
lea    0xe9e(%rip),%rdi
call   1070 <strdup@plt>
mov    %rax,0x8(%rsp)
lea    0xe91(%rip),%rdx
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x40,%esi
mov    %ebp,%ecx
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1070 <strdup@plt>
mov    %rax,0x10(%rsp)
test   %r14d,%r14d
je     11c3 <quota_off+0x73>
lea    0xe67(%rip),%rdi
call   1070 <strdup@plt>
mov    %rax,0x18(%rsp)
mov    $0x4,%eax
jmp    11c8 <quota_off+0x78>
mov    $0x3,%eax
movq   $0x0,(%rsp,%rax,8)
lea    0xe29(%rip),%rdi
mov    %rsp,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <run_script@plt>
mov    %eax,%ebx
test   %eax,%eax
je     1208 <quota_off+0xb8>
cmp    $0x6,%ebx
je     1208 <quota_off+0xb8>
lea    0xe27(%rip),%rdx
mov    $0xffffffff,%edi
xor    %esi,%esi
mov    %ebx,%ecx
call   1050 <logger@plt>
mov    $0x42,%ebx
mov    %rsp,%rdi
call   1060 <free_arg@plt>
mov    %ebx,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"/usr/sbin/vzquota\00"
@.str.1 = [4 x i8] c"off\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c"-f\00"
@.str.4 = [24 x i8] c"vzquota off failed [%d]\00"
define i32 @quota_off(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [64 x i8]
%8 = alloca [5 x i8*]
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%9 = call i8* @strdup(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* %5
%11 = add nsw i32 %10, 1
store i32 %11, i32* %5
%12 = sext i32 %10 to i64
%13 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i64 0, i64 %12
store i8* %9, i8** %13
%14 = call i8* @strdup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
%17 = sext i32 %15 to i64
%18 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i64 0, i64 %17
store i8* %14, i8** %18
%19 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%20 = load i32, i32* %3
%21 = call i32 @snprintf(i8* %19, i32 64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%23 = call i8* @strdup(i8* %22)
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
%26 = sext i32 %24 to i64
%27 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i64 0, i64 %26
store i8* %23, i8** %27
%28 = load i32, i32* %4
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %36
30: ; preds = %2
%31 = call i8* @strdup(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
%34 = sext i32 %32 to i64
%35 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i64 0, i64 %34
store i8* %31, i8** %35
br label %36
36: ; preds = %30, %2
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i64 0, i64 %38
store i8* null, i8** %39
%40 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i64 0, i64 0
%41 = call i32 @run_script(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %40, i32* null, i32 0)
store i32 %41, i32* %6
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %50
43: ; preds = %36
%44 = load i32, i32* %6
%45 = icmp ne i32 %44, 6
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = load i32, i32* %6
%48 = call i32 @logger(i32 -1, i32 0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %47)
store i32 66, i32* %6
br label %49
49: ; preds = %46, %43
br label %50
50: ; preds = %49, %36
%51 = getelementptr inbounds [5 x i8*], [5 x i8*]* %8, i64 0, i64 0
%52 = call i32 @free_arg(i8** %51)
%53 = load i32, i32* %6
ret i32 %53
}

LLVM IR (-O2):
@.str = [18 x i8] c"/usr/sbin/vzquota\00"
@.str.1 = [4 x i8] c"off\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [3 x i8] c"-f\00"
@.str.4 = [24 x i8] c"vzquota off failed [%d]\00"
define i32 @quota_off(i32 %0, i32 %1) {
%3 = alloca [64 x i8]
%4 = alloca [5 x i8*]
%5 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%6 = bitcast [5 x i8*]* %4 to i8*
%7 = tail call dereferenceable_or_null(18) i8* @strdup(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 0
store i8* %7, i8** %8
%9 = tail call dereferenceable_or_null(4) i8* @strdup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 1
store i8* %9, i8** %10
%11 = call i32 @snprintf(i8* %5, i32 64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %0)
%12 = call i8* @strdup(i8* %5)
%13 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 2
store i8* %12, i8** %13
%14 = icmp eq i32 %1, 0
br i1 %14, label %18, label %15
15: ; preds = %2
%16 = call dereferenceable_or_null(3) i8* @strdup(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%17 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 3
store i8* %16, i8** %17
br label %18
18: ; preds = %15, %2
%19 = phi i64 [ 4, %15 ], [ 3, %2 ]
%20 = getelementptr inbounds [5 x i8*], [5 x i8*]* %4, i64 0, i64 %19
store i8* null, i8** %20
%21 = call i32 @run_script(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %8, i32* null, i32 0)
switch i32 %21, label %22 [
i32 6, label %24
i32 0, label %24
]
22: ; preds = %18
%23 = call i32 @logger(i32 -1, i32 0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %21)
br label %24
24: ; preds = %18, %18, %22
%25 = phi i32 [ 66, %22 ], [ %21, %18 ], [ %21, %18 ]
%26 = call i32 @free_arg(i8** %8)
ret i32 %25
}