#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 invert(int, int, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  printf("invert(205, 5, 4) returns %d\n", invert(205, 5, 4));
  printf("11001101 flips 110[0110]1 to produce...\n11010011\n");
  printf("invert(1876, 7, 3) returns %d\n", invert(1876, 7, 3));
  printf("11101010100 flips 1110[101]0100 to produce...\n11100100100\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xcd,%edi
mov    $0x5,%esi
mov    $0x4,%edx
call   1030 <invert@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x754,%edi
mov    $0x7,%esi
mov    $0x3,%edx
call   1030 <invert@plt>
mov    %eax,%esi
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xcd,%edi
mov    $0x5,%esi
mov    $0x4,%edx
call   1030 <invert@plt>
lea    0xeb4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xee1(%rip),%rdi
call   1040 <puts@plt>
mov    $0x754,%edi
mov    $0x7,%esi
mov    $0x3,%edx
call   1030 <invert@plt>
lea    0xea2(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xee2(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [30 x i8] c"invert(205, 5, 4) returns %d\0A\00"
@.str.1 = [50 x i8] c"11001101 flips 110[0110]1 to produce...\0A11010011\0A\00"
@.str.2 = [31 x i8] c"invert(1876, 7, 3) returns %d\0A\00"
@.str.3 = [59 x i8] c"11101010100 flips 1110[101]0100 to produce...\0A11100100100\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @invert(i32 205, i32 5, i32 4)
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @invert(i32 1876, i32 7, i32 3)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"invert(205, 5, 4) returns %d\0A\00"
@.str.2 = [31 x i8] c"invert(1876, 7, 3) returns %d\0A\00"
@str = [49 x i8] c"11001101 flips 110[0110]1 to produce...\0A11010011\00"
@str.4 = [58 x i8] c"11101010100 flips 1110[101]0100 to produce...\0A11100100100\00"
define i32 @main() {
%1 = tail call i32 @invert(i32 205, i32 5, i32 4)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @invert(i32 1876, i32 7, i32 3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.4, i64 0, i64 0))
ret i32 0
}