#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*/ command(char *, char *);
char *getpass(char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, scalar_t__);
void account(int argc, char *argv[]) {
  char buf[128], *ap;
  if (argc > 1) {
    *buf = 0;
    while (argc > 1) {
      --argc;
      ++argv;
      strncat(buf, *argv, sizeof(buf) - strlen(buf));
      buf[sizeof(buf) - 1] = 0;
    }
    ap = buf;
  } else {
    ap = getpass("Account:");
  }
  command("ACCT %s", ap);
}


x86 assembly (clang, -O0):
<account>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    11e1 <account+0xa1>
movb   $0x0,-0x90(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    11ce <account+0x8e>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
lea    -0x90(%rbp),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xa0(%rbp)
lea    -0x90(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0xa8(%rbp),%rdi
mov    -0xa0(%rbp),%rsi
mov    $0x80,%edx
sub    %rax,%rdx
call   1050 <strncat@plt>
movb   $0x0,-0x11(%rbp)
jmp    1163 <account+0x23>
lea    -0x90(%rbp),%rax
mov    %rax,-0x98(%rbp)
jmp    11f4 <account+0xb4>
lea    0xe18(%rip),%rdi
call   1060 <getpass@plt>
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rsi
lea    0xe07(%rip),%rdi
call   1040 <command@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<account>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x88,%rsp
cmp    $0x2,%edi
jl     11a1 <account+0x61>
mov    %rsi,%rbx
mov    %edi,%ebp
movb   $0x0,(%rsp)
add    $0x8,%rbx
add    $0x1,%ebp
mov    %rsp,%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rbx),%r15
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    $0x80,%edx
sub    %rax,%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <strncat@plt>
movb   $0x0,0x7f(%rsp)
add    $0x8,%rbx
add    $0xffffffff,%ebp
cmp    $0x2,%ebp
ja     1170 <account+0x30>
jmp    11b0 <account+0x70>
lea    0xe58(%rip),%rdi
call   1060 <getpass@plt>
mov    %rax,%r14
lea    0xe52(%rip),%rdi
mov    %r14,%rsi
call   1040 <command@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Account:\00"
@.str.1 = [8 x i8] c"ACCT %s\00"
define void @account(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [128 x i8]
%6 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %29
9: ; preds = %2
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
store i8 0, i8* %10
br label %11
11: ; preds = %14, %9
%12 = load i32, i32* %3
%13 = icmp sgt i32 %12, 1
br i1 %13, label %14, label %27
14: ; preds = %11
%15 = load i32, i32* %3
%16 = add nsw i32 %15, -1
store i32 %16, i32* %3
%17 = load i8**, i8*** %4
%18 = getelementptr inbounds i8*, i8** %17, i32 1
store i8** %18, i8*** %4
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%20 = load i8**, i8*** %4
%21 = load i8*, i8** %20
%22 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%23 = call i64 @strlen(i8* %22)
%24 = sub i64 128, %23
%25 = call i32 @strncat(i8* %19, i8* %21, i64 %24)
%26 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 127
store i8 0, i8* %26
br label %11
27: ; preds = %11
%28 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
store i8* %28, i8** %6
br label %31
29: ; preds = %2
%30 = call i8* @getpass(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i8* %30, i8** %6
br label %31
31: ; preds = %29, %27
%32 = load i8*, i8** %6
%33 = call i32 @command(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %32)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"Account:\00"
@.str.1 = [8 x i8] c"ACCT %s\00"
define void @account(i32 %0, i8** nocapture %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %18
6: ; preds = %2
store i8 0, i8* %4
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 127
br label %8
8: ; preds = %6, %8
%9 = phi i8** [ %1, %6 ], [ %12, %8 ]
%10 = phi i32 [ %0, %6 ], [ %11, %8 ]
%11 = add nsw i32 %10, -1
%12 = getelementptr inbounds i8*, i8** %9, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @strlen(i8* %4)
%15 = sub i64 128, %14
%16 = call i32 @strncat(i8* %4, i8* %13, i64 %15)
store i8 0, i8* %7
%17 = icmp ugt i32 %10, 2
br i1 %17, label %8, label %20
18: ; preds = %2
%19 = tail call i8* @getpass(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %8, %18
%21 = phi i8* [ %19, %18 ], [ %4, %8 ]
%22 = call i32 @command(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %21)
ret void
}