#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 myatoi(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  printf("\tPrograma que convierte una cadena a entero.\n\n");
  int a;
  char cad[10];
  printf("Introduce un número: ");
  scanf("%s", cad);
  a = myatoi(cad);
  printf("El valor numérico es: %d\n", a);
  printf("%d x 2 = %d\n", a, a * 2);
  printf("Fin del Programa\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x12(%rbp),%rsi
lea    0xee0(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x12(%rbp),%rdi
call   1030 <myatoi@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
shl    $0x1,%edx
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xef6(%rip),%rdi
call   1040 <puts@plt>
lea    0xea8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb1(%rip),%rdi
lea    0x6(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1030 <myatoi@plt>
mov    %eax,%ebx
lea    0xe96(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    (%rbx,%rbx,1),%edx
lea    0xe9e(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec9(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"\09Programa que convierte una cadena a entero.\0A\0A\00"
@.str.1 = [23 x i8] c"Introduce un n\C3\BAmero: \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [27 x i8] c"El valor num\C3\A9rico es: %d\0A\00"
@.str.4 = [13 x i8] c"%d x 2 = %d\0A\00"
@.str.5 = [18 x i8] c"Fin del Programa\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i8]
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%9 = call i32 @myatoi(i8* %8)
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %2
%13 = load i32, i32* %2
%14 = mul nsw i32 %13, 2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %12, i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [23 x i8] c"Introduce un n\C3\BAmero: \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [27 x i8] c"El valor num\C3\A9rico es: %d\0A\00"
@.str.4 = [13 x i8] c"%d x 2 = %d\0A\00"
@str = [46 x i8] c"\09Programa que convierte una cadena a entero.\0A\00"
@str.6 = [17 x i8] c"Fin del Programa\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 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), i8* %3)
%6 = call i32 @myatoi(i8* %3)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %6)
%8 = shl nsw i32 %6, 1
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %6, i32 %8)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.6, i64 0, i64 0))
ret i32 0
}