#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 *calc(int const, int const);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ output(int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int const *);
int main(void) {
  const int source;
  const int base;
  int *p;
  printf("Herzlich Willkommen beim Umrechner\n");
  printf("Bitte Dezimalzahl eingeben: ");
  scanf("%d", &source);
  printf("Bitte Basis eingeben: ");
  scanf("%d", &base);
  p = calc(source, base);
  output(p);
  free(p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1050 <printf@plt>
lea    0xeb2(%rip),%rdi
call   1050 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
lea    0xeb6(%rip),%rdi
call   1050 <printf@plt>
lea    0xea7(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <calc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <output@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xecb(%rip),%rdi
call   1040 <puts@plt>
lea    0xe88(%rip),%rdi
call   1060 <printf@plt>
lea    0xe99(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1080 <scanf@plt>
lea    0xe88(%rip),%rdi
call   1060 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1080 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1070 <calc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <output@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Herzlich Willkommen beim Umrechner\0A\00"
@.str.1 = [29 x i8] c"Bitte Dezimalzahl eingeben: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [23 x i8] c"Bitte Basis eingeben: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = call i32* @calc(i32 %10, i32 %11)
store i32* %12, i32** %4
%13 = load i32*, i32** %4
%14 = call i32 @output(i32* %13)
%15 = load i32*, i32** %4
%16 = call i32 @free(i32* %15)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [29 x i8] c"Bitte Dezimalzahl eingeben: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [23 x i8] c"Bitte Basis eingeben: \00"
@str = [35 x i8] c"Herzlich Willkommen beim Umrechner\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = call i32* @calc(i32 %10, i32 %11)
%13 = call i32 @output(i32* %12)
%14 = call i32 @free(i32* %12)
ret i32 0
}