#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 *, ...);
void print24GameAnswer(int n) {
  if (n > 5) {
    print24GameAnswer(n - 2);
    printf("%d - %d = 1\n", n, n - 1);
    printf("1 * 24 = 24\n");
  } else if (n == 5) {
    printf("YES\n");
    printf("5 - 1 = 4\n");
    printf("4 - 2 = 2\n");
    printf("2 * 3 = 6\n");
    printf("6 * 4 = 24\n");
  } else if (n == 4) {
    printf("YES\n");
    printf("1 * 2 = 2\n");
    printf("2 * 3 = 6\n");
    printf("6 * 4 = 24\n");
  } else {
    printf("NO");
  }
}


x86 assembly (clang, -O0):
<print24GameAnswer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
jle    116a <print24GameAnswer+0x4a>
mov    -0x4(%rbp),%edi
sub    $0x2,%edi
call   1030 <print24GameAnswer@plt>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
sub    $0x1,%edx
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    121e <print24GameAnswer+0xfe>
cmpl   $0x5,-0x4(%rbp)
jne    11bf <print24GameAnswer+0x9f>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1219 <print24GameAnswer+0xf9>
cmpl   $0x4,-0x4(%rbp)
jne    1206 <print24GameAnswer+0xe6>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1214 <print24GameAnswer+0xf4>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1219 <print24GameAnswer+0xf9>
jmp    121e <print24GameAnswer+0xfe>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print24GameAnswer>:
push   %rbx
mov    %edi,%ebx
cmp    $0x6,%edi
jl     1160 <print24GameAnswer+0x30>
lea    -0x2(%rbx),%edi
call   1040 <print24GameAnswer@plt>
lea    -0x1(%rbx),%edx
lea    0xeb6(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeed(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
cmp    $0x4,%ebx
je     118b <print24GameAnswer+0x5b>
cmp    $0x5,%ebx
jne    11bc <print24GameAnswer+0x8c>
lea    0xea9(%rip),%rdi
call   1030 <puts@plt>
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9f(%rip),%rdi
jmp    119e <print24GameAnswer+0x6e>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
lea    0xe72(%rip),%rdi
call   1030 <puts@plt>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
lea    0xe86(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
lea    0xe4a(%rip),%rdi
xor    %eax,%eax
pop    %rbx
jmp    1050 <printf@plt>

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

LLVM IR (-O2):
@.str = [13 x i8] c"%d - %d = 1\0A\00"
@.str.8 = [3 x i8] c"NO\00"
@str.9 = [10 x i8] c"1 * 2 = 2\00"
@str.12 = [4 x i8] c"YES\00"
@str.13 = [10 x i8] c"5 - 1 = 4\00"
@str.14 = [10 x i8] c"4 - 2 = 2\00"
@str.15 = [10 x i8] c"2 * 3 = 6\00"
@str.16 = [11 x i8] c"6 * 4 = 24\00"
@str.17 = [12 x i8] c"1 * 24 = 24\00"
define void @print24GameAnswer(i32 %0) {
%2 = icmp sgt i32 %0, 5
br i1 %2, label %4, label %9
3: ; preds = %16, %21, %10, %4
ret void
4: ; preds = %1
%5 = add nsw i32 %0, -2
tail call void @print24GameAnswer(i32 %5)
%6 = add nsw i32 %0, -1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.17, i64 0, i64 0))
br label %3
9: ; preds = %1
switch i32 %0, label %21 [
i32 5, label %10
i32 4, label %16
]
10: ; preds = %9
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.12, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.13, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.14, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.15, i64 0, i64 0))
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.16, i64 0, i64 0))
br label %3
16: ; preds = %9
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.12, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.9, i64 0, i64 0))
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.15, i64 0, i64 0))
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.16, i64 0, i64 0))
br label %3
21: ; preds = %9
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %3
}