#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 /*<<< orphan*/ printf(char *, unsigned int, int, unsigned int);
int print_multiplication_table(unsigned int num, unsigned int table[],
                               size_t size) {
  int i = 0;
  for (i = 0; i < size; i++) {
    printf("%d\tX\t%d\t=\t%d\n", num, i + 1, table[i]);
  }
  return i;
}


x86 assembly (clang, -O0):
<print_multiplication_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    116d <print_multiplication_table+0x5d>
mov    -0x4(%rbp),%esi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1131 <print_multiplication_table+0x21>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_multiplication_table>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %rdx,%rdx
je     114b <print_multiplication_table+0x3b>
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,%ebp
xor    %ebx,%ebx
lea    0xed2(%rip),%r12
xchg   %ax,%ax
mov    (%r15,%rbx,4),%ecx
add    $0x1,%rbx
mov    %r12,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
cmp    %rbx,%r14
jne    1130 <print_multiplication_table+0x20>
jmp    114e <print_multiplication_table+0x3e>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%d\09X\09%d\09=\09%d\0A\00"
define i32 @print_multiplication_table(i32 %0, i32* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i64 %2, i64* %6
store i32 0, i32* %7
store i32 0, i32* %7
br label %8
8: ; preds = %23, %3
%9 = load i32, i32* %7
%10 = sext i32 %9 to i64
%11 = load i64, i64* %6
%12 = icmp ult i64 %10, %11
br i1 %12, label %13, label %26
13: ; preds = %8
%14 = load i32, i32* %4
%15 = load i32, i32* %7
%16 = add nsw i32 %15, 1
%17 = load i32*, i32** %5
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = load i32, i32* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %16, i32 %21)
br label %23
23: ; preds = %13
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %8
26: ; preds = %8
%27 = load i32, i32* %7
ret i32 %27
}

LLVM IR (-O2):
@.str = [14 x i8] c"%d\09X\09%d\09=\09%d\0A\00"
define i32 @print_multiplication_table(i32 %0, i32* nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %15, label %5
5: ; preds = %3, %5
%6 = phi i64 [ %7, %5 ], [ 0, %3 ]
%7 = add nuw nsw i64 %6, 1
%8 = getelementptr inbounds i32, i32* %1, i64 %6
%9 = load i32, i32* %8
%10 = trunc i64 %7 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %10, i32 %9)
%12 = icmp eq i64 %7, %2
br i1 %12, label %13, label %5
13: ; preds = %5
%14 = trunc i64 %2 to i32
br label %15
15: ; preds = %13, %3
%16 = phi i32 [ 0, %3 ], [ %14, %13 ]
ret i32 %16
}