#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 lg(int);
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int i, n;
  for (i = 1, n = 10; i <= 6; ++i, n *= 10) {
    printf("%7d %2d %9d\n", n, lg(n), n * lg(n));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
cmpl   $0x6,-0x8(%rbp)
jg     1193 <main+0x73>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <lg@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <lg@plt>
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
imul   %eax,%ecx
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    $0xa,%edi
call   1040 <lg@plt>
mov    %eax,%ebp
mov    $0xa,%edi
call   1040 <lg@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%ecx
lea    0xebb(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
mov    $0x64,%edi
call   1040 <lg@plt>
mov    %eax,%ebp
mov    $0x64,%edi
call   1040 <lg@plt>
imul   $0x64,%eax,%ecx
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
mov    $0x3e8,%edi
call   1040 <lg@plt>
mov    %eax,%ebp
mov    $0x3e8,%edi
call   1040 <lg@plt>
imul   $0x3e8,%eax,%ecx
mov    %rbx,%rdi
mov    $0x3e8,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
mov    $0x2710,%edi
call   1040 <lg@plt>
mov    %eax,%ebp
mov    $0x2710,%edi
call   1040 <lg@plt>
imul   $0x2710,%eax,%ecx
mov    %rbx,%rdi
mov    $0x2710,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
mov    $0x186a0,%edi
call   1040 <lg@plt>
mov    %eax,%ebp
mov    $0x186a0,%edi
call   1040 <lg@plt>
imul   $0x186a0,%eax,%ecx
mov    %rbx,%rdi
mov    $0x186a0,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
mov    $0xf4240,%edi
call   1040 <lg@plt>
mov    %eax,%ebp
mov    $0xf4240,%edi
call   1040 <lg@plt>
imul   $0xf4240,%eax,%ecx
mov    %rbx,%rdi
mov    $0xf4240,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"%7d %2d %9d\0A\00"
define i32 @main() {
%1 = tail call i32 @lg(i32 10)
%2 = tail call i32 @lg(i32 10)
%3 = mul nsw i32 %2, 10
%4 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 10, i32 %1, i32 %3)
%5 = tail call i32 @lg(i32 100)
%6 = tail call i32 @lg(i32 100)
%7 = mul nsw i32 %6, 100
%8 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 100, i32 %5, i32 %7)
%9 = tail call i32 @lg(i32 1000)
%10 = tail call i32 @lg(i32 1000)
%11 = mul nsw i32 %10, 1000
%12 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 1000, i32 %9, i32 %11)
%13 = tail call i32 @lg(i32 10000)
%14 = tail call i32 @lg(i32 10000)
%15 = mul nsw i32 %14, 10000
%16 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 10000, i32 %13, i32 %15)
%17 = tail call i32 @lg(i32 100000)
%18 = tail call i32 @lg(i32 100000)
%19 = mul nsw i32 %18, 100000
%20 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 100000, i32 %17, i32 %19)
%21 = tail call i32 @lg(i32 1000000)
%22 = tail call i32 @lg(i32 1000000)
%23 = mul nsw i32 %22, 1000000
%24 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 1000000, i32 %21, i32 %23)
ret i32 0
}