#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 dqblk {
  int dummy;
};
typedef int /*<<< orphan*/ *caddr_t;

/* Variables and functions */
int /*<<< orphan*/ GRPQUOTA;
int QCMD(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ Q_GETQUOTA;
int /*<<< orphan*/ Q_SYNC;
int /*<<< orphan*/ USRQUOTA;
int getuid();
int /*<<< orphan*/ quotactl(int, char *, int, int /*<<< orphan*/ *);
int main() {
  struct dqblk dqblk;
  uid_t uid;
  uid = getuid();
  quotactl(QCMD(Q_GETQUOTA, USRQUOTA), NULL, uid, (caddr_t)&dqblk);
  quotactl(QCMD(Q_SYNC, GRPQUOTA), NULL, 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    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getuid@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
mov    0x2e6f(%rip),%rax
mov    (%rax),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
mov    -0xc(%rbp),%edx
lea    -0x8(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%esi
call   1030 <quotactl@plt>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
mov    0x2e4e(%rip),%rax
mov    (%rax),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
xor    %eax,%eax
mov    %eax,%ecx
xor    %edx,%edx
mov    %rcx,%rsi
call   1030 <quotactl@plt>
mov    -0xc(%rbp),%edx
lea    -0x8(%rbp),%rcx
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <quotactl@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
mov    0x2e0a(%rip),%rax
mov    (%rax),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
mov    -0xc(%rbp),%edx
lea    -0x8(%rbp),%rcx
mov    $0xffffffffffffffff,%rsi
call   1030 <quotactl@plt>
mov    0x2dff(%rip),%rax
mov    (%rax),%edi
mov    0x2dde(%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    0x2dd4(%rip),%rax
mov    (%rax),%edi
mov    0x2db3(%rip),%rax
mov    (%rax),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    %eax,%esi
mov    $0xffffffffffffffff,%rcx
call   1030 <quotactl@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getuid@plt>
mov    %eax,%ebx
mov    0x2e98(%rip),%r15
mov    (%r15),%edi
mov    0x2e76(%rip),%r12
mov    (%r12),%esi
call   1050 <QCMD@plt>
mov    %rsp,%r14
mov    %eax,%edi
xor    %esi,%esi
mov    %ebx,%edx
mov    %r14,%rcx
call   1030 <quotactl@plt>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
mov    0x2e54(%rip),%rax
mov    (%rax),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <quotactl@plt>
mov    $0xffffffff,%edi
xor    %esi,%esi
mov    %ebx,%edx
mov    %r14,%rcx
call   1030 <quotactl@plt>
mov    (%r15),%edi
mov    (%r12),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
mov    $0xffffffffffffffff,%rsi
mov    %ebx,%edx
mov    %r14,%rcx
call   1030 <quotactl@plt>
mov    (%r15),%edi
mov    (%r12),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
xor    %esi,%esi
mov    $0xffffffff,%edx
mov    %r14,%rcx
call   1030 <quotactl@plt>
mov    (%r15),%edi
mov    (%r12),%esi
call   1050 <QCMD@plt>
mov    %eax,%edi
xor    %esi,%esi
mov    %ebx,%edx
mov    $0xffffffffffffffff,%rcx
call   1030 <quotactl@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.dqblk = type { i32 }
@Q_GETQUOTA = global i32 0
@USRQUOTA = global i32 0
@Q_SYNC = global i32 0
@GRPQUOTA = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.dqblk
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @getuid()
store i32 %4, i32* %3
%5 = load i32, i32* @Q_GETQUOTA
%6 = load i32, i32* @USRQUOTA
%7 = call i32 @QCMD(i32 %5, i32 %6)
%8 = load i32, i32* %3
%9 = bitcast %struct.dqblk* %2 to i32*
%10 = call i32 @quotactl(i32 %7, i8* null, i32 %8, i32* %9)
%11 = load i32, i32* @Q_SYNC
%12 = load i32, i32* @GRPQUOTA
%13 = call i32 @QCMD(i32 %11, i32 %12)
%14 = call i32 @quotactl(i32 %13, i8* null, i32 0, i32* null)
%15 = load i32, i32* %3
%16 = bitcast %struct.dqblk* %2 to i32*
%17 = call i32 @quotactl(i32 -1, i8* null, i32 %15, i32* %16)
%18 = load i32, i32* @Q_GETQUOTA
%19 = load i32, i32* @USRQUOTA
%20 = call i32 @QCMD(i32 %18, i32 %19)
%21 = load i32, i32* %3
%22 = bitcast %struct.dqblk* %2 to i32*
%23 = call i32 @quotactl(i32 %20, i8* inttoptr (i64 -1 to i8*), i32 %21, i32* %22)
%24 = load i32, i32* @Q_GETQUOTA
%25 = load i32, i32* @USRQUOTA
%26 = call i32 @QCMD(i32 %24, i32 %25)
%27 = bitcast %struct.dqblk* %2 to i32*
%28 = call i32 @quotactl(i32 %26, i8* null, i32 -1, i32* %27)
%29 = load i32, i32* @Q_GETQUOTA
%30 = load i32, i32* @USRQUOTA
%31 = call i32 @QCMD(i32 %29, i32 %30)
%32 = load i32, i32* %3
%33 = call i32 @quotactl(i32 %31, i8* null, i32 %32, i32* inttoptr (i64 -1 to i32*))
ret i32 0
}

LLVM IR (-O2):
%struct.dqblk = type { i32 }
@Q_GETQUOTA = global i32 0
@USRQUOTA = global i32 0
@Q_SYNC = global i32 0
@GRPQUOTA = global i32 0
define i32 @main() {
%1 = alloca %struct.dqblk
%2 = bitcast %struct.dqblk* %1 to i8*
%3 = tail call i32 (...) @getuid()
%4 = load i32, i32* @Q_GETQUOTA
%5 = load i32, i32* @USRQUOTA
%6 = tail call i32 @QCMD(i32 %4, i32 %5)
%7 = getelementptr inbounds %struct.dqblk, %struct.dqblk* %1, i64 0, i32 0
%8 = call i32 @quotactl(i32 %6, i8* null, i32 %3, i32* %7)
%9 = load i32, i32* @Q_SYNC
%10 = load i32, i32* @GRPQUOTA
%11 = call i32 @QCMD(i32 %9, i32 %10)
%12 = call i32 @quotactl(i32 %11, i8* null, i32 0, i32* null)
%13 = call i32 @quotactl(i32 -1, i8* null, i32 %3, i32* %7)
%14 = load i32, i32* @Q_GETQUOTA
%15 = load i32, i32* @USRQUOTA
%16 = call i32 @QCMD(i32 %14, i32 %15)
%17 = call i32 @quotactl(i32 %16, i8* inttoptr (i64 -1 to i8*), i32 %3, i32* %7)
%18 = load i32, i32* @Q_GETQUOTA
%19 = load i32, i32* @USRQUOTA
%20 = call i32 @QCMD(i32 %18, i32 %19)
%21 = call i32 @quotactl(i32 %20, i8* null, i32 -1, i32* %7)
%22 = load i32, i32* @Q_GETQUOTA
%23 = load i32, i32* @USRQUOTA
%24 = call i32 @QCMD(i32 %22, i32 %23)
%25 = call i32 @quotactl(i32 %24, i8* null, i32 %3, i32* inttoptr (i64 -1 to i32*))
ret i32 0
}