void f(int a, int b) {
  int x, y;
  for (y = a; y <= b; y++, printf("\n"))
    for (printf("== %d단 ==\n", y), x = 1; x <= 9; x++)
      printf("%d * %d = %2d\n", y, x, y * x);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     119c <f+0x8c>
mov    -0x10(%rbp),%esi
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jg     117b <f+0x6b>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
imul   -0xc(%rbp),%ecx
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <f+0x38>
jmp    1180 <f+0x70>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1124 <f+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %esi,0x8(%rsp)
cmp    %esi,%edi
jg     12bc <f+0x19c>
mov    %edi,%r15d
addl   $0x1,0x8(%rsp)
lea    0x0(,%r15,8),%eax
lea    0x0(,%r15,4),%ecx
mov    %ecx,0x10(%rsp)
lea    (%r15,%r15,1),%ecx
lea    (%r15,%r15,8),%edx
mov    %edx,0x14(%rsp)
mov    %eax,0x18(%rsp)
sub    %edi,%eax
mov    %eax,0xc(%rsp)
mov    %rcx,%rbp
lea    (%rcx,%rcx,2),%r14d
lea    (%r15,%r15,4),%r13d
lea    (%r15,%r15,2),%ebx
nopl   0x0(%rax,%rax,1)
lea    0xe79(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe75(%rip),%r12
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x1,%edx
mov    %r15d,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x2,%edx
mov    %rbp,0x20(%rsp)
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x3,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x4,%edx
mov    0x10(%rsp),%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x5,%edx
mov    %r13d,0x1c(%rsp)
mov    %r13d,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x6,%edx
mov    %r14d,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x7,%edx
mov    0xc(%rsp),%r13d
mov    %r13d,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x8,%edx
mov    0x18(%rsp),%ebp
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    $0x9,%edx
mov    %ebx,%r12d
mov    0x14(%rsp),%ebx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x8,%ebp
mov    %ebp,0x18(%rsp)
addl   $0x4,0x10(%rsp)
mov    0x20(%rsp),%rbp
add    $0x2,%ebp
add    $0x9,%ebx
mov    %ebx,0x14(%rsp)
mov    %r12d,%ebx
add    $0x7,%r13d
mov    %r13d,0xc(%rsp)
add    $0x6,%r14d
mov    0x1c(%rsp),%r13d
add    $0x5,%r13d
add    $0x3,%ebx
cmp    %r15d,0x8(%rsp)
jne    1180 <f+0x60>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"== %d\EB\8B\A8 ==\0A\00"
@.str.1 = [15 x i8] c"%d * %d = %2d\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @f(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
store i32 %7, i32* %6
br label %8
8: ; preds = %29, %2
%9 = load i32, i32* %6
%10 = load i32, i32* %4
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %33
12: ; preds = %8
%13 = load i32, i32* %6
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %13)
store i32 1, i32* %5
br label %15
15: ; preds = %25, %12
%16 = load i32, i32* %5
%17 = icmp sle i32 %16, 9
br i1 %17, label %18, label %28
18: ; preds = %15
%19 = load i32, i32* %6
%20 = load i32, i32* %5
%21 = load i32, i32* %6
%22 = load i32, i32* %5
%23 = mul nsw i32 %21, %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %20, i32 %23)
br label %25
25: ; preds = %18
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %15
28: ; preds = %15
br label %29
29: ; preds = %28
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %8
33: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"== %d\EB\8B\A8 ==\0A\00"
@.str.1 = [15 x i8] c"%d * %d = %2d\0A\00"
define void @f(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
br i1 %3, label %27, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %24, %4 ], [ %0, %2 ]
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 1, i32 %5)
%8 = shl nsw i32 %5, 1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 2, i32 %8)
%10 = mul nsw i32 %5, 3
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 3, i32 %10)
%12 = shl nsw i32 %5, 2
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 4, i32 %12)
%14 = mul nsw i32 %5, 5
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 5, i32 %14)
%16 = mul nsw i32 %5, 6
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 6, i32 %16)
%18 = mul nsw i32 %5, 7
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 7, i32 %18)
%20 = shl nsw i32 %5, 3
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 8, i32 %20)
%22 = mul nsw i32 %5, 9
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 9, i32 %22)
%24 = add i32 %5, 1
%25 = tail call i32 @putchar(i32 10)
%26 = icmp eq i32 %5, %1
br i1 %26, label %27, label %4
27: ; preds = %4, %2
ret void
}