#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 */
scalar_t__ chk_eqn(char *);
scalar_t__ jump(char *);
int /*<<< orphan*/ next_sequence(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  char seqnc[10] = {9, 1, 2, 3, 4, 5, 6, 7, 8, 9};
  char typ_out[23] = "0/00 + 0/00 + 0/00 = 1";
  int cnt, plc, rund = 0, rmn = 0;
  printf("       *******************************************\n");
  printf("       *    ?      ?      ?                      *\n");
  printf("       *  ---- + ---- + ---- = 1                 *\n");
  printf("       *   ??     ??     ??                      *\n");
  printf("       *    Find out the number behind           *\n");
  printf("       *       every question mark. They         *\n");
  printf("       *         are 1 to 9, and all different!  *\n");
  printf("       *******************************************\n");
  do {
    if (chk_eqn(seqnc)) {
      for (cnt = 3; cnt > 0; cnt--) {
        plc = (cnt - 1) * 7;
        typ_out[plc] = seqnc[cnt + 6] + '0';
        typ_out[plc + 3] = seqnc[cnt * 2] + '0';
        typ_out[plc + 2] = seqnc[cnt * 2 - 1] + '0';
      }
      printf("\r%s  \n", typ_out);
    }
    rmn++;
    rmn %= 100;
    if (rmn == 0) {
      rund++;
      printf("\r%d00 combination tested.", rund);
    }
    next_sequence(seqnc);
  } while (jump(seqnc) == 0);
  printf("\r%d%d combination tested.\n", rund, rmn);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0xe(%rbp)
mov    0xea7(%rip),%ax
mov    %ax,-0x6(%rbp)
mov    0xea4(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xea1(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe9f(%rip),%eax
mov    %eax,-0x20(%rbp)
mov    0xe99(%rip),%ax
mov    %ax,-0x1c(%rbp)
mov    0xe91(%rip),%al
mov    %al,-0x1a(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeec(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf12(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf5e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xe(%rbp),%rdi
call   1030 <chk_eqn@plt>
cmp    $0x0,%rax
je     12bf <main+0x17f>
movl   $0x3,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jle    12ad <main+0x16d>
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
imul   $0x7,%eax,%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
add    $0x6,%eax
cltq
movsbl -0xe(%rbp,%rax,1),%eax
add    $0x30,%eax
mov    %al,%cl
movslq -0x38(%rbp),%rax
mov    %cl,-0x30(%rbp,%rax,1)
mov    -0x34(%rbp),%eax
shl    $0x1,%eax
cltq
movsbl -0xe(%rbp,%rax,1),%eax
add    $0x30,%eax
mov    %al,%cl
mov    -0x38(%rbp),%eax
add    $0x3,%eax
cltq
mov    %cl,-0x30(%rbp,%rax,1)
mov    -0x34(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
cltq
movsbl -0xe(%rbp,%rax,1),%eax
add    $0x30,%eax
mov    %al,%cl
mov    -0x38(%rbp),%eax
add    $0x2,%eax
cltq
mov    %cl,-0x30(%rbp,%rax,1)
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
jmp    1230 <main+0xf0>
lea    -0x30(%rbp),%rsi
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jne    12fa <main+0x1ba>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%esi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xe(%rbp),%rdi
call   1060 <next_sequence@plt>
lea    -0xe(%rbp),%rdi
call   1050 <jump@plt>
cmp    $0x0,%rax
je     1216 <main+0xd6>
mov    -0x3c(%rbp),%esi
mov    -0x40(%rbp),%edx
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movabs $0x706050403020109,%rax
05 06 07
mov    %rax,(%rsp)
movw   $0x908,0x8(%rsp)
movaps 0xe96(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x31203d2030302f,%rax
mov    %rax,0x1f(%rsp)
lea    0x1000(%rip),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xebf(%rip),%rdi
call   1040 <puts@plt>
lea    0xee6(%rip),%rdi
call   1040 <puts@plt>
lea    0xf0d(%rip),%rdi
call   1040 <puts@plt>
lea    0xf34(%rip),%rdi
call   1040 <puts@plt>
lea    0xf5b(%rip),%rdi
call   1040 <puts@plt>
lea    0xf82(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rsp,%rbp
lea    0xe37(%rip),%r15
lea    0xe29(%rip),%r12
lea    0x10(%rsp),%r13
xor    %r14d,%r14d
xor    %ebx,%ebx
jmp    1229 <main+0xd9>
nopw   0x0(%rax,%rax,1)
mov    %rbp,%rdi
call   1070 <next_sequence@plt>
mov    %rbp,%rdi
call   1060 <jump@plt>
test   %rax,%rax
jne    12e2 <main+0x192>
mov    %rbp,%rdi
call   1030 <chk_eqn@plt>
test   %rax,%rax
je     12a7 <main+0x157>
movzbl 0x9(%rsp),%eax
add    $0x30,%al
mov    %al,0x1e(%rsp)
movzbl 0x6(%rsp),%eax
add    $0x30,%al
mov    %al,0x21(%rsp)
movzbl 0x5(%rsp),%eax
add    $0x30,%al
mov    %al,0x20(%rsp)
movzbl 0x8(%rsp),%eax
add    $0x30,%al
mov    %al,0x17(%rsp)
movzbl 0x4(%rsp),%eax
add    $0x30,%al
mov    %al,0x1a(%rsp)
movzbl 0x3(%rsp),%eax
add    $0x30,%al
mov    %al,0x19(%rsp)
movzbl 0x7(%rsp),%eax
add    $0x30,%al
mov    %al,0x10(%rsp)
movzbl 0x1(%rsp),%eax
movzbl 0x2(%rsp),%ecx
add    $0x30,%cl
mov    %cl,0x13(%rsp)
add    $0x30,%al
mov    %al,0x12(%rsp)
mov    %r12,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebx
movslq %ebx,%rbx
imul   $0x51eb851f,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ebx
jne    1210 <main+0xc0>
add    $0x1,%r14d
mov    %r15,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1210 <main+0xc0>
lea    0xd5f(%rip),%rdi
mov    %r14d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.seqnc = [10 x i8] c"\09\01\02\03\04\05\06\07\08\09"
@__const.main.typ_out = [23 x i8] c"0/00 + 0/00 + 0/00 = 1\00"
@.str = [52 x i8] c" *******************************************\0A\00"
@.str.1 = [52 x i8] c" * ? ? ? *\0A\00"
@.str.2 = [52 x i8] c" * ---- + ---- + ---- = 1 *\0A\00"
@.str.3 = [52 x i8] c" * ?? ?? ?? *\0A\00"
@.str.4 = [52 x i8] c" * Find out the number behind *\0A\00"
@.str.5 = [52 x i8] c" * every question mark. They *\0A\00"
@.str.6 = [52 x i8] c" * are 1 to 9, and all different! *\0A\00"
@.str.7 = [7 x i8] c"\0D%s \0A\00"
@.str.8 = [26 x i8] c"\0D%d00 combination tested.\00"
@.str.9 = [27 x i8] c"\0D%d%d combination tested.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca [23 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [10 x i8]* %2 to i8*
%9 = bitcast [23 x i8]* %3 to i8*
store i32 0, i32* %6
store i32 0, i32* %7
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %87, %0
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%20 = call i64 @chk_eqn(i8* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %72
22: ; preds = %18
store i32 3, i32* %4
br label %23
23: ; preds = %66, %22
%24 = load i32, i32* %4
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %69
26: ; preds = %23
%27 = load i32, i32* %4
%28 = sub nsw i32 %27, 1
%29 = mul nsw i32 %28, 7
store i32 %29, i32* %5
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 6
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = add nsw i32 %35, 48
%37 = trunc i32 %36 to i8
%38 = load i32, i32* %5
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [23 x i8], [23 x i8]* %3, i64 0, i64 %39
store i8 %37, i8* %40
%41 = load i32, i32* %4
%42 = mul nsw i32 %41, 2
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = add nsw i32 %46, 48
%48 = trunc i32 %47 to i8
%49 = load i32, i32* %5
%50 = add nsw i32 %49, 3
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [23 x i8], [23 x i8]* %3, i64 0, i64 %51
store i8 %48, i8* %52
%53 = load i32, i32* %4
%54 = mul nsw i32 %53, 2
%55 = sub nsw i32 %54, 1
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = add nsw i32 %59, 48
%61 = trunc i32 %60 to i8
%62 = load i32, i32* %5
%63 = add nsw i32 %62, 2
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [23 x i8], [23 x i8]* %3, i64 0, i64 %64
store i8 %61, i8* %65
br label %66
66: ; preds = %26
%67 = load i32, i32* %4
%68 = add nsw i32 %67, -1
store i32 %68, i32* %4
br label %23
69: ; preds = %23
%70 = getelementptr inbounds [23 x i8], [23 x i8]* %3, i64 0, i64 0
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* %70)
br label %72
72: ; preds = %69, %18
%73 = load i32, i32* %7
%74 = add nsw i32 %73, 1
store i32 %74, i32* %7
%75 = load i32, i32* %7
%76 = srem i32 %75, 100
store i32 %76, i32* %7
%77 = load i32, i32* %7
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %84
79: ; preds = %72
%80 = load i32, i32* %6
%81 = add nsw i32 %80, 1
store i32 %81, i32* %6
%82 = load i32, i32* %6
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i32 %82)
br label %84
84: ; preds = %79, %72
%85 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%86 = call i32 @next_sequence(i8* %85)
br label %87
87: ; preds = %84
%88 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%89 = call i64 @jump(i8* %88)
%90 = icmp eq i64 %89, 0
br i1 %90, label %18, label %91
91: ; preds = %87
%92 = load i32, i32* %6
%93 = load i32, i32* %7
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i32 %92, i32 %93)
ret i32 0
}

LLVM IR (-O2):
@__const.main.seqnc = [10 x i8] c"\09\01\02\03\04\05\06\07\08\09"
@__const.main.typ_out = [23 x i8] c"0/00 + 0/00 + 0/00 = 1\00"
@.str.7 = [7 x i8] c"\0D%s \0A\00"
@.str.8 = [26 x i8] c"\0D%d00 combination tested.\00"
@.str.9 = [27 x i8] c"\0D%d%d combination tested.\0A\00"
@str.10 = [51 x i8] c" * ? ? ? *\00"
@str.11 = [51 x i8] c" * ---- + ---- + ---- = 1 *\00"
@str.12 = [51 x i8] c" * ?? ?? ?? *\00"
@str.13 = [51 x i8] c" * Find out the number behind *\00"
@str.14 = [51 x i8] c" * every question mark. They *\00"
@str.15 = [51 x i8] c" * are 1 to 9, and all different! *\00"
@str.16 = [51 x i8] c" *******************************************\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [23 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [23 x i8], [23 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.16, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.10, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.11, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.12, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.13, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.14, i64 0, i64 0))
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.15, i64 0, i64 0))
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.16, i64 0, i64 0))
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 9
%14 = getelementptr inbounds [23 x i8], [23 x i8]* %2, i64 0, i64 14
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 6
%16 = getelementptr inbounds [23 x i8], [23 x i8]* %2, i64 0, i64 17
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 5
%18 = getelementptr inbounds [23 x i8], [23 x i8]* %2, i64 0, i64 16
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 8
%20 = getelementptr inbounds [23 x i8], [23 x i8]* %2, i64 0, i64 7
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 4
%22 = getelementptr inbounds [23 x i8], [23 x i8]* %2, i64 0, i64 10
%23 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 3
%24 = getelementptr inbounds [23 x i8], [23 x i8]* %2, i64 0, i64 9
%25 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 7
%26 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 2
%27 = getelementptr inbounds [23 x i8], [23 x i8]* %2, i64 0, i64 3
%28 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 1
%29 = getelementptr inbounds [23 x i8], [23 x i8]* %2, i64 0, i64 2
br label %30
30: ; preds = %62, %0
%31 = phi i32 [ 0, %0 ], [ %63, %62 ]
%32 = phi i32 [ 0, %0 ], [ %57, %62 ]
%33 = call i64 @chk_eqn(i8* %3)
%34 = icmp eq i64 %33, 0
br i1 %34, label %55, label %35
35: ; preds = %30
%36 = load i8, i8* %13
%37 = add i8 %36, 48
store i8 %37, i8* %14
%38 = load i8, i8* %15
%39 = add i8 %38, 48
store i8 %39, i8* %16
%40 = load i8, i8* %17
%41 = add i8 %40, 48
store i8 %41, i8* %18
%42 = load i8, i8* %19
%43 = add i8 %42, 48
store i8 %43, i8* %20
%44 = load i8, i8* %21
%45 = add i8 %44, 48
store i8 %45, i8* %22
%46 = load i8, i8* %23
%47 = add i8 %46, 48
store i8 %47, i8* %24
%48 = load i8, i8* %25
%49 = add i8 %48, 48
store i8 %49, i8* %4
%50 = load i8, i8* %26
%51 = add i8 %50, 48
store i8 %51, i8* %27
%52 = load i8, i8* %28
%53 = add i8 %52, 48
store i8 %53, i8* %29
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* %4)
br label %55
55: ; preds = %35, %30
%56 = add nsw i32 %32, 1
%57 = srem i32 %56, 100
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %55
%60 = add nsw i32 %31, 1
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i32 %60)
br label %62
62: ; preds = %59, %55
%63 = phi i32 [ %60, %59 ], [ %31, %55 ]
%64 = call i32 @next_sequence(i8* %3)
%65 = call i64 @jump(i8* %3)
%66 = icmp eq i64 %65, 0
br i1 %66, label %30, label %67
67: ; preds = %62
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i32 %63, i32 %57)
ret i32 0
}