// File: /workspace/github_c_makefile_star2_O0/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_2/exercise_2_07/invert.c
// Function: main
int main(void)
{
  unsigned int x = 0b11010111;

  printf(BYTE_TO_BINARY_PATTERN, BYTE_TO_BINARY(x));
  printf(BYTE_TO_BINARY_PATTERN, BYTE_TO_BINARY(invert(x, 1, 4)));

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x48, %rsp
movl $0x0, -0xc(%rbp)
movl $0xd7, -0x10(%rbp)
movl -0x10(%rbp), %ecx
andl $0x80, %ecx
movl $0x30, %esi
movl $0x31, %eax
cmpl $0x0, %ecx
cmovnel %eax, %esi
movl -0x10(%rbp), %ecx
andl $0x40, %ecx
movl $0x30, %edx
movl $0x31, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edx
movl -0x10(%rbp), %edi
andl $0x20, %edi
movl $0x30, %ecx
movl $0x31, %eax
cmpl $0x0, %edi
cmovnel %eax, %ecx
movl -0x10(%rbp), %edi
andl $0x10, %edi
movl $0x30, %r8d
movl $0x31, %eax
cmpl $0x0, %edi
cmovnel %eax, %r8d
movl -0x10(%rbp), %edi
andl $0x8, %edi
movl $0x30, %r9d
movl $0x31, %eax
cmpl $0x0, %edi
cmovnel %eax, %r9d
movl -0x10(%rbp), %edi
andl $0x4, %edi
movl $0x30, %r11d
movl $0x31, %eax
cmpl $0x0, %edi
cmovnel %eax, %r11d
movl -0x10(%rbp), %edi
andl $0x2, %edi
movl $0x30, %r10d
movl $0x31, %eax
cmpl $0x0, %edi
cmovnel %eax, %r10d
movl -0x10(%rbp), %ebx
andl $0x1, %ebx
movl $0x30, %eax
movl $0x31, %edi
cmpl $0x0, %ebx
cmovnel %edi, %eax
leaq 0xdeb(%rip), %rdi       # 0x2004
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x1030
movl -0x10(%rbp), %edi
movl $0x1, %esi
movl $0x4, %edx
callq 0x13c0
movl %eax, %edx
andl $0x80, %edx
movl $0x30, %eax
movl $0x31, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x2c(%rbp)
movl -0x10(%rbp), %edi
movl $0x1, %esi
movl $0x4, %edx
callq 0x13c0
movl %eax, %edx
andl $0x40, %edx
movl $0x30, %eax
movl $0x31, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x28(%rbp)
movl -0x10(%rbp), %edi
movl $0x1, %esi
movl $0x4, %edx
callq 0x13c0
movl %eax, %edx
andl $0x20, %edx
movl $0x30, %eax
movl $0x31, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x24(%rbp)
movl -0x10(%rbp), %edi
movl $0x1, %esi
movl $0x4, %edx
callq 0x13c0
movl %eax, %edx
andl $0x10, %edx
movl $0x30, %eax
movl $0x31, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x20(%rbp)
movl -0x10(%rbp), %edi
movl $0x1, %esi
movl $0x4, %edx
callq 0x13c0
movl %eax, %edx
andl $0x8, %edx
movl $0x30, %eax
movl $0x31, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x10(%rbp), %edi
movl $0x1, %esi
movl $0x4, %edx
callq 0x13c0
movl %eax, %edx
andl $0x4, %edx
movl $0x30, %eax
movl $0x31, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x18(%rbp)
movl -0x10(%rbp), %edi
movl $0x1, %esi
movl $0x4, %edx
callq 0x13c0
movl %eax, %edx
andl $0x2, %edx
movl $0x30, %eax
movl $0x31, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x14(%rbp)
movl -0x10(%rbp), %edi
movl $0x1, %esi
movl $0x4, %edx
callq 0x13c0
movl -0x2c(%rbp), %esi
movl -0x28(%rbp), %edx
movl -0x24(%rbp), %ecx
movl -0x20(%rbp), %r8d
movl -0x1c(%rbp), %r9d
movl -0x18(%rbp), %r11d
movl -0x14(%rbp), %r10d
movl %eax, %ebx
andl $0x1, %ebx
movl $0x30, %eax
movl $0x31, %edi
cmpl $0x0, %ebx
cmovnel %edi, %eax
leaq 0xc67(%rip), %rdi       # 0x2004
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
movl %eax, 0x10(%rsp)
movb $0x0, %al
callq 0x1030
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %rbp
retq
nopw (%rax,%rax)