#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 */
scalar_t__ floor(int);
int /*<<< orphan*/ free(int *);
int *getNumbers(int);
int /*<<< orphan*/ showLeft();
int /*<<< orphan*/ showRight();
int /*<<< orphan*/ slip(int /*<<< orphan*/, int);
int /*<<< orphan*/ writeI2cReg(int, int, int);
void writeNumber(int i2cFileDesc, int number) {
  int newNum = number;
  if (newNum > 99)
    newNum = 99;
  int leftNumber = (int)floor(newNum / 10);
  int rightNumber = newNum % 10;
  int *leftDigit = getNumbers(leftNumber);
  int *rightDigit = getNumbers(rightNumber);
  showRight();
  writeI2cReg(i2cFileDesc, 0x14, rightDigit[0]);
  writeI2cReg(i2cFileDesc, 0x15, rightDigit[1]);
  slip(0, 5000000);
  showLeft();
  writeI2cReg(i2cFileDesc, 0x14, leftDigit[0]);
  writeI2cReg(i2cFileDesc, 0x15, leftDigit[1]);
  slip(0, 5000000);
  free(leftDigit);
  free(rightDigit);
}


x86 assembly (clang, -O0):
<writeNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x63,-0xc(%rbp)
jle    1195 <writeNumber+0x25>
movl   $0x63,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1090 <floor@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%edi
call   1080 <getNumbers@plt>
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1080 <getNumbers@plt>
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1070 <showRight@plt>
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
mov    $0x14,%esi
call   1040 <writeI2cReg@plt>
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%rax
mov    0x4(%rax),%edx
mov    $0x15,%esi
call   1040 <writeI2cReg@plt>
xor    %edi,%edi
mov    $0x4c4b40,%esi
call   1060 <slip@plt>
mov    $0x0,%al
call   1050 <showLeft@plt>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
mov    $0x14,%esi
call   1040 <writeI2cReg@plt>
mov    -0x4(%rbp),%edi
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%edx
mov    $0x15,%esi
call   1040 <writeI2cReg@plt>
xor    %edi,%edi
mov    $0x4c4b40,%esi
call   1060 <slip@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeNumber>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
cmp    $0x63,%esi
mov    $0x63,%eax
cmovl  %esi,%eax
movslq %eax,%rbp
imul   $0x66666667,%rbp,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x22,%rbx
add    %eax,%ebx
mov    %ebx,%edi
call   1090 <floor@plt>
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%ecx
sub    %ecx,%ebp
mov    %eax,%edi
call   1080 <getNumbers@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1080 <getNumbers@plt>
mov    %rax,%rbp
xor    %eax,%eax
call   1070 <showRight@plt>
mov    0x0(%rbp),%edx
mov    %r14d,%edi
mov    $0x14,%esi
call   1040 <writeI2cReg@plt>
mov    0x4(%rbp),%edx
mov    %r14d,%edi
mov    $0x15,%esi
call   1040 <writeI2cReg@plt>
xor    %edi,%edi
mov    $0x4c4b40,%esi
call   1060 <slip@plt>
xor    %eax,%eax
call   1050 <showLeft@plt>
mov    (%rbx),%edx
mov    %r14d,%edi
mov    $0x14,%esi
call   1040 <writeI2cReg@plt>
mov    0x4(%rbx),%edx
mov    %r14d,%edi
mov    $0x15,%esi
call   1040 <writeI2cReg@plt>
xor    %edi,%edi
mov    $0x4c4b40,%esi
call   1060 <slip@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @writeNumber(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
store i32 %0, i32* %3
store i32 %1, i32* %4
%10 = load i32, i32* %4
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp sgt i32 %11, 99
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 99, i32* %5
br label %14
14: ; preds = %13, %2
%15 = load i32, i32* %5
%16 = sdiv i32 %15, 10
%17 = call i64 @floor(i32 %16)
%18 = trunc i64 %17 to i32
store i32 %18, i32* %6
%19 = load i32, i32* %5
%20 = srem i32 %19, 10
store i32 %20, i32* %7
%21 = load i32, i32* %6
%22 = call i32* @getNumbers(i32 %21)
store i32* %22, i32** %8
%23 = load i32, i32* %7
%24 = call i32* @getNumbers(i32 %23)
store i32* %24, i32** %9
%25 = call i32 (...) @showRight()
%26 = load i32, i32* %3
%27 = load i32*, i32** %9
%28 = getelementptr inbounds i32, i32* %27, i64 0
%29 = load i32, i32* %28
%30 = call i32 @writeI2cReg(i32 %26, i32 20, i32 %29)
%31 = load i32, i32* %3
%32 = load i32*, i32** %9
%33 = getelementptr inbounds i32, i32* %32, i64 1
%34 = load i32, i32* %33
%35 = call i32 @writeI2cReg(i32 %31, i32 21, i32 %34)
%36 = call i32 @slip(i32 0, i32 5000000)
%37 = call i32 (...) @showLeft()
%38 = load i32, i32* %3
%39 = load i32*, i32** %8
%40 = getelementptr inbounds i32, i32* %39, i64 0
%41 = load i32, i32* %40
%42 = call i32 @writeI2cReg(i32 %38, i32 20, i32 %41)
%43 = load i32, i32* %3
%44 = load i32*, i32** %8
%45 = getelementptr inbounds i32, i32* %44, i64 1
%46 = load i32, i32* %45
%47 = call i32 @writeI2cReg(i32 %43, i32 21, i32 %46)
%48 = call i32 @slip(i32 0, i32 5000000)
%49 = load i32*, i32** %8
%50 = call i32 @free(i32* %49)
%51 = load i32*, i32** %9
%52 = call i32 @free(i32* %51)
ret void
}

LLVM IR (-O2):
define void @writeNumber(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, 99
%4 = select i1 %3, i32 %1, i32 99
%5 = sdiv i32 %4, 10
%6 = tail call i64 @floor(i32 %5)
%7 = trunc i64 %6 to i32
%8 = srem i32 %4, 10
%9 = tail call i32* @getNumbers(i32 %7)
%10 = tail call i32* @getNumbers(i32 %8)
%11 = tail call i32 (...) @showRight()
%12 = load i32, i32* %10
%13 = tail call i32 @writeI2cReg(i32 %0, i32 20, i32 %12)
%14 = getelementptr inbounds i32, i32* %10, i64 1
%15 = load i32, i32* %14
%16 = tail call i32 @writeI2cReg(i32 %0, i32 21, i32 %15)
%17 = tail call i32 @slip(i32 0, i32 5000000)
%18 = tail call i32 (...) @showLeft()
%19 = load i32, i32* %9
%20 = tail call i32 @writeI2cReg(i32 %0, i32 20, i32 %19)
%21 = getelementptr inbounds i32, i32* %9, i64 1
%22 = load i32, i32* %21
%23 = tail call i32 @writeI2cReg(i32 %0, i32 21, i32 %22)
%24 = tail call i32 @slip(i32 0, i32 5000000)
%25 = tail call i32 @free(i32* %9)
%26 = tail call i32 @free(i32* %10)
ret void
}