#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 */
struct acct_v3 {
  int /*<<< orphan*/ ac_comm;
  int /*<<< orphan*/ ac_majflt;
  int /*<<< orphan*/ ac_minflt;
  int /*<<< orphan*/ ac_mem;
  int /*<<< orphan*/ ac_stime;
  int /*<<< orphan*/ ac_utime;
  int /*<<< orphan*/ ac_etime;
  scalar_t__ ac_btime;
  scalar_t__ ac_ppid;
  scalar_t__ ac_pid;
  scalar_t__ ac_gid;
  scalar_t__ ac_uid;
  scalar_t__ ac_exitcode;
  scalar_t__ ac_tty;
  scalar_t__ ac_version;
  scalar_t__ ac_flag;
};

/* Variables and functions */
int /*<<< orphan*/ BUFSIZ;
int /*<<< orphan*/ _SC_CLK_TCK;
int comp_t2long(int /*<<< orphan*/);
int snprintf(char *, int /*<<< orphan*/, char *, long, long, long, long, long,
             long, long, long, long, int /*<<< orphan*/, int, int, int, int,
             int, int /*<<< orphan*/);
int sysconf(int /*<<< orphan*/);
char *acct2str(char *buf, struct acct_v3 *ptr) {
  int rtnVal = 0;
  rtnVal = snprintf(
      buf, BUFSIZ,
      "%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%f,%ld,%ld,%ld,%ld,%ld,%s\n",
      (long)ptr->ac_flag, (long)ptr->ac_version, (long)ptr->ac_tty,
      (long)ptr->ac_exitcode, (long)ptr->ac_uid, (long)ptr->ac_gid,
      (long)ptr->ac_pid, (long)ptr->ac_ppid, (long)ptr->ac_btime, ptr->ac_etime,
      comp_t2long(ptr->ac_utime) / sysconf(_SC_CLK_TCK),
      comp_t2long(ptr->ac_stime) / sysconf(_SC_CLK_TCK),
      comp_t2long(ptr->ac_mem), comp_t2long(ptr->ac_minflt),
      comp_t2long(ptr->ac_majflt), ptr->ac_comm);
  return buf;
}


