#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 /*<<< orphan*/ getchar();
int /*<<< orphan*/ mostra_bin(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void teste_mostra_bin() {
  int i;
  printf(":: TESTE DA CONVERSAO PARA BINARIO ::\n");
  printf("Digite o numero inteiro (positivo ou negativo) que quiser ver em "
         "binario e pressione <Enter>: ");
  scanf("%i", &i);
  printf("%id = ", i);
  mostra_bin(i);
  printf("b\n");
  getchar();
}


x86 assembly (clang, -O0):
<teste_mostra_bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf1b(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x4(%rbp),%esi
lea    0xf0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <mostra_bin@plt>
lea    0xefc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<teste_mostra_bin>:
push   %rax
lea    0xf11(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeed(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xedb(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%edi
call   1040 <mostra_bin@plt>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [39 x i8] c":: TESTE DA CONVERSAO PARA BINARIO ::\0A\00"
@.str.1 = [95 x i8] c"Digite o numero inteiro (positivo ou negativo) que quiser ver em binario e pressione <Enter>: \00"
@.str.2 = [3 x i8] c"%i\00"
@.str.3 = [7 x i8] c"%id = \00"
@.str.4 = [3 x i8] c"b\0A\00"
define void @teste_mostra_bin() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %1
%8 = call i32 @mostra_bin(i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 (...) @getchar()
ret void
}

LLVM IR (-O2):
@.str.1 = [95 x i8] c"Digite o numero inteiro (positivo ou negativo) que quiser ver em binario e pressione <Enter>: \00"
@.str.2 = [3 x i8] c"%i\00"
@.str.3 = [7 x i8] c"%id = \00"
@str = [38 x i8] c":: TESTE DA CONVERSAO PARA BINARIO ::\00"
@str.5 = [2 x i8] c"b\00"
define void @teste_mostra_bin() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([95 x i8], [95 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %1
%9 = call i32 @mostra_bin(i32 %8)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.5, i64 0, i64 0))
%11 = call i32 (...) @getchar()
ret void
}