#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 bi_input(char *);
int /*<<< orphan*/ invert(int, int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ to2(int /*<<< orphan*/, char *);
main() {
  int n, p;
  int x;
  char c[20];
  char s[20];
  char d[20];
  unsigned result;
  printf("input x: ");
  scanf("%s", c);
  x = bi_input(c);
  printf("input p: ");
  scanf("%d", &p);
  printf("input n: ");
  scanf("%d", &n);
  printf("invert result is :");
  to2(invert(x, p, n), s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    0xea1(%rip),%rdi
call   1050 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    -0x20(%rbp),%rdi
call   1040 <bi_input@plt>
mov    %eax,-0xc(%rbp)
lea    0xe84(%rip),%rdi
call   1050 <printf@plt>
lea    0xe82(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xe73(%rip),%rdi
call   1050 <printf@plt>
lea    0xe64(%rip),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
lea    0xe5f(%rip),%rdi
call   1050 <printf@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
call   1030 <invert@plt>
mov    %eax,%edi
lea    -0x40(%rbp),%rsi
call   1060 <to2@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x48,%rsp
lea    0xea3(%rip),%rdi
call   1050 <printf@plt>
lea    0xea1(%rip),%rdi
lea    0x30(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1040 <bi_input@plt>
mov    %eax,%ebp
lea    0xe84(%rip),%rdi
call   1050 <printf@plt>
lea    0xe82(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xe6f(%rip),%rdi
call   1050 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <scanf@plt>
lea    0xe5e(%rip),%rdi
call   1050 <printf@plt>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
mov    %ebp,%edi
call   1030 <invert@plt>
lea    0x10(%rsp),%rsi
mov    %eax,%edi
call   1060 <to2@plt>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"input x: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [10 x i8] c"input p: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [10 x i8] c"input n: \00"
@.str.5 = [19 x i8] c"invert result is :\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [20 x i8]
%5 = alloca [20 x i8]
%6 = alloca [20 x i8]
%7 = alloca i32
%8 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%12 = call i32 @bi_input(i8* %11)
store i32 %12, i32* %3
%13 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%15 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%17 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = load i32, i32* %1
%21 = call i32 @invert(i32 %18, i32 %19, i32 %20)
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%23 = call i32 @to2(i32 %21, i8* %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"input x: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [10 x i8] c"input p: \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [10 x i8] c"input n: \00"
@.str.5 = [19 x i8] c"invert result is :\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x i8]
%4 = alloca [20 x i8]
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%11 = call i32 @bi_input(i8* %7)
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%16 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%17 = load i32, i32* %2
%18 = load i32, i32* %1
%19 = call i32 @invert(i32 %11, i32 %17, i32 %18)
%20 = call i32 @to2(i32 %19, i8* %8)
ret i32 0
}