#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 uid_t;
struct dqinfo {
  int dummy;
};
struct dqblk {
  int dummy;
};
typedef char *caddr_t;

/* Variables and functions */
int QCMD(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ Q_GETFMT;
int /*<<< orphan*/ Q_GETINFO;
int /*<<< orphan*/ Q_GETQUOTA;
int /*<<< orphan*/ Q_QUOTAOFF;
int /*<<< orphan*/ Q_QUOTAON;
int /*<<< orphan*/ Q_SETINFO;
int /*<<< orphan*/ Q_SETQUOTA;
int /*<<< orphan*/ Q_SYNC;
int /*<<< orphan*/ USRQUOTA;
int getuid();
int /*<<< orphan*/ quotactl(int, char *, int, char *);
int main() {
  struct dqblk dqblk;
  struct dqinfo dqinfo;
  uid_t uid;
  int qfmt;
  uid = getuid();
  quotactl(QCMD(Q_QUOTAON, USRQUOTA), "somedevice", 2,
           "staptestmnt/aquota.user");
  quotactl(QCMD(Q_GETQUOTA, USRQUOTA), "somedevice", getuid(), (caddr_t)&dqblk);
  quotactl(QCMD(Q_SETQUOTA, USRQUOTA), "somedevice", getuid(), (caddr_t)&dqblk);
  quotactl(QCMD(Q_GETINFO, USRQUOTA), "somedevice", getuid(), (caddr_t)&dqinfo);
  quotactl(QCMD(Q_SETINFO, USRQUOTA), "somedevice", getuid(), (caddr_t)&dqinfo);
  quotactl(QCMD(Q_GETFMT, USRQUOTA), "somedevice", getuid(), (caddr_t)&qfmt);
  quotactl(QCMD(Q_SYNC, USRQUOTA), "somedevice", 0, NULL);
  quotactl(QCMD(Q_QUOTAOFF, USRQUOTA), "somedevice", 0, NULL);
  quotactl(-1, NULL, uid, (caddr_t)&dqblk);
  quotactl(QCMD(Q_GETQUOTA, USRQUOTA), (char *)-1, uid, (caddr_t)&dqblk);
  quotactl(QCMD(Q_GETQUOTA, USRQUOTA), NULL, -1, (caddr_t)&dqblk);
  quotactl(QCMD(Q_GETQUOTA, USRQUOTA), NULL, uid, (caddr_t)-1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getuid@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
mov    0x2e5f(%rip),%rax
mov    (%rax),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
lea    0xe97(%rip),%rsi
mov    $0x2,%edx
lea    0xe96(%rip),%rcx
call   1030 <quotactl@plt>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
mov    0x2e2e(%rip),%rax
mov    (%rax),%esi
call   1050 <QCMD@plt>
mov    %eax,-0x2c(%rbp)
mov    $0x0,%al
call   1040 <getuid@plt>
mov    -0x2c(%rbp),%edi
mov    %eax,%edx
lea    -0x8(%rbp),%rcx
lea    0xe55(%rip),%rsi
call   1030 <quotactl@plt>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
mov    0x2df8(%rip),%rax
mov    (%rax),%esi
call   1050 <QCMD@plt>
mov    %eax,-0x28(%rbp)
mov    $0x0,%al
call   1040 <getuid@plt>
mov    -0x28(%rbp),%edi
mov    %eax,%edx
lea    -0x8(%rbp),%rcx
lea    0xe1f(%rip),%rsi
call   1030 <quotactl@plt>
mov    0x2dc3(%rip),%rax
mov    (%rax),%edi
mov    0x2dc2(%rip),%rax
mov    (%rax),%esi
call   1050 <QCMD@plt>
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   1040 <getuid@plt>
mov    -0x24(%rbp),%edi
mov    %eax,%edx
lea    -0x10(%rbp),%rcx
lea    0xde9(%rip),%rsi
call   1030 <quotactl@plt>
mov    0x2d75(%rip),%rax
mov    (%rax),%edi
mov    0x2d8c(%rip),%rax
mov    (%rax),%esi
call   1050 <QCMD@plt>
mov    %eax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <getuid@plt>
mov    -0x20(%rbp),%edi
mov    %eax,%edx
lea    -0x10(%rbp),%rcx
lea    0xdb3(%rip),%rsi
call   1030 <quotactl@plt>
mov    0x2d87(%rip),%rax
mov    (%rax),%edi
mov    0x2d56(%rip),%rax
mov    (%rax),%esi
call   1050 <QCMD@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1040 <getuid@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%edx
lea    -0x18(%rbp),%rcx
lea    0xd7d(%rip),%rsi
call   1030 <quotactl@plt>
mov    0x2d41(%rip),%rax
mov    (%rax),%edi
mov    0x2d20(%rip),%rax
mov    (%rax),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
lea    0xd58(%rip),%rsi
xor    %edx,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <quotactl@plt>
mov    0x2d2e(%rip),%rax
mov    (%rax),%edi
mov    0x2cf5(%rip),%rax
mov    (%rax),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
lea    0xd2d(%rip),%rsi
xor    %edx,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <quotactl@plt>
mov    -0x14(%rbp),%edx
lea    -0x8(%rbp),%rcx
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <quotactl@plt>
mov    0x2cce(%rip),%rax
mov    (%rax),%edi
mov    0x2cb5(%rip),%rax
mov    (%rax),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
mov    -0x14(%rbp),%edx
lea    -0x8(%rbp),%rcx
mov    $0xffffffffffffffff,%rsi
call   1030 <quotactl@plt>
mov    0x2ca2(%rip),%rax
mov    (%rax),%edi
mov    0x2c89(%rip),%rax
mov    (%rax),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
lea    -0x8(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%esi
mov    $0xffffffff,%edx
call   1030 <quotactl@plt>
mov    0x2c77(%rip),%rax
mov    (%rax),%edi
mov    0x2c5e(%rip),%rax
mov    (%rax),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
mov    -0x14(%rbp),%edx
xor    %eax,%eax
mov    %eax,%esi
mov    $0xffffffffffffffff,%rcx
call   1030 <quotactl@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1040 <getuid@plt>
mov    %eax,%r15d
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
mov    0x2e60(%rip),%r13
mov    0x0(%r13),%esi
call   1050 <QCMD@plt>
lea    0xe98(%rip),%r12
lea    0xe9c(%rip),%rcx
mov    %eax,%edi
mov    %r12,%rsi
mov    $0x2,%edx
call   1030 <quotactl@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%esi
call   1050 <QCMD@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <getuid@plt>
lea    0x10(%rsp),%r14
mov    %ebp,%edi
mov    %r12,%rsi
mov    %eax,%edx
mov    %r14,%rcx
call   1030 <quotactl@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%esi
call   1050 <QCMD@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <getuid@plt>
mov    %ebp,%edi
mov    %r12,%rsi
mov    %eax,%edx
mov    %r14,%rcx
call   1030 <quotactl@plt>
mov    0x2dd2(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%esi
call   1050 <QCMD@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <getuid@plt>
lea    0x8(%rsp),%rbx
mov    %ebp,%edi
mov    %r12,%rsi
mov    %eax,%edx
mov    %rbx,%rcx
call   1030 <quotactl@plt>
mov    0x2d8b(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%esi
call   1050 <QCMD@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <getuid@plt>
mov    %ebp,%edi
mov    %r12,%rsi
mov    %eax,%edx
mov    %rbx,%rcx
call   1030 <quotactl@plt>
mov    0x2da9(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%esi
call   1050 <QCMD@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getuid@plt>
lea    0x14(%rsp),%rcx
mov    %ebx,%edi
mov    %r12,%rsi
mov    %eax,%edx
call   1030 <quotactl@plt>
mov    0x2d6d(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
mov    %r12,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <quotactl@plt>
mov    0x2d65(%rip),%rax
mov    (%rax),%edi
mov    0x0(%r13),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
mov    %r12,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <quotactl@plt>
mov    $0xffffffff,%edi
xor    %esi,%esi
mov    %r15d,%edx
mov    %r14,%rcx
call   1030 <quotactl@plt>
mov    0x2d13(%rip),%rbx
mov    (%rbx),%edi
mov    0x0(%r13),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
mov    $0xffffffffffffffff,%rsi
mov    %r15d,%edx
mov    %r14,%rcx
call   1030 <quotactl@plt>
mov    (%rbx),%edi
mov    0x0(%r13),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
xor    %esi,%esi
mov    $0xffffffff,%edx
mov    %r14,%rcx
call   1030 <quotactl@plt>
mov    (%rbx),%edi
mov    0x0(%r13),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
xor    %esi,%esi
mov    %r15d,%edx
mov    $0xffffffffffffffff,%rcx
call   1030 <quotactl@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.dqblk = type { i32 }
%struct.dqinfo = type { i32 }
@Q_QUOTAON = global i32 0
@USRQUOTA = global i32 0
@.str = [11 x i8] c"somedevice\00"
@.str.1 = [24 x i8] c"staptestmnt/aquota.user\00"
@Q_GETQUOTA = global i32 0
@Q_SETQUOTA = global i32 0
@Q_GETINFO = global i32 0
@Q_SETINFO = global i32 0
@Q_GETFMT = global i32 0
@Q_SYNC = global i32 0
@Q_QUOTAOFF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.dqblk
%3 = alloca %struct.dqinfo
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (...) @getuid()
store i32 %6, i32* %4
%7 = load i32, i32* @Q_QUOTAON
%8 = load i32, i32* @USRQUOTA
%9 = call i32 @QCMD(i32 %7, i32 %8)
%10 = call i32 @quotactl(i32 %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 2, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* @Q_GETQUOTA
%12 = load i32, i32* @USRQUOTA
%13 = call i32 @QCMD(i32 %11, i32 %12)
%14 = call i32 (...) @getuid()
%15 = bitcast %struct.dqblk* %2 to i8*
%16 = call i32 @quotactl(i32 %13, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %14, i8* %15)
%17 = load i32, i32* @Q_SETQUOTA
%18 = load i32, i32* @USRQUOTA
%19 = call i32 @QCMD(i32 %17, i32 %18)
%20 = call i32 (...) @getuid()
%21 = bitcast %struct.dqblk* %2 to i8*
%22 = call i32 @quotactl(i32 %19, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %20, i8* %21)
%23 = load i32, i32* @Q_GETINFO
%24 = load i32, i32* @USRQUOTA
%25 = call i32 @QCMD(i32 %23, i32 %24)
%26 = call i32 (...) @getuid()
%27 = bitcast %struct.dqinfo* %3 to i8*
%28 = call i32 @quotactl(i32 %25, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %26, i8* %27)
%29 = load i32, i32* @Q_SETINFO
%30 = load i32, i32* @USRQUOTA
%31 = call i32 @QCMD(i32 %29, i32 %30)
%32 = call i32 (...) @getuid()
%33 = bitcast %struct.dqinfo* %3 to i8*
%34 = call i32 @quotactl(i32 %31, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %32, i8* %33)
%35 = load i32, i32* @Q_GETFMT
%36 = load i32, i32* @USRQUOTA
%37 = call i32 @QCMD(i32 %35, i32 %36)
%38 = call i32 (...) @getuid()
%39 = bitcast i32* %5 to i8*
%40 = call i32 @quotactl(i32 %37, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %38, i8* %39)
%41 = load i32, i32* @Q_SYNC
%42 = load i32, i32* @USRQUOTA
%43 = call i32 @QCMD(i32 %41, i32 %42)
%44 = call i32 @quotactl(i32 %43, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 0, i8* null)
%45 = load i32, i32* @Q_QUOTAOFF
%46 = load i32, i32* @USRQUOTA
%47 = call i32 @QCMD(i32 %45, i32 %46)
%48 = call i32 @quotactl(i32 %47, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 0, i8* null)
%49 = load i32, i32* %4
%50 = bitcast %struct.dqblk* %2 to i8*
%51 = call i32 @quotactl(i32 -1, i8* null, i32 %49, i8* %50)
%52 = load i32, i32* @Q_GETQUOTA
%53 = load i32, i32* @USRQUOTA
%54 = call i32 @QCMD(i32 %52, i32 %53)
%55 = load i32, i32* %4
%56 = bitcast %struct.dqblk* %2 to i8*
%57 = call i32 @quotactl(i32 %54, i8* inttoptr (i64 -1 to i8*), i32 %55, i8* %56)
%58 = load i32, i32* @Q_GETQUOTA
%59 = load i32, i32* @USRQUOTA
%60 = call i32 @QCMD(i32 %58, i32 %59)
%61 = bitcast %struct.dqblk* %2 to i8*
%62 = call i32 @quotactl(i32 %60, i8* null, i32 -1, i8* %61)
%63 = load i32, i32* @Q_GETQUOTA
%64 = load i32, i32* @USRQUOTA
%65 = call i32 @QCMD(i32 %63, i32 %64)
%66 = load i32, i32* %4
%67 = call i32 @quotactl(i32 %65, i8* null, i32 %66, i8* inttoptr (i64 -1 to i8*))
ret i32 0
}

LLVM IR (-O2):
%struct.dqblk = type { i32 }
%struct.dqinfo = type { i32 }
@Q_QUOTAON = global i32 0
@USRQUOTA = global i32 0
@.str = [11 x i8] c"somedevice\00"
@.str.1 = [24 x i8] c"staptestmnt/aquota.user\00"
@Q_GETQUOTA = global i32 0
@Q_SETQUOTA = global i32 0
@Q_GETINFO = global i32 0
@Q_SETINFO = global i32 0
@Q_GETFMT = global i32 0
@Q_SYNC = global i32 0
@Q_QUOTAOFF = global i32 0
define i32 @main() {
%1 = alloca %struct.dqblk
%2 = alloca %struct.dqinfo
%3 = alloca i32
%4 = bitcast %struct.dqblk* %1 to i8*
%5 = bitcast %struct.dqinfo* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (...) @getuid()
%8 = load i32, i32* @Q_QUOTAON
%9 = load i32, i32* @USRQUOTA
%10 = tail call i32 @QCMD(i32 %8, i32 %9)
%11 = tail call i32 @quotactl(i32 %10, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 2, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* @Q_GETQUOTA
%13 = load i32, i32* @USRQUOTA
%14 = tail call i32 @QCMD(i32 %12, i32 %13)
%15 = tail call i32 (...) @getuid()
%16 = call i32 @quotactl(i32 %14, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %15, i8* %4)
%17 = load i32, i32* @Q_SETQUOTA
%18 = load i32, i32* @USRQUOTA
%19 = call i32 @QCMD(i32 %17, i32 %18)
%20 = call i32 (...) @getuid()
%21 = call i32 @quotactl(i32 %19, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %20, i8* %4)
%22 = load i32, i32* @Q_GETINFO
%23 = load i32, i32* @USRQUOTA
%24 = call i32 @QCMD(i32 %22, i32 %23)
%25 = call i32 (...) @getuid()
%26 = call i32 @quotactl(i32 %24, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %25, i8* %5)
%27 = load i32, i32* @Q_SETINFO
%28 = load i32, i32* @USRQUOTA
%29 = call i32 @QCMD(i32 %27, i32 %28)
%30 = call i32 (...) @getuid()
%31 = call i32 @quotactl(i32 %29, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %30, i8* %5)
%32 = load i32, i32* @Q_GETFMT
%33 = load i32, i32* @USRQUOTA
%34 = call i32 @QCMD(i32 %32, i32 %33)
%35 = call i32 (...) @getuid()
%36 = call i32 @quotactl(i32 %34, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %35, i8* %6)
%37 = load i32, i32* @Q_SYNC
%38 = load i32, i32* @USRQUOTA
%39 = call i32 @QCMD(i32 %37, i32 %38)
%40 = call i32 @quotactl(i32 %39, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 0, i8* null)
%41 = load i32, i32* @Q_QUOTAOFF
%42 = load i32, i32* @USRQUOTA
%43 = call i32 @QCMD(i32 %41, i32 %42)
%44 = call i32 @quotactl(i32 %43, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 0, i8* null)
%45 = call i32 @quotactl(i32 -1, i8* null, i32 %7, i8* %4)
%46 = load i32, i32* @Q_GETQUOTA
%47 = load i32, i32* @USRQUOTA
%48 = call i32 @QCMD(i32 %46, i32 %47)
%49 = call i32 @quotactl(i32 %48, i8* inttoptr (i64 -1 to i8*), i32 %7, i8* %4)
%50 = load i32, i32* @Q_GETQUOTA
%51 = load i32, i32* @USRQUOTA
%52 = call i32 @QCMD(i32 %50, i32 %51)
%53 = call i32 @quotactl(i32 %52, i8* null, i32 -1, i8* %4)
%54 = load i32, i32* @Q_GETQUOTA
%55 = load i32, i32* @USRQUOTA
%56 = call i32 @QCMD(i32 %54, i32 %55)
%57 = call i32 @quotactl(i32 %56, i8* null, i32 %7, i8* inttoptr (i64 -1 to i8*))
ret i32 0
}