#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 atoi(char *);
int /*<<< orphan*/ decBase(int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char *argv[]) {
  int num;
  int base;
  base = atoi(argv[1]);
  if (argc != 2 && base > 16)
    printf("Error al introducir la base\n");
  else {
    printf("Introduzca un valor decimal:");
    scanf("%d", &num);
    decBase(num, base);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     118b <main+0x4b>
cmpl   $0x10,-0x18(%rbp)
jle    118b <main+0x4b>
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
jmp    11be <main+0x7e>
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
lea    0xe9c(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <decBase@plt>
lea    0xe62(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
call   1080 <atoi@plt>
mov    %eax,%ebx
cmp    $0x2,%ebp
je     1188 <main+0x28>
cmp    $0x11,%ebx
jl     1188 <main+0x28>
lea    0xe9f(%rip),%rdi
call   1050 <puts@plt>
jmp    11ba <main+0x5a>
lea    0xe71(%rip),%rdi
call   1060 <printf@plt>
lea    0xe82(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%edi
mov    %ebx,%esi
call   1030 <decBase@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Error al introducir la base\0A\00"
@.str.1 = [29 x i8] c"Introduzca un valor decimal:\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @atoi(i8* %10)
store i32 %11, i32* %7
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 2
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = load i32, i32* %7
%16 = icmp sgt i32 %15, 16
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %26
19: ; preds = %14, %2
%20 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = call i32 @decBase(i32 %22, i32 %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %26
26: ; preds = %19, %17
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [29 x i8] c"Introduzca un valor decimal:\00"
@.str.2 = [3 x i8] c"%d\00"
@str = [28 x i8] c"Error al introducir la base\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = icmp ne i32 %0, 2
%9 = icmp sgt i32 %7, 16
%10 = select i1 %8, i1 %9, i1 false
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %19
13: ; preds = %2
%14 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%16 = load i32, i32* %3
%17 = call i32 @decBase(i32 %16, i32 %7)
%18 = call i32 @putchar(i32 10)
br label %19
19: ; preds = %13, %11
ret i32 0
}