#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 fdigit(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int i, m, p = 1;
  for (i = 0, m = 1; i < 7; i++, m *= 10)
    p *= fdigit(m);
  printf("%d\n", p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
cmpl   $0x7,-0x14(%rbp)
jge    1179 <main+0x59>
mov    -0x18(%rbp),%edi
call   1040 <fdigit@plt>
imul   -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
imul   $0xa,-0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    114b <main+0x2b>
mov    -0x1c(%rbp),%esi
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

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