x86 assembly (clang, -O0):
<acct2str>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    0x2e73(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x38(%rbp),%rax
mov    0x60(%rax),%rax
mov    %rax,-0x88(%rbp)
mov    -0x38(%rbp),%rax
mov    0x58(%rax),%rax
mov    %rax,-0x80(%rbp)
mov    -0x38(%rbp),%rax
mov    0x50(%rax),%rax
mov    %rax,-0x78(%rbp)
mov    -0x38(%rbp),%rax
mov    0x48(%rax),%rax
mov    %rax,-0x68(%rbp)
mov    -0x38(%rbp),%rax
mov    0x40(%rax),%rax
mov    %rax,-0x60(%rbp)
mov    -0x38(%rbp),%rax
mov    0x38(%rax),%rax
mov    %rax,-0x58(%rbp)
mov    -0x38(%rbp),%rax
mov    0x30(%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x38(%rbp),%rax
mov    0x28(%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rax
mov    0x20(%rax),%r13
mov    -0x38(%rbp),%rax
mov    0x18(%rax),%r12d
mov    -0x38(%rbp),%rax
mov    0x14(%rax),%edi
call   1040 <comp_t2long@plt>
mov    %eax,-0xa0(%rbp)
mov    0x2de7(%rip),%rax
mov    (%rax),%edi
call   1050 <sysconf@plt>
mov    %eax,%ecx
mov    -0xa0(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%r15d
mov    -0x38(%rbp),%rax
mov    0x10(%rax),%edi
call   1040 <comp_t2long@plt>
mov    %eax,-0x9c(%rbp)
mov    0x2db9(%rip),%rax
mov    (%rax),%edi
call   1050 <sysconf@plt>
mov    %eax,%ecx
mov    -0x9c(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%r14d
mov    -0x38(%rbp),%rax
mov    0xc(%rax),%edi
call   1040 <comp_t2long@plt>
mov    %eax,%ebx
mov    -0x38(%rbp),%rax
mov    0x8(%rax),%edi
call   1040 <comp_t2long@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%edi
call   1040 <comp_t2long@plt>
mov    -0x98(%rbp),%rdi
mov    -0x8c(%rbp),%esi
mov    -0x88(%rbp),%rcx
mov    -0x80(%rbp),%r8
mov    -0x78(%rbp),%r9
mov    -0x6c(%rbp),%r11d
mov    %eax,%r10d
mov    -0x68(%rbp),%rax
mov    -0x38(%rbp),%rdx
mov    (%rdx),%edx
mov    %edx,-0x40(%rbp)
lea    0xd64(%rip),%rdx
mov    %rax,(%rsp)
mov    -0x60(%rbp),%rax
mov    %rax,0x8(%rsp)
mov    -0x58(%rbp),%rax
mov    %rax,0x10(%rsp)
mov    -0x50(%rbp),%rax
mov    %rax,0x18(%rsp)
mov    -0x48(%rbp),%rax
mov    %rax,0x20(%rsp)
mov    -0x40(%rbp),%eax
mov    %r13,0x28(%rsp)
mov    %r12d,0x30(%rsp)
mov    %r15d,0x38(%rsp)
mov    %r14d,0x40(%rsp)
mov    %ebx,0x48(%rsp)
mov    %r11d,0x50(%rsp)
mov    %r10d,0x58(%rsp)
mov    %eax,0x60(%rsp)
call   1030 <snprintf@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x30(%rbp),%rax
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<acct2str>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rsi,%rbp
mov    %rdi,%r13
mov    0x2e8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
mov    0x60(%rsi),%rax
mov    %rax,0x18(%rsp)
mov    0x58(%rsi),%rax
mov    %rax,0x10(%rsp)
mov    0x50(%rsi),%rax
mov    %rax,0x8(%rsp)
mov    0x48(%rsi),%rax
mov    %rax,0x50(%rsp)
mov    0x40(%rsi),%rax
mov    %rax,0x48(%rsp)
mov    0x38(%rsi),%rax
mov    %rax,0x40(%rsp)
mov    0x30(%rsi),%rax
mov    %rax,0x38(%rsp)
mov    0x28(%rsi),%rax
mov    %rax,0x30(%rsp)
mov    0x20(%rsi),%rax
mov    %rax,0x28(%rsp)
mov    0x14(%rsi),%edi
mov    0x18(%rsi),%eax
mov    %rax,0x20(%rsp)
call   1040 <comp_t2long@plt>
mov    %eax,%ebx
mov    0x2e25(%rip),%r15
mov    (%r15),%edi
call   1050 <sysconf@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
mov    %eax,%r14d
mov    0x10(%rbp),%edi
call   1040 <comp_t2long@plt>
mov    %eax,%ebx
mov    (%r15),%edi
call   1050 <sysconf@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
mov    %eax,%r15d
mov    0xc(%rbp),%edi
call   1040 <comp_t2long@plt>
mov    %eax,%r12d
mov    0x8(%rbp),%edi
call   1040 <comp_t2long@plt>
mov    %eax,%ebx
mov    0x4(%rbp),%edi
call   1040 <comp_t2long@plt>
mov    0x0(%rbp),%ebp
sub    $0x8,%rsp
lea    0xdec(%rip),%rdx
mov    %r13,%rdi
mov    0xc(%rsp),%esi
mov    0x20(%rsp),%rcx
mov    0x18(%rsp),%r8
mov    0x10(%rsp),%r9
push   %rbp
push   %rax
push   %rbx
push   %r12
push   %r15
push   %r14
push   0x58(%rsp)
push   0x68(%rsp)
push   0x78(%rsp)
push   0x88(%rsp)
push   0x98(%rsp)
push   0xa8(%rsp)
push   0xb8(%rsp)
call   1030 <snprintf@plt>
add    $0x70,%rsp
mov    %r13,%rax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.acct_v3 = type { i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
@BUFSIZ = global i32 0
@.str = [63 x i8] c"%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%f,%ld,%ld,%ld,%ld,%ld,%s\0A\00"
@_SC_CLK_TCK = global i32 0
define i8* @acct2str(i8* %0, %struct.acct_v3* %1) {
%3 = alloca i8*
%4 = alloca %struct.acct_v3*
%5 = alloca i32
store i8* %0, i8** %3
store %struct.acct_v3* %1, %struct.acct_v3** %4
store i32 0, i32* %5
%6 = load i8*, i8** %3
%7 = load i32, i32* @BUFSIZ
%8 = load %struct.acct_v3*, %struct.acct_v3** %4
%9 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %8, i32 0, i32 15
%10 = load i64, i64* %9
%11 = load %struct.acct_v3*, %struct.acct_v3** %4
%12 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %11, i32 0, i32 14
%13 = load i64, i64* %12
%14 = load %struct.acct_v3*, %struct.acct_v3** %4
%15 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %14, i32 0, i32 13
%16 = load i64, i64* %15
%17 = load %struct.acct_v3*, %struct.acct_v3** %4
%18 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %17, i32 0, i32 12
%19 = load i64, i64* %18
%20 = load %struct.acct_v3*, %struct.acct_v3** %4
%21 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %20, i32 0, i32 11
%22 = load i64, i64* %21
%23 = load %struct.acct_v3*, %struct.acct_v3** %4
%24 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %23, i32 0, i32 10
%25 = load i64, i64* %24
%26 = load %struct.acct_v3*, %struct.acct_v3** %4
%27 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %26, i32 0, i32 9
%28 = load i64, i64* %27
%29 = load %struct.acct_v3*, %struct.acct_v3** %4
%30 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %29, i32 0, i32 8
%31 = load i64, i64* %30
%32 = load %struct.acct_v3*, %struct.acct_v3** %4
%33 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %32, i32 0, i32 7
%34 = load i64, i64* %33
%35 = load %struct.acct_v3*, %struct.acct_v3** %4
%36 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %35, i32 0, i32 6
%37 = load i32, i32* %36
%38 = load %struct.acct_v3*, %struct.acct_v3** %4
%39 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %38, i32 0, i32 5
%40 = load i32, i32* %39
%41 = call i32 @comp_t2long(i32 %40)
%42 = load i32, i32* @_SC_CLK_TCK
%43 = call i32 @sysconf(i32 %42)
%44 = sdiv i32 %41, %43
%45 = load %struct.acct_v3*, %struct.acct_v3** %4
%46 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %45, i32 0, i32 4
%47 = load i32, i32* %46
%48 = call i32 @comp_t2long(i32 %47)
%49 = load i32, i32* @_SC_CLK_TCK
%50 = call i32 @sysconf(i32 %49)
%51 = sdiv i32 %48, %50
%52 = load %struct.acct_v3*, %struct.acct_v3** %4
%53 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %52, i32 0, i32 3
%54 = load i32, i32* %53
%55 = call i32 @comp_t2long(i32 %54)
%56 = load %struct.acct_v3*, %struct.acct_v3** %4
%57 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %56, i32 0, i32 2
%58 = load i32, i32* %57
%59 = call i32 @comp_t2long(i32 %58)
%60 = load %struct.acct_v3*, %struct.acct_v3** %4
%61 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %60, i32 0, i32 1
%62 = load i32, i32* %61
%63 = call i32 @comp_t2long(i32 %62)
%64 = load %struct.acct_v3*, %struct.acct_v3** %4
%65 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %64, i32 0, i32 0
%66 = load i32, i32* %65
%67 = call i32 @snprintf(i8* %6, i32 %7, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i64 %10, i64 %13, i64 %16, i64 %19, i64 %22, i64 %25, i64 %28, i64 %31, i64 %34, i32 %37, i32 %44, i32 %51, i32 %55, i32 %59, i32 %63, i32 %66)
store i32 %67, i32* %5
%68 = load i8*, i8** %3
ret i8* %68
}

LLVM IR (-O2):
%struct.acct_v3 = type { i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i64, i64, i64 }
@BUFSIZ = global i32 0
@.str = [63 x i8] c"%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%f,%ld,%ld,%ld,%ld,%ld,%s\0A\00"
@_SC_CLK_TCK = global i32 0
define i8* @acct2str(i8* returned %0, %struct.acct_v3* nocapture %1) {
%3 = load i32, i32* @BUFSIZ
%4 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %1, i64 0, i32 15
%5 = load i64, i64* %4
%6 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %1, i64 0, i32 14
%7 = load i64, i64* %6
%8 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %1, i64 0, i32 13
%9 = load i64, i64* %8
%10 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %1, i64 0, i32 12
%11 = load i64, i64* %10
%12 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %1, i64 0, i32 11
%13 = load i64, i64* %12
%14 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %1, i64 0, i32 10
%15 = load i64, i64* %14
%16 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %1, i64 0, i32 9
%17 = load i64, i64* %16
%18 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %1, i64 0, i32 8
%19 = load i64, i64* %18
%20 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %1, i64 0, i32 7
%21 = load i64, i64* %20
%22 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %1, i64 0, i32 6
%23 = load i32, i32* %22
%24 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %1, i64 0, i32 5
%25 = load i32, i32* %24
%26 = tail call i32 @comp_t2long(i32 %25)
%27 = load i32, i32* @_SC_CLK_TCK
%28 = tail call i32 @sysconf(i32 %27)
%29 = sdiv i32 %26, %28
%30 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %1, i64 0, i32 4
%31 = load i32, i32* %30
%32 = tail call i32 @comp_t2long(i32 %31)
%33 = load i32, i32* @_SC_CLK_TCK
%34 = tail call i32 @sysconf(i32 %33)
%35 = sdiv i32 %32, %34
%36 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %1, i64 0, i32 3
%37 = load i32, i32* %36
%38 = tail call i32 @comp_t2long(i32 %37)
%39 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %1, i64 0, i32 2
%40 = load i32, i32* %39
%41 = tail call i32 @comp_t2long(i32 %40)
%42 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %1, i64 0, i32 1
%43 = load i32, i32* %42
%44 = tail call i32 @comp_t2long(i32 %43)
%45 = getelementptr inbounds %struct.acct_v3, %struct.acct_v3* %1, i64 0, i32 0
%46 = load i32, i32* %45
%47 = tail call i32 @snprintf(i8* %0, i32 %3, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i64 %5, i64 %7, i64 %9, i64 %11, i64 %13, i64 %15, i64 %17, i64 %19, i64 %21, i32 %23, i32 %29, i32 %35, i32 %38, i32 %41, i32 %44, i32 %46)
ret i8* %0
}