#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*/ get_impid();
int /*<<< orphan*/ itoa(int, char *, int);
int /*<<< orphan*/ newline();
int /*<<< orphan*/ readnumstr(char *, int);
int /*<<< orphan*/ setDivisor(int);
int /*<<< orphan*/ writeHex(int /*<<< orphan*/);
int /*<<< orphan*/ writestr(char *);
int main() {
  char buff[80];
  int x, y;
  setDivisor(16);
  newline();
  writestr("Processor ID: ");
  writeHex(get_impid());
  newline();
  while (1) {
    writestr("Enter x (max 10 digits):");
    readnumstr(buff, 11);
    x = atoi(buff);
    newline();
    writestr("Enter y (max 10 digits):");
    readnumstr(buff, 11);
    y = atoi(buff);
    newline();
    itoa(x * y, buff, 10);
    writestr(buff);
    newline();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x10,%edi
call   1040 <setDivisor@plt>
mov    $0x0,%al
call   1030 <newline@plt>
lea    0xe59(%rip),%rdi
call   1070 <writestr@plt>
mov    $0x0,%al
call   1090 <get_impid@plt>
mov    %eax,%edi
call   1060 <writeHex@plt>
mov    $0x0,%al
call   1030 <newline@plt>
lea    0xe47(%rip),%rdi
call   1070 <writestr@plt>
lea    -0x60(%rbp),%rdi
mov    $0xb,%esi
call   1050 <readnumstr@plt>
lea    -0x60(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x64(%rbp)
mov    $0x0,%al
call   1030 <newline@plt>
lea    0xe33(%rip),%rdi
call   1070 <writestr@plt>
lea    -0x60(%rbp),%rdi
mov    $0xb,%esi
call   1050 <readnumstr@plt>
lea    -0x60(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x68(%rbp)
mov    $0x0,%al
call   1030 <newline@plt>
mov    -0x64(%rbp),%edi
imul   -0x68(%rbp),%edi
mov    %edi,-0x6c(%rbp)
lea    -0x60(%rbp),%rsi
mov    $0xa,%edx
call   10a0 <itoa@plt>
lea    -0x60(%rbp),%rdi
call   1070 <writestr@plt>
mov    $0x0,%al
call   1030 <newline@plt>
jmp    11c1 <main+0x41>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x50,%rsp
mov    $0x10,%edi
call   1040 <setDivisor@plt>
xor    %eax,%eax
call   1030 <newline@plt>
lea    0xe5c(%rip),%rdi
call   1070 <writestr@plt>
xor    %eax,%eax
call   1090 <get_impid@plt>
mov    %eax,%edi
call   1060 <writeHex@plt>
xor    %eax,%eax
call   1030 <newline@plt>
lea    0xe4a(%rip),%r14
mov    %rsp,%r12
lea    0xe59(%rip),%r15
nop
mov    %r14,%rdi
call   1070 <writestr@plt>
mov    %r12,%rdi
mov    $0xb,%esi
call   1050 <readnumstr@plt>
mov    %r12,%rdi
call   1080 <atoi@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <newline@plt>
mov    %r15,%rdi
call   1070 <writestr@plt>
mov    %r12,%rdi
mov    $0xb,%esi
call   1050 <readnumstr@plt>
mov    %r12,%rdi
call   1080 <atoi@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <newline@plt>
imul   %ebp,%ebx
mov    %ebx,%edi
mov    %r12,%rsi
mov    $0xa,%edx
call   10a0 <itoa@plt>
mov    %r12,%rdi
call   1070 <writestr@plt>
xor    %eax,%eax
call   1030 <newline@plt>
jmp    11d0 <main+0x50>

LLVM IR (-O0):
@.str = [15 x i8] c"Processor ID: \00"
@.str.1 = [25 x i8] c"Enter x (max 10 digits):\00"
@.str.2 = [25 x i8] c"Enter y (max 10 digits):\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @setDivisor(i32 16)
%6 = call i32 (...) @newline()
%7 = call i32 @writestr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @get_impid()
%9 = call i32 @writeHex(i32 %8)
%10 = call i32 (...) @newline()
br label %11
11: ; preds = %0, %11
%12 = call i32 @writestr(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%14 = call i32 @readnumstr(i8* %13, i32 11)
%15 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %3
%17 = call i32 (...) @newline()
%18 = call i32 @writestr(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%20 = call i32 @readnumstr(i8* %19, i32 11)
%21 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %4
%23 = call i32 (...) @newline()
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = mul nsw i32 %24, %25
%27 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%28 = call i32 @itoa(i32 %26, i8* %27, i32 10)
%29 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%30 = call i32 @writestr(i8* %29)
%31 = call i32 (...) @newline()
br label %11
}

LLVM IR (-O2):
@.str = [15 x i8] c"Processor ID: \00"
@.str.1 = [25 x i8] c"Enter x (max 10 digits):\00"
@.str.2 = [25 x i8] c"Enter y (max 10 digits):\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @setDivisor(i32 16)
%4 = tail call i32 (...) @newline()
%5 = tail call i32 @writestr(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (...) @get_impid()
%7 = tail call i32 @writeHex(i32 %6)
%8 = tail call i32 (...) @newline()
br label %9
9: ; preds = %9, %0
%10 = call i32 @writestr(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @readnumstr(i8* %2, i32 11)
%12 = call i32 @atoi(i8* %2)
%13 = call i32 (...) @newline()
%14 = call i32 @writestr(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @readnumstr(i8* %2, i32 11)
%16 = call i32 @atoi(i8* %2)
%17 = call i32 (...) @newline()
%18 = mul nsw i32 %16, %12
%19 = call i32 @itoa(i32 %18, i8* %2, i32 10)
%20 = call i32 @writestr(i8* %2)
%21 = call i32 (...) @newline()
br label %9
}