#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 *, ...);
int main() {
  int i, j, k;
  int m = 0;
  printf("Let's print these numbers.\n==================\n");
  for (i = 1; i < 5; i++)
    for (j = 1; j < 5; j++)
      for (k = 1; k < 5; k++) {
        if (i != j && k != j && i != k) {
          printf("%d%d%d\n", i, j, k);
          m++;
        }
      }
  printf("==================\n");
  printf("It's common sense that 1,2,3,4 can build %d numbers.\n", m);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    11e4 <main+0xd4>
movl   $0x1,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    11d1 <main+0xc1>
movl   $0x1,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jge    11be <main+0xae>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     11ab <main+0x9b>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     11ab <main+0x9b>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     11ab <main+0x9b>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b0 <main+0xa0>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115d <main+0x4d>
jmp    11c3 <main+0xb3>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114c <main+0x3c>
jmp    11d6 <main+0xc6>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113b <main+0x2b>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe3b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf0c(%rip),%rdi
call   1030 <puts@plt>
lea    0xec2(%rip),%r14
xor    %r12d,%r12d
xor    %r15d,%r15d
jmp    115c <main+0x3c>
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%r12d
cmp    $0x4,%ebp
je     130e <main+0x1ee>
lea    0x1(%r12),%ebp
cmp    $0x2,%r12d
jb     1181 <main+0x61>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
mov    %ebp,%r13d
and    $0x7ffffffd,%r13d
cmp    $0x1,%r13d
je     11ab <main+0x8b>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
mov    $0x3,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
cmp    $0x1,%ebp
je     11cf <main+0xaf>
cmp    $0x4,%ebp
je     11cf <main+0xaf>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x1,%edx
mov    $0x4,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
cmp    $0x2,%r12d
jb     11ef <main+0xcf>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x2,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
mov    %ebp,%ebx
and    $0x7ffffffe,%ebx
cmp    $0x2,%ebx
je     1216 <main+0xf6>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
cmp    $0x2,%ebp
je     123a <main+0x11a>
cmp    $0x4,%ebp
je     123a <main+0x11a>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x2,%edx
mov    $0x4,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
cmp    $0x1,%r13d
je     125a <main+0x13a>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x3,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
cmp    $0x2,%ebx
je     1279 <main+0x159>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x3,%edx
mov    $0x2,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
add    $0xfffffffe,%r12d
cmp    $0x2,%r12d
jb     129d <main+0x17d>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x3,%edx
mov    $0x4,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
cmp    $0x1,%ebp
je     12c1 <main+0x1a1>
cmp    $0x4,%ebp
je     12c1 <main+0x1a1>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x4,%edx
mov    $0x1,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
cmp    $0x2,%ebp
je     12e5 <main+0x1c5>
cmp    $0x4,%ebp
je     12e5 <main+0x1c5>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x4,%edx
mov    $0x2,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
cmp    $0x2,%r12d
jb     1150 <main+0x30>
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x4,%edx
mov    $0x3,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%r15d
jmp    1150 <main+0x30>
lea    0xd44(%rip),%rdi
call   1030 <puts@plt>
lea    0xce7(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Let's print these numbers.\0A==================\0A\00"
@.str.1 = [8 x i8] c"%d%d%d\0A\00"
@.str.2 = [20 x i8] c"==================\0A\00"
@.str.3 = [54 x i8] c"It's common sense that 1,2,3,4 can build %d numbers.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %2
br label %7
7: ; preds = %46, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 5
br i1 %9, label %10, label %49
10: ; preds = %7
store i32 1, i32* %3
br label %11
11: ; preds = %42, %10
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 5
br i1 %13, label %14, label %45
14: ; preds = %11
store i32 1, i32* %4
br label %15
15: ; preds = %38, %14
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 5
br i1 %17, label %18, label %41
18: ; preds = %15
%19 = load i32, i32* %2
%20 = load i32, i32* %3
%21 = icmp ne i32 %19, %20
br i1 %21, label %22, label %37
22: ; preds = %18
%23 = load i32, i32* %4
%24 = load i32, i32* %3
%25 = icmp ne i32 %23, %24
br i1 %25, label %26, label %37
26: ; preds = %22
%27 = load i32, i32* %2
%28 = load i32, i32* %4
%29 = icmp ne i32 %27, %28
br i1 %29, label %30, label %37
30: ; preds = %26
%31 = load i32, i32* %2
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %31, i32 %32, i32 %33)
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %37
37: ; preds = %30, %26, %22, %18
br label %38
38: ; preds = %37
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %15
41: ; preds = %15
br label %42
42: ; preds = %41
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 1
store i32 %44, i32* %3
br label %11
45: ; preds = %11
br label %46
46: ; preds = %45
%47 = load i32, i32* %2
%48 = add nsw i32 %47, 1
store i32 %48, i32* %2
br label %7
49: ; preds = %7
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%51 = load i32, i32* %5
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i32 %51)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"%d%d%d\0A\00"
@.str.3 = [54 x i8] c"It's common sense that 1,2,3,4 can build %d numbers.\0A\00"
@str = [46 x i8] c"Let's print these numbers.\0A==================\00"
@str.4 = [19 x i8] c"==================\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
br label %2
2: ; preds = %0, %79
%3 = phi i32 [ 0, %0 ], [ %80, %79 ]
%4 = phi i32 [ 1, %0 ], [ %81, %79 ]
%5 = add nsw i32 %4, -1
%6 = icmp ult i32 %5, 2
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 1, i32 2)
%9 = add nsw i32 %3, 1
br label %10
10: ; preds = %7, %2
%11 = phi i32 [ %9, %7 ], [ %3, %2 ]
%12 = and i32 %4, 2147483645
%13 = icmp eq i32 %12, 1
br i1 %13, label %17, label %14
14: ; preds = %10
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 1, i32 3)
%16 = add nsw i32 %11, 1
br label %17
17: ; preds = %14, %10
%18 = phi i32 [ %16, %14 ], [ %11, %10 ]
switch i32 %4, label %19 [
i32 4, label %22
i32 1, label %22
]
19: ; preds = %17
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 1, i32 4)
%21 = add nsw i32 %18, 1
br label %22
22: ; preds = %17, %17, %19
%23 = phi i32 [ %21, %19 ], [ %18, %17 ], [ %18, %17 ]
%24 = add nsw i32 %4, -1
%25 = icmp ult i32 %24, 2
br i1 %25, label %29, label %26
26: ; preds = %22
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 2, i32 1)
%28 = add nsw i32 %23, 1
br label %29
29: ; preds = %22, %26
%30 = phi i32 [ %28, %26 ], [ %23, %22 ]
%31 = and i32 %4, 2147483646
%32 = icmp eq i32 %31, 2
br i1 %32, label %36, label %33
33: ; preds = %29
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 2, i32 3)
%35 = add nsw i32 %30, 1
br label %36
36: ; preds = %33, %29
%37 = phi i32 [ %35, %33 ], [ %30, %29 ]
switch i32 %4, label %38 [
i32 4, label %41
i32 2, label %41
]
38: ; preds = %36
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 2, i32 4)
%40 = add nsw i32 %37, 1
br label %41
41: ; preds = %36, %36, %38
%42 = phi i32 [ %40, %38 ], [ %37, %36 ], [ %37, %36 ]
%43 = and i32 %4, 2147483645
%44 = icmp eq i32 %43, 1
br i1 %44, label %48, label %45
45: ; preds = %41
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 3, i32 1)
%47 = add nsw i32 %42, 1
br label %48
48: ; preds = %45, %41
%49 = phi i32 [ %47, %45 ], [ %42, %41 ]
%50 = and i32 %4, 2147483646
%51 = icmp eq i32 %50, 2
br i1 %51, label %55, label %52
52: ; preds = %48
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 3, i32 2)
%54 = add nsw i32 %49, 1
br label %55
55: ; preds = %48, %52
%56 = phi i32 [ %54, %52 ], [ %49, %48 ]
%57 = add nsw i32 %4, -3
%58 = icmp ult i32 %57, 2
br i1 %58, label %62, label %59
59: ; preds = %55
%60 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 3, i32 4)
%61 = add nsw i32 %56, 1
br label %62
62: ; preds = %59, %55
%63 = phi i32 [ %61, %59 ], [ %56, %55 ]
switch i32 %4, label %64 [
i32 4, label %67
i32 1, label %67
]
64: ; preds = %62
%65 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 4, i32 1)
%66 = add nsw i32 %63, 1
br label %67
67: ; preds = %62, %62, %64
%68 = phi i32 [ %66, %64 ], [ %63, %62 ], [ %63, %62 ]
switch i32 %4, label %69 [
i32 4, label %72
i32 2, label %72
]
69: ; preds = %67
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 4, i32 2)
%71 = add nsw i32 %68, 1
br label %72
72: ; preds = %67, %67, %69
%73 = phi i32 [ %71, %69 ], [ %68, %67 ], [ %68, %67 ]
%74 = add nsw i32 %4, -3
%75 = icmp ult i32 %74, 2
br i1 %75, label %79, label %76
76: ; preds = %72
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 4, i32 3)
%78 = add nsw i32 %73, 1
br label %79
79: ; preds = %72, %76
%80 = phi i32 [ %78, %76 ], [ %73, %72 ]
%81 = add nuw nsw i32 %4, 1
%82 = icmp eq i32 %81, 5
br i1 %82, label %83, label %2
83: ; preds = %79
%84 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.4, i64 0, i64 0))
%85 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i32 %80)
ret i32 0
}