// File: iZhangHui[P]CppPrimer/CH17_SpecializedLibraryFacilities/examples/setw.cc
// Function: main
int main()
{
	int i = -16;
	double d = 3.14159;
	
	// pad the first column to use a minimum of 12 positions in the output
	cout << "i: " << setw(12) << i << "next col" << '\n'
	     << "d: " << setw(12) << d << "next col" << '\n';
	
	// pad the first column and left-justify all columns
	cout << left 
	     << "i: " << setw(12) << i << "next col" << '\n'
	     << "d: " << setw(12) << d << "next col" << '\n'
	     << right;           // restore normal justification
	
	// pad the first column and right-justify all columns
	cout << right
	     << "i: " << setw(12) << i << "next col" << '\n'
	     << "d: " << setw(12) << d << "next col" << '\n';
	
	// pad the first column but put the padding internal to the field
	cout << internal
	     << "i: " << setw(12) << i << "next col" << '\n'
	     << "d: " << setw(12) << d << "next col" << '\n';
	
	// pad the first column, using # as the pad character
	cout << setfill('#')
	     << "i: " << setw(12) << i << "next col" << '\n'
	     << "d: " << setw(12) << d << "next col" << '\n'
	     << setfill(' ');   // restore the normal pad character

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movl $0x0, -0x4(%rbp)
movl $0xfffffff0, -0x8(%rbp) # imm = 0xFFFFFFF0
movsd 0xde7(%rip), %xmm0      # 0x2008
movsd %xmm0, -0x10(%rbp)
movq 0x2dab(%rip), %rdi      # 0x3fd8
leaq 0xddc(%rip), %rsi       # 0x2010
callq 0x1050
movq %rax, -0x98(%rbp)
movl $0xc, %edi
callq 0x1620
movq -0x98(%rbp), %rdi
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %esi
callq 0x1060
movq %rax, %rdi
movl -0x8(%rbp), %esi
callq 0x10a0
movq %rax, %rdi
leaq 0xda3(%rip), %rsi       # 0x2014
callq 0x1050
movq %rax, %rdi
movl $0xa, %esi
callq 0x1070
movq %rax, %rdi
leaq 0xd90(%rip), %rsi       # 0x201d
callq 0x1050
movq %rax, -0x90(%rbp)
movl $0xc, %edi
callq 0x1620
movq -0x90(%rbp), %rdi
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %esi
callq 0x1060
movq %rax, %rdi
movsd -0x10(%rbp), %xmm0
callq 0x10b0
movq %rax, %rdi
leaq 0xd48(%rip), %rsi       # 0x2014
callq 0x1050
movq %rax, %rdi
movl $0xa, %esi
callq 0x1070
movq 0x2cf3(%rip), %rdi      # 0x3fd8
leaq 0x354(%rip), %rsi       # 0x1640
callq 0x1030
movq %rax, %rdi
leaq 0xd15(%rip), %rsi       # 0x2010
callq 0x1050
movq %rax, -0x88(%rbp)
movl $0xc, %edi
callq 0x1620
movq -0x88(%rbp), %rdi
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %esi
callq 0x1060
movq %rax, %rdi
movl -0x8(%rbp), %esi
callq 0x10a0
movq %rax, %rdi
leaq 0xcdc(%rip), %rsi       # 0x2014
callq 0x1050
movq %rax, %rdi
movl $0xa, %esi
callq 0x1070
movq %rax, %rdi
leaq 0xcc9(%rip), %rsi       # 0x201d
callq 0x1050
movq %rax, -0x80(%rbp)
movl $0xc, %edi
callq 0x1620
movq -0x80(%rbp), %rdi
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %esi
callq 0x1060
movq %rax, %rdi
movsd -0x10(%rbp), %xmm0
callq 0x10b0
movq %rax, %rdi
leaq 0xc87(%rip), %rsi       # 0x2014
callq 0x1050
movq %rax, %rdi
movl $0xa, %esi
callq 0x1070
movq %rax, %rdi
leaq 0x2c7(%rip), %rsi       # 0x1670
callq 0x1030
movq 0x2c23(%rip), %rdi      # 0x3fd8
leaq 0x2b4(%rip), %rsi       # 0x1670
callq 0x1030
movq %rax, %rdi
leaq 0xc45(%rip), %rsi       # 0x2010
callq 0x1050
movq %rax, -0x78(%rbp)
movl $0xc, %edi
callq 0x1620
movq -0x78(%rbp), %rdi
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %esi
callq 0x1060
movq %rax, %rdi
movl -0x8(%rbp), %esi
callq 0x10a0
movq %rax, %rdi
leaq 0xc12(%rip), %rsi       # 0x2014
callq 0x1050
movq %rax, %rdi
movl $0xa, %esi
callq 0x1070
movq %rax, %rdi
leaq 0xbff(%rip), %rsi       # 0x201d
callq 0x1050
movq %rax, -0x70(%rbp)
movl $0xc, %edi
callq 0x1620
movq -0x70(%rbp), %rdi
movl %eax, -0x28(%rbp)
movl -0x28(%rbp), %esi
callq 0x1060
movq %rax, %rdi
movsd -0x10(%rbp), %xmm0
callq 0x10b0
movq %rax, %rdi
leaq 0xbbd(%rip), %rsi       # 0x2014
callq 0x1050
movq %rax, %rdi
movl $0xa, %esi
callq 0x1070
movq 0x2b68(%rip), %rdi      # 0x3fd8
leaq 0x229(%rip), %rsi       # 0x16a0
callq 0x1030
movq %rax, %rdi
leaq 0xb8a(%rip), %rsi       # 0x2010
callq 0x1050
movq %rax, -0x68(%rbp)
movl $0xc, %edi
callq 0x1620
movq -0x68(%rbp), %rdi
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %esi
callq 0x1060
movq %rax, %rdi
movl -0x8(%rbp), %esi
callq 0x10a0
movq %rax, %rdi
leaq 0xb57(%rip), %rsi       # 0x2014
callq 0x1050
movq %rax, %rdi
movl $0xa, %esi
callq 0x1070
movq %rax, %rdi
leaq 0xb44(%rip), %rsi       # 0x201d
callq 0x1050
movq %rax, -0x60(%rbp)
movl $0xc, %edi
callq 0x1620
movq -0x60(%rbp), %rdi
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %esi
callq 0x1060
movq %rax, %rdi
movsd -0x10(%rbp), %xmm0
callq 0x10b0
movq %rax, %rdi
leaq 0xb02(%rip), %rsi       # 0x2014
callq 0x1050
movq %rax, %rdi
movl $0xa, %esi
callq 0x1070
movl $0x23, %edi
callq 0x16d0
movb %al, -0x31(%rbp)
movq 0x2aa0(%rip), %rdi      # 0x3fd8
movzbl -0x31(%rbp), %esi
callq 0x1090
movq %rax, %rdi
leaq 0xac5(%rip), %rsi       # 0x2010
callq 0x1050
movq %rax, -0x58(%rbp)
movl $0xc, %edi
callq 0x1620
movq -0x58(%rbp), %rdi
movl %eax, -0x38(%rbp)
movl -0x38(%rbp), %esi
callq 0x1060
movq %rax, %rdi
movl -0x8(%rbp), %esi
callq 0x10a0
movq %rax, %rdi
leaq 0xa92(%rip), %rsi       # 0x2014
callq 0x1050
movq %rax, %rdi
movl $0xa, %esi
callq 0x1070
movq %rax, %rdi
leaq 0xa7f(%rip), %rsi       # 0x201d
callq 0x1050
movq %rax, -0x50(%rbp)
movl $0xc, %edi
callq 0x1620
movq -0x50(%rbp), %rdi
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %esi
callq 0x1060
movq %rax, %rdi
movsd -0x10(%rbp), %xmm0
callq 0x10b0
movq %rax, %rdi
leaq 0xa3d(%rip), %rsi       # 0x2014
callq 0x1050
movq %rax, %rdi
movl $0xa, %esi
callq 0x1070
movq %rax, -0x48(%rbp)
movl $0x20, %edi
callq 0x16d0
movq -0x48(%rbp), %rdi
movb %al, -0x3d(%rbp)
movzbl -0x3d(%rbp), %esi
callq 0x1090
xorl %eax, %eax
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)