#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 chartoint(char);
int /*<<< orphan*/ clearscn();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ setcolor(int, int);
int /*<<< orphan*/ setecho(int);
int /*<<< orphan*/ settype(int);
int /*<<< orphan*/ setxy(int, int);
int main() {
  int numero;
  clearscn();
  setxy(5, 5);
  setcolor(7, 0);
  printf("Ola mundo!");
  setxy(1, 1);
  setcolor(0, 7);
  settype(1);
  printf("Ola mundo!!");
  setcolor(3, 5);
  setxy(15, 3);
  settype(5);
  printf("OLA MUNDO!");
  settype(0);
  setxy(3, 3);
  printf("ola mundo..");
  setxy(1, 12);
  printf("digite um numero (sem echo): ");
  setecho(0);
  scanf("%d", &numero);
  setxy(6, 13);
  printf("voce digitou %d ! :D", numero);
  setxy(1, 14);
  setcolor(5, 9);
  printf("digite um numero (com echo): ");
  setcolor(5, 0);
  setecho(1);
  scanf("%d", &numero);
  setxy(6, 15);
  settype(0);
  printf("voce digitou: %d ! ", numero);
  setcolor(4, 9);
  printf(":");
  setcolor(1, 9);
  printf("D");
  setxy(1, 17);
  numero = chartoint('8');
  printf(" -> %d", numero);
  setxy(1, 19);
  settype(0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <clearscn@plt>
mov    $0x5,%esi
mov    %esi,%edi
call   1050 <setxy@plt>
mov    $0x7,%edi
xor    %esi,%esi
call   10a0 <setcolor@plt>
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1050 <setxy@plt>
xor    %edi,%edi
mov    $0x7,%esi
call   10a0 <setcolor@plt>
mov    $0x1,%edi
call   1030 <settype@plt>
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x3,%edi
mov    $0x5,%esi
call   10a0 <setcolor@plt>
mov    $0xf,%edi
mov    $0x3,%esi
call   1050 <setxy@plt>
mov    $0x5,%edi
call   1030 <settype@plt>
lea    0xdfc(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   1030 <settype@plt>
mov    $0x3,%esi
mov    %esi,%edi
call   1050 <setxy@plt>
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
mov    $0xc,%esi
call   1050 <setxy@plt>
lea    0xdd5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   1040 <setecho@plt>
lea    0xe2b(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <scanf@plt>
mov    $0x6,%edi
mov    $0xd,%esi
call   1050 <setxy@plt>
mov    -0x8(%rbp),%esi
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
mov    $0xe,%esi
call   1050 <setxy@plt>
mov    $0x5,%edi
mov    $0x9,%esi
call   10a0 <setcolor@plt>
lea    0xda5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x5,%edi
xor    %esi,%esi
call   10a0 <setcolor@plt>
mov    $0x1,%edi
call   1040 <setecho@plt>
lea    0xdb9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <scanf@plt>
mov    $0x6,%edi
mov    $0xf,%esi
call   1050 <setxy@plt>
xor    %edi,%edi
call   1030 <settype@plt>
mov    -0x8(%rbp),%esi
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x4,%edi
mov    $0x9,%esi
call   10a0 <setcolor@plt>
lea    0xd6d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
mov    $0x9,%esi
call   10a0 <setcolor@plt>
lea    0xd1c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
mov    $0x11,%esi
call   1050 <setxy@plt>
mov    $0x38,%edi
call   1090 <chartoint@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xd25(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
mov    $0x13,%esi
call   1050 <setxy@plt>
xor    %edi,%edi
call   1030 <settype@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1080 <clearscn@plt>
mov    $0x5,%edi
mov    $0x5,%esi
call   1060 <setxy@plt>
mov    $0x7,%edi
xor    %esi,%esi
call   10b0 <setcolor@plt>
lea    0xe43(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1060 <setxy@plt>
xor    %edi,%edi
mov    $0x7,%esi
call   10b0 <setcolor@plt>
mov    $0x1,%edi
call   1040 <settype@plt>
lea    0xe1b(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x3,%edi
mov    $0x5,%esi
call   10b0 <setcolor@plt>
mov    $0xf,%edi
mov    $0x3,%esi
call   1060 <setxy@plt>
mov    $0x5,%edi
call   1040 <settype@plt>
lea    0xdf1(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %edi,%edi
call   1040 <settype@plt>
mov    $0x3,%edi
mov    $0x3,%esi
call   1060 <setxy@plt>
lea    0xdd8(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
mov    $0xc,%esi
call   1060 <setxy@plt>
lea    0xdc7(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %edi,%edi
call   1050 <setecho@plt>
lea    0xe1b(%rip),%rbx
lea    0x4(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <scanf@plt>
mov    $0x6,%edi
mov    $0xd,%esi
call   1060 <setxy@plt>
mov    0x4(%rsp),%esi
lea    0xda6(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
mov    $0xe,%esi
call   1060 <setxy@plt>
mov    $0x5,%edi
mov    $0x9,%esi
call   10b0 <setcolor@plt>
lea    0xd8f(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x5,%edi
xor    %esi,%esi
call   10b0 <setcolor@plt>
mov    $0x1,%edi
call   1050 <setecho@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <scanf@plt>
mov    $0x6,%edi
mov    $0xf,%esi
call   1060 <setxy@plt>
xor    %edi,%edi
call   1040 <settype@plt>
mov    0x4(%rsp),%esi
lea    0xd64(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x4,%edi
mov    $0x9,%esi
call   10b0 <setcolor@plt>
mov    $0x3a,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
mov    $0x9,%esi
call   10b0 <setcolor@plt>
mov    $0x44,%edi
call   1030 <putchar@plt>
mov    $0x1,%edi
mov    $0x11,%esi
call   1060 <setxy@plt>
mov    $0x38,%edi
call   10a0 <chartoint@plt>
mov    %eax,0x4(%rsp)
lea    0xd1b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
mov    $0x13,%esi
call   1060 <setxy@plt>
xor    %edi,%edi
call   1040 <settype@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Ola mundo!\00"
@.str.1 = [12 x i8] c"Ola mundo!!\00"
@.str.2 = [11 x i8] c"OLA MUNDO!\00"
@.str.3 = [12 x i8] c"ola mundo..\00"
@.str.4 = [30 x i8] c"digite um numero (sem echo): \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [21 x i8] c"voce digitou %d ! :D\00"
@.str.7 = [30 x i8] c"digite um numero (com echo): \00"
@.str.8 = [20 x i8] c"voce digitou: %d ! \00"
@.str.9 = [2 x i8] c":\00"
@.str.10 = [2 x i8] c"D\00"
@.str.11 = [7 x i8] c" -> %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @clearscn()
%4 = call i32 @setxy(i32 5, i32 5)
%5 = call i32 @setcolor(i32 7, i32 0)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @setxy(i32 1, i32 1)
%8 = call i32 @setcolor(i32 0, i32 7)
%9 = call i32 @settype(i32 1)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @setcolor(i32 3, i32 5)
%12 = call i32 @setxy(i32 15, i32 3)
%13 = call i32 @settype(i32 5)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @settype(i32 0)
%16 = call i32 @setxy(i32 3, i32 3)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @setxy(i32 1, i32 12)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 @setecho(i32 0)
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%22 = call i32 @setxy(i32 6, i32 13)
%23 = load i32, i32* %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 %23)
%25 = call i32 @setxy(i32 1, i32 14)
%26 = call i32 @setcolor(i32 5, i32 9)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%28 = call i32 @setcolor(i32 5, i32 0)
%29 = call i32 @setecho(i32 1)
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%31 = call i32 @setxy(i32 6, i32 15)
%32 = call i32 @settype(i32 0)
%33 = load i32, i32* %2
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i32 %33)
%35 = call i32 @setcolor(i32 4, i32 9)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%37 = call i32 @setcolor(i32 1, i32 9)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%39 = call i32 @setxy(i32 1, i32 17)
%40 = call i32 @chartoint(i8 signext 56)
store i32 %40, i32* %2
%41 = load i32, i32* %2
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 %41)
%43 = call i32 @setxy(i32 1, i32 19)
%44 = call i32 @settype(i32 0)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"Ola mundo!\00"
@.str.1 = [12 x i8] c"Ola mundo!!\00"
@.str.2 = [11 x i8] c"OLA MUNDO!\00"
@.str.3 = [12 x i8] c"ola mundo..\00"
@.str.4 = [30 x i8] c"digite um numero (sem echo): \00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [21 x i8] c"voce digitou %d ! :D\00"
@.str.7 = [30 x i8] c"digite um numero (com echo): \00"
@.str.8 = [20 x i8] c"voce digitou: %d ! \00"
@.str.11 = [7 x i8] c" -> %d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (...) @clearscn()
%4 = tail call i32 @setxy(i32 5, i32 5)
%5 = tail call i32 @setcolor(i32 7, i32 0)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @setxy(i32 1, i32 1)
%8 = tail call i32 @setcolor(i32 0, i32 7)
%9 = tail call i32 @settype(i32 1)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%11 = tail call i32 @setcolor(i32 3, i32 5)
%12 = tail call i32 @setxy(i32 15, i32 3)
%13 = tail call i32 @settype(i32 5)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 @settype(i32 0)
%16 = tail call i32 @setxy(i32 3, i32 3)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%18 = tail call i32 @setxy(i32 1, i32 12)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
%20 = tail call i32 @setecho(i32 0)
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%22 = call i32 @setxy(i32 6, i32 13)
%23 = load i32, i32* %1
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 %23)
%25 = call i32 @setxy(i32 1, i32 14)
%26 = call i32 @setcolor(i32 5, i32 9)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%28 = call i32 @setcolor(i32 5, i32 0)
%29 = call i32 @setecho(i32 1)
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%31 = call i32 @setxy(i32 6, i32 15)
%32 = call i32 @settype(i32 0)
%33 = load i32, i32* %1
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i32 %33)
%35 = call i32 @setcolor(i32 4, i32 9)
%36 = call i32 @putchar(i32 58)
%37 = call i32 @setcolor(i32 1, i32 9)
%38 = call i32 @putchar(i32 68)
%39 = call i32 @setxy(i32 1, i32 17)
%40 = call i32 @chartoint(i8 signext 56)
store i32 %40, i32* %1
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i32 %40)
%42 = call i32 @setxy(i32 1, i32 19)
%43 = call i32 @settype(i32 0)
ret i32 0
}