#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 */

/* Variables and functions */
int /*<<< orphan*/ command(char *, char *);
char *getpass(char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, scalar_t__);
int /*<<< orphan*/ strncpy(char *, char *, int);
void account(int argc, char **argv) {
  char acct[50], *ap;
  if (argc > 1) {
    ++argv;
    --argc;
    (void)strncpy(acct, *argv, 49);
    acct[49] = '\0';
    while (argc > 1) {
      --argc;
      ++argv;
      (void)strncat(acct, *argv, 49 - strlen(acct));
    }
    ap = acct;
  } else {
    ap = getpass("Account:");
  }
  (void)command("ACCT %s", ap);
}


x86 assembly (clang, -O0):
<account>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    11f9 <account+0xa9>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    $0x31,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x1f(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    11ec <account+0x9c>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x60(%rbp)
lea    -0x50(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x68(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    $0x31,%edx
sub    %rax,%rdx
call   1060 <strncat@plt>
jmp    1197 <account+0x47>
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
jmp    1209 <account+0xb9>
lea    0xe00(%rip),%rdi
call   1070 <getpass@plt>
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rsi
lea    0xdf5(%rip),%rdi
call   1050 <command@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<account>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x38,%rsp
cmp    $0x2,%edi
jl     11bc <account+0x6c>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsp,%r14
mov    0x8(%rsi),%rsi
mov    %r14,%rdi
mov    $0x31,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x31(%rsp)
cmp    $0x2,%ebp
je     11cb <account+0x7b>
add    $0x10,%rbx
add    $0x1,%ebp
mov    %rsp,%r14
nopl   0x0(%rax)
mov    (%rbx),%r15
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    $0x31,%edx
sub    %rax,%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <strncat@plt>
add    $0x8,%rbx
add    $0xffffffff,%ebp
cmp    $0x3,%ebp
ja     1190 <account+0x40>
jmp    11cb <account+0x7b>
lea    0xe3d(%rip),%rdi
call   1070 <getpass@plt>
mov    %rax,%r14
lea    0xe37(%rip),%rdi
mov    %r14,%rsi
call   1050 <command@plt>
add    $0x38,%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 [50 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 %36
9: ; preds = %2
%10 = load i8**, i8*** %4
%11 = getelementptr inbounds i8*, i8** %10, i32 1
store i8** %11, i8*** %4
%12 = load i32, i32* %3
%13 = add nsw i32 %12, -1
store i32 %13, i32* %3
%14 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%15 = load i8**, i8*** %4
%16 = load i8*, i8** %15
%17 = call i32 @strncpy(i8* %14, i8* %16, i32 49)
%18 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 49
store i8 0, i8* %18
br label %19
19: ; preds = %22, %9
%20 = load i32, i32* %3
%21 = icmp sgt i32 %20, 1
br i1 %21, label %22, label %34
22: ; preds = %19
%23 = load i32, i32* %3
%24 = add nsw i32 %23, -1
store i32 %24, i32* %3
%25 = load i8**, i8*** %4
%26 = getelementptr inbounds i8*, i8** %25, i32 1
store i8** %26, i8*** %4
%27 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%28 = load i8**, i8*** %4
%29 = load i8*, i8** %28
%30 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%31 = call i64 @strlen(i8* %30)
%32 = sub nsw i64 49, %31
%33 = call i32 @strncat(i8* %27, i8* %29, i64 %32)
br label %19
34: ; preds = %19
%35 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
store i8* %35, i8** %6
br label %38
36: ; preds = %2
%37 = call i8* @getpass(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i8* %37, i8** %6
br label %38
38: ; preds = %36, %34
%39 = load i8*, i8** %6
%40 = call i32 @command(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %39)
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 [50 x i8]
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %22
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @strncpy(i8* %4, i8* %8, i32 49)
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 49
store i8 0, i8* %10
%11 = icmp eq i32 %0, 2
br i1 %11, label %24, label %12
12: ; preds = %6, %12
%13 = phi i8** [ %16, %12 ], [ %7, %6 ]
%14 = phi i32 [ %15, %12 ], [ %0, %6 ]
%15 = add nsw i32 %14, -1
%16 = getelementptr inbounds i8*, i8** %13, i64 1
%17 = load i8*, i8** %16
%18 = call i64 @strlen(i8* %4)
%19 = sub nsw i64 49, %18
%20 = call i32 @strncat(i8* %4, i8* %17, i64 %19)
%21 = icmp ugt i32 %14, 3
br i1 %21, label %12, label %24
22: ; preds = %2
%23 = tail call i8* @getpass(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %24
24: ; preds = %12, %6, %22
%25 = phi i8* [ %23, %22 ], [ %4, %6 ], [ %4, %12 ]
%26 = call i32 @command(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %25)
ret void
}