#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*/ combination_sort(char **, int);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main() {
  int i = 0;
  char combinations[512][22] = {{-1}};
  char input_values[11];
  int searched_for, operation_cycler = 0, variation_number = 0;
  int int_numbers[11];
  fgets(input_values, 11, stdin);
  scanf("%d", &searched_for);
  for (i = 0; i < strlen(input_values); i++) {
    int_numbers[i] = input_values[i] - '0';
  }
  int sum = int_numbers[0];
  while (!(operation_cycler >> (strlen(input_values) - 2) & 1)) {
    for (i = 0; i < strlen(input_values) - 2; i++) {
      if ((operation_cycler >> i) & 1) {
        sum = sum - int_numbers[i + 1];
      }
      if (!((operation_cycler >> i) & 1)) {
        sum = sum + int_numbers[i + 1];
      }
    }
    if (sum == searched_for) {
      for (i = 0; i < strlen(input_values) - 1; i++) {
        combinations[variation_number][i * 2] = input_values[i];
        if (i < strlen(input_values) - 2) {
          if ((operation_cycler >> i) & 1) {
            combinations[variation_number][i * 2 + 1] = '-';
          }
          if (!((operation_cycler >> i) & 1)) {
            combinations[variation_number][i * 2 + 1] = '+';
          }
        }
      }
      variation_number++;
    }
    sum = int_numbers[0];
    operation_cycler++;
  }
  combination_sort(combinations, variation_number);
  if (variation_number == 0) {
    printf("-1");
    return 0;
  }
  for (i = 0; i < variation_number; i++) {
    printf("%s=%d", combinations[i], searched_for);
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2c80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x2c10(%rbp),%rdi
xor    %esi,%esi
mov    $0x2c00,%edx
call   1050 <memset@plt>
movb   $0xff,-0x2c10(%rbp)
movl   $0x0,-0x2c24(%rbp)
movl   $0x0,-0x2c28(%rbp)
lea    -0x2c1b(%rbp),%rdi
mov    0x2e33(%rip),%rax
mov    (%rax),%edx
mov    $0xb,%esi
call   1060 <fgets@plt>
lea    0xe3e(%rip),%rdi
lea    -0x2c20(%rbp),%rsi
call   1070 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c68(%rbp)
lea    -0x2c1b(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x2c68(%rbp),%eax
cmp    %ecx,%eax
jge    1228 <main+0xc8>
movslq -0x8(%rbp),%rax
movsbl -0x2c1b(%rbp,%rax,1),%ecx
ff
sub    $0x30,%ecx
movslq -0x8(%rbp),%rax
mov    %ecx,-0x2c60(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11db <main+0x7b>
mov    -0x2c60(%rbp),%eax
mov    %eax,-0x2c64(%rbp)
mov    -0x2c24(%rbp),%eax
mov    %eax,-0x2c6c(%rbp)
lea    -0x2c1b(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x2c6c(%rbp),%eax
sub    $0x2,%ecx
sar    %cl,%eax
and    $0x1,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1271 <main+0x111>
jmp    146d <main+0x30d>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c70(%rbp)
lea    -0x2c1b(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x2c70(%rbp),%eax
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    1319 <main+0x1b9>
mov    -0x2c24(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     12d3 <main+0x173>
mov    -0x2c64(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
sub    -0x2c60(%rbp,%rcx,4),%eax
mov    %eax,-0x2c64(%rbp)
mov    -0x2c24(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1306 <main+0x1a6>
mov    -0x2c64(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
add    -0x2c60(%rbp,%rcx,4),%eax
mov    %eax,-0x2c64(%rbp)
jmp    130b <main+0x1ab>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1278 <main+0x118>
mov    -0x2c64(%rbp),%eax
cmp    -0x2c20(%rbp),%eax
jne    144d <main+0x2ed>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c74(%rbp)
lea    -0x2c1b(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x2c74(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    143e <main+0x2de>
movslq -0x8(%rbp),%rax
mov    -0x2c1b(%rbp,%rax,1),%dl
movslq -0x2c28(%rbp),%rcx
lea    -0x2c10(%rbp),%rax
imul   $0x16,%rcx,%rcx
add    %rcx,%rax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c78(%rbp)
lea    -0x2c1b(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x2c78(%rbp),%eax
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    142b <main+0x2cb>
mov    -0x2c24(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     13ea <main+0x28a>
movslq -0x2c28(%rbp),%rcx
lea    -0x2c10(%rbp),%rax
imul   $0x16,%rcx,%rcx
add    %rcx,%rax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x2d,(%rax,%rcx,1)
mov    -0x2c24(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1426 <main+0x2c6>
movslq -0x2c28(%rbp),%rcx
lea    -0x2c10(%rbp),%rax
imul   $0x16,%rcx,%rcx
add    %rcx,%rax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x2b,(%rax,%rcx,1)
jmp    142b <main+0x2cb>
jmp    1430 <main+0x2d0>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1332 <main+0x1d2>
mov    -0x2c28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c28(%rbp)
mov    -0x2c60(%rbp),%eax
mov    %eax,-0x2c64(%rbp)
mov    -0x2c24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c24(%rbp)
jmp    1234 <main+0xd4>
lea    -0x2c10(%rbp),%rdi
mov    -0x2c28(%rbp),%esi
call   1080 <combination_sort@plt>
cmpl   $0x0,-0x2c28(%rbp)
jne    14a6 <main+0x346>
lea    0xb6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1505 <main+0x3a5>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x2c28(%rbp),%eax
jge    14fe <main+0x39e>
movslq -0x8(%rbp),%rax
lea    -0x2c10(%rbp),%rsi
imul   $0x16,%rax,%rax
add    %rax,%rsi
mov    -0x2c20(%rbp),%edx
lea    0xb28(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xb20(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    14ad <main+0x34d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2c80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2c58,%rsp
lea    0x50(%rsp),%rdi
xor    %eax,%eax
mov    %rax,0x8(%rsp)
mov    $0x2c00,%edx
xor    %esi,%esi
call   1060 <memset@plt>
movb   $0xff,0x50(%rsp)
mov    0x2e43(%rip),%rax
mov    (%rax),%edx
lea    0x15(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xb,%esi
call   1070 <fgets@plt>
lea    0xe46(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1080 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1206 <main+0x96>
xor    %ebp,%ebp
lea    0x15(%rsp),%rbx
nopl   (%rax)
movsbl 0x15(%rsp,%rbp,1),%eax
add    $0xffffffd0,%eax
mov    %eax,0x20(%rsp,%rbp,4)
add    $0x1,%rbp
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbp
jl     11e0 <main+0x70>
mov    0x20(%rsp),%r12d
jmp    1206 <main+0x96>
lea    0x15(%rsp),%r13
mov    %r13,%rdi
call   1040 <strlen@plt>
xor    %r14d,%r14d
jmp    1248 <main+0xd8>
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x8(%rsp)
add    $0x1,%r14d
mov    %r13,%rdi
call   1040 <strlen@plt>
add    $0xfe,%al
movzbl %al,%eax
bt     %eax,%r14d
jb     1308 <main+0x198>
mov    %r13,%rdi
call   1040 <strlen@plt>
mov    %r12d,%ebx
cmp    $0x3,%eax
jl     128b <main+0x11b>
xor    %eax,%eax
mov    %r12d,%ebx
xor    %ebp,%ebp
nop
mov    0x24(%rsp,%rax,4),%ecx
add    $0x1,%rbp
mov    %ecx,%edx
neg    %edx
bt     %eax,%r14d
cmovae %ecx,%edx
add    %edx,%ebx
mov    %r13,%rdi
call   1040 <strlen@plt>
add    $0xfffffffe,%eax
movslq %eax,%rcx
mov    %rbp,%rax
cmp    %rcx,%rbp
jl     1260 <main+0xf0>
cmp    0x10(%rsp),%ebx
jne    122d <main+0xbd>
mov    %r13,%rdi
call   1040 <strlen@plt>
cmp    $0x2,%eax
jl     1220 <main+0xb0>
movslq 0x8(%rsp),%rax
lea    (%rax,%rax,4),%rcx
lea    (%rax,%rcx,4),%rbx
add    %rax,%rbx
lea    0x51(%rsp),%rax
add    %rax,%rbx
xor    %r15d,%r15d
jmp    12da <main+0x16a>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15
mov    %r13,%rdi
call   1040 <strlen@plt>
add    $0xffffffff,%eax
cltq
cmp    %rax,%r15
jge    1220 <main+0xb0>
movzbl 0x15(%rsp,%r15,1),%eax
mov    %al,-0x1(%rbx,%r15,2)
mov    %r13,%rdi
call   1040 <strlen@plt>
add    $0xfffffffe,%eax
cltq
cmp    %rax,%r15
jge    12c0 <main+0x150>
bt     %r15d,%r14d
setb   %al
add    %al,%al
add    $0x2b,%al
mov    %al,(%rbx,%r15,2)
jmp    12c0 <main+0x150>
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    0x8(%rsp),%rbp
mov    %ebp,%esi
call   1090 <combination_sort@plt>
test   %ebp,%ebp
je     1357 <main+0x1e7>
jle    1365 <main+0x1f5>
mov    0x8(%rsp),%ebp
lea    0xcd6(%rip),%r14
nopl   (%rax)
mov    0x10(%rsp),%edx
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x16,%rbx
add    $0xffffffffffffffff,%rbp
jne    1330 <main+0x1c0>
jmp    1365 <main+0x1f5>
lea    0xca2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x2c58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"-1\00"
@.str.2 = [6 x i8] c"%s=%d\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [512 x [22 x i8]]
%4 = alloca [11 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [11 x i32]
%9 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%10 = bitcast [512 x [22 x i8]]* %3 to i8*
%11 = bitcast i8* %10 to <{ <{ i8, [21 x i8] }>, [511 x <{ i8, [21 x i8] }>] }>*
%12 = getelementptr inbounds <{ <{ i8, [21 x i8] }>, [511 x <{ i8, [21 x i8] }>] }>, <{ <{ i8, [21 x i8] }>, [511 x <{ i8, [21 x i8] }>] }>* %11, i32 0, i32 0
%13 = getelementptr inbounds <{ i8, [21 x i8] }>, <{ i8, [21 x i8] }>* %12, i32 0, i32 0
store i8 -1, i8* %13
store i32 0, i32* %6
store i32 0, i32* %7
%14 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%15 = load i32, i32* @stdin
%16 = call i32 @fgets(i8* %14, i32 11, i32 %15)
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
store i32 0, i32* %2
br label %18
18: ; preds = %33, %0
%19 = load i32, i32* %2
%20 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%21 = call i32 @strlen(i8* %20)
%22 = icmp slt i32 %19, %21
br i1 %22, label %23, label %36
23: ; preds = %18
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = sub nsw i32 %28, 48
%30 = load i32, i32* %2
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [11 x i32], [11 x i32]* %8, i64 0, i64 %31
store i32 %29, i32* %32
br label %33
33: ; preds = %23
%34 = load i32, i32* %2
%35 = add nsw i32 %34, 1
store i32 %35, i32* %2
br label %18
36: ; preds = %18
%37 = getelementptr inbounds [11 x i32], [11 x i32]* %8, i64 0, i64 0
%38 = load i32, i32* %37
store i32 %38, i32* %9
br label %39
39: ; preds = %153, %36
%40 = load i32, i32* %6
%41 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%42 = call i32 @strlen(i8* %41)
%43 = sub nsw i32 %42, 2
%44 = ashr i32 %40, %43
%45 = and i32 %44, 1
%46 = icmp ne i32 %45, 0
%47 = xor i1 %46, true
br i1 %47, label %48, label %158
48: ; preds = %39
store i32 0, i32* %2
br label %49
49: ; preds = %84, %48
%50 = load i32, i32* %2
%51 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%52 = call i32 @strlen(i8* %51)
%53 = sub nsw i32 %52, 2
%54 = icmp slt i32 %50, %53
br i1 %54, label %55, label %87
55: ; preds = %49
%56 = load i32, i32* %6
%57 = load i32, i32* %2
%58 = ashr i32 %56, %57
%59 = and i32 %58, 1
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %69
61: ; preds = %55
%62 = load i32, i32* %9
%63 = load i32, i32* %2
%64 = add nsw i32 %63, 1
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [11 x i32], [11 x i32]* %8, i64 0, i64 %65
%67 = load i32, i32* %66
%68 = sub nsw i32 %62, %67
store i32 %68, i32* %9
br label %69
69: ; preds = %61, %55
%70 = load i32, i32* %6
%71 = load i32, i32* %2
%72 = ashr i32 %70, %71
%73 = and i32 %72, 1
%74 = icmp ne i32 %73, 0
br i1 %74, label %83, label %75
75: ; preds = %69
%76 = load i32, i32* %9
%77 = load i32, i32* %2
%78 = add nsw i32 %77, 1
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [11 x i32], [11 x i32]* %8, i64 0, i64 %79
%81 = load i32, i32* %80
%82 = add nsw i32 %76, %81
store i32 %82, i32* %9
br label %83
83: ; preds = %75, %69
br label %84
84: ; preds = %83
%85 = load i32, i32* %2
%86 = add nsw i32 %85, 1
store i32 %86, i32* %2
br label %49
87: ; preds = %49
%88 = load i32, i32* %9
%89 = load i32, i32* %5
%90 = icmp eq i32 %88, %89
br i1 %90, label %91, label %153
91: ; preds = %87
store i32 0, i32* %2
br label %92
92: ; preds = %147, %91
%93 = load i32, i32* %2
%94 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%95 = call i32 @strlen(i8* %94)
%96 = sub nsw i32 %95, 1
%97 = icmp slt i32 %93, %96
br i1 %97, label %98, label %150
98: ; preds = %92
%99 = load i32, i32* %2
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 %100
%102 = load i8, i8* %101
%103 = load i32, i32* %7
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [512 x [22 x i8]], [512 x [22 x i8]]* %3, i64 0, i64 %104
%106 = load i32, i32* %2
%107 = mul nsw i32 %106, 2
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds [22 x i8], [22 x i8]* %105, i64 0, i64 %108
store i8 %102, i8* %109
%110 = load i32, i32* %2
%111 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%112 = call i32 @strlen(i8* %111)
%113 = sub nsw i32 %112, 2
%114 = icmp slt i32 %110, %113
br i1 %114, label %115, label %146
115: ; preds = %98
%116 = load i32, i32* %6
%117 = load i32, i32* %2
%118 = ashr i32 %116, %117
%119 = and i32 %118, 1
%120 = icmp ne i32 %119, 0
br i1 %120, label %121, label %130
121: ; preds = %115
%122 = load i32, i32* %7
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [512 x [22 x i8]], [512 x [22 x i8]]* %3, i64 0, i64 %123
%125 = load i32, i32* %2
%126 = mul nsw i32 %125, 2
%127 = add nsw i32 %126, 1
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds [22 x i8], [22 x i8]* %124, i64 0, i64 %128
store i8 45, i8* %129
br label %130
130: ; preds = %121, %115
%131 = load i32, i32* %6
%132 = load i32, i32* %2
%133 = ashr i32 %131, %132
%134 = and i32 %133, 1
%135 = icmp ne i32 %134, 0
br i1 %135, label %145, label %136
136: ; preds = %130
%137 = load i32, i32* %7
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds [512 x [22 x i8]], [512 x [22 x i8]]* %3, i64 0, i64 %138
%140 = load i32, i32* %2
%141 = mul nsw i32 %140, 2
%142 = add nsw i32 %141, 1
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds [22 x i8], [22 x i8]* %139, i64 0, i64 %143
store i8 43, i8* %144
br label %145
145: ; preds = %136, %130
br label %146
146: ; preds = %145, %98
br label %147
147: ; preds = %146
%148 = load i32, i32* %2
%149 = add nsw i32 %148, 1
store i32 %149, i32* %2
br label %92
150: ; preds = %92
%151 = load i32, i32* %7
%152 = add nsw i32 %151, 1
store i32 %152, i32* %7
br label %153
153: ; preds = %150, %87
%154 = getelementptr inbounds [11 x i32], [11 x i32]* %8, i64 0, i64 0
%155 = load i32, i32* %154
store i32 %155, i32* %9
%156 = load i32, i32* %6
%157 = add nsw i32 %156, 1
store i32 %157, i32* %6
br label %39
158: ; preds = %39
%159 = getelementptr inbounds [512 x [22 x i8]], [512 x [22 x i8]]* %3, i64 0, i64 0
%160 = bitcast [22 x i8]* %159 to i8**
%161 = load i32, i32* %7
%162 = call i32 @combination_sort(i8** %160, i32 %161)
%163 = load i32, i32* %7
%164 = icmp eq i32 %163, 0
br i1 %164, label %165, label %167
165: ; preds = %158
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %184
167: ; preds = %158
store i32 0, i32* %2
br label %168
168: ; preds = %180, %167
%169 = load i32, i32* %2
%170 = load i32, i32* %7
%171 = icmp slt i32 %169, %170
br i1 %171, label %172, label %183
172: ; preds = %168
%173 = load i32, i32* %2
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds [512 x [22 x i8]], [512 x [22 x i8]]* %3, i64 0, i64 %174
%176 = getelementptr inbounds [22 x i8], [22 x i8]* %175, i64 0, i64 0
%177 = load i32, i32* %5
%178 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %176, i32 %177)
%179 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %180
180: ; preds = %172
%181 = load i32, i32* %2
%182 = add nsw i32 %181, 1
store i32 %182, i32* %2
br label %168
183: ; preds = %168
store i32 0, i32* %1
br label %184
184: ; preds = %183, %165
%185 = load i32, i32* %1
ret i32 %185
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"-1\00"
@.str.2 = [6 x i8] c"%s=%d\00"
define i32 @main() {
%1 = alloca [512 x [22 x i8]]
%2 = alloca [11 x i8]
%3 = alloca i32
%4 = alloca [11 x i32]
%5 = getelementptr inbounds [512 x [22 x i8]], [512 x [22 x i8]]* %1, i64 0, i64 0, i64 0
store i8 -1, i8* %5
%6 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 0
%7 = bitcast i32* %3 to i8*
%8 = bitcast [11 x i32]* %4 to i8*
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %6, i32 11, i32 %9)
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%12 = call i32 @strlen(i8* %6)
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %28
14: ; preds = %0, %14
%15 = phi i64 [ %21, %14 ], [ 0, %0 ]
%16 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = add nsw i32 %18, -48
%20 = getelementptr inbounds [11 x i32], [11 x i32]* %4, i64 0, i64 %15
store i32 %19, i32* %20
%21 = add nuw nsw i64 %15, 1
%22 = call i32 @strlen(i8* %6)
%23 = sext i32 %22 to i64
%24 = icmp slt i64 %21, %23
br i1 %24, label %14, label %25
25: ; preds = %14
%26 = getelementptr inbounds [11 x i32], [11 x i32]* %4, i64 0, i64 0
%27 = load i32, i32* %26
br label %28
28: ; preds = %25, %0
%29 = phi i32 [ %27, %25 ], [ undef, %0 ]
%30 = call i32 @strlen(i8* %6)
br label %31
31: ; preds = %28, %88
%32 = phi i32 [ 0, %28 ], [ %89, %88 ]
%33 = phi i32 [ 0, %28 ], [ %90, %88 ]
%34 = call i32 @strlen(i8* %6)
%35 = icmp sgt i32 %34, 2
br i1 %35, label %36, label %53
36: ; preds = %31, %36
%37 = phi i64 [ %43, %36 ], [ 0, %31 ]
%38 = phi i32 [ %48, %36 ], [ %29, %31 ]
%39 = trunc i64 %37 to i32
%40 = shl nuw i32 1, %39
%41 = and i32 %40, %33
%42 = icmp eq i32 %41, 0
%43 = add nuw nsw i64 %37, 1
%44 = getelementptr inbounds [11 x i32], [11 x i32]* %4, i64 0, i64 %43
%45 = load i32, i32* %44
%46 = sub i32 0, %45
%47 = select i1 %42, i32 %45, i32 %46
%48 = add i32 %38, %47
%49 = call i32 @strlen(i8* %6)
%50 = add nsw i32 %49, -2
%51 = sext i32 %50 to i64
%52 = icmp slt i64 %43, %51
br i1 %52, label %36, label %53
53: ; preds = %36, %31
%54 = phi i32 [ %29, %31 ], [ %48, %36 ]
%55 = load i32, i32* %3
%56 = icmp eq i32 %54, %55
br i1 %56, label %57, label %88
57: ; preds = %53
%58 = call i32 @strlen(i8* %6)
%59 = icmp sgt i32 %58, 1
br i1 %59, label %60, label %86
60: ; preds = %57
%61 = sext i32 %32 to i64
br label %62
62: ; preds = %60, %80
%63 = phi i64 [ 0, %60 ], [ %81, %80 ]
%64 = getelementptr inbounds [11 x i8], [11 x i8]* %2, i64 0, i64 %63
%65 = load i8, i8* %64
%66 = shl nuw nsw i64 %63, 1
%67 = getelementptr inbounds [512 x [22 x i8]], [512 x [22 x i8]]* %1, i64 0, i64 %61, i64 %66
store i8 %65, i8* %67
%68 = call i32 @strlen(i8* %6)
%69 = add nsw i32 %68, -2
%70 = sext i32 %69 to i64
%71 = icmp slt i64 %63, %70
br i1 %71, label %72, label %80
72: ; preds = %62
%73 = trunc i64 %63 to i32
%74 = shl nuw i32 1, %73
%75 = and i32 %74, %33
%76 = icmp eq i32 %75, 0
%77 = or i64 %66, 1
%78 = getelementptr inbounds [512 x [22 x i8]], [512 x [22 x i8]]* %1, i64 0, i64 %61, i64 %77
%79 = select i1 %76, i8 43, i8 45
store i8 %79, i8* %78
br label %80
80: ; preds = %72, %62
%81 = add nuw nsw i64 %63, 1
%82 = call i32 @strlen(i8* %6)
%83 = add nsw i32 %82, -1
%84 = sext i32 %83 to i64
%85 = icmp slt i64 %81, %84
br i1 %85, label %62, label %86
86: ; preds = %80, %57
%87 = add nsw i32 %32, 1
br label %88
88: ; preds = %86, %53
%89 = phi i32 [ %87, %86 ], [ %32, %53 ]
%90 = add nuw nsw i32 %33, 1
%91 = call i32 @strlen(i8* %6)
%92 = add nsw i32 %91, -2
%93 = shl nuw i32 1, %92
%94 = and i32 %93, %90
%95 = icmp eq i32 %94, 0
br i1 %95, label %31, label %96
96: ; preds = %88
%97 = bitcast [512 x [22 x i8]]* %1 to i8**
%98 = call i32 @combination_sort(i8** %97, i32 %89)
%99 = icmp eq i32 %89, 0
br i1 %99, label %104, label %100
100: ; preds = %96
%101 = icmp sgt i32 %89, 0
br i1 %101, label %102, label %114
102: ; preds = %100
%103 = zext i32 %89 to i64
br label %106
104: ; preds = %96
%105 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %114
106: ; preds = %102, %106
%107 = phi i64 [ 0, %102 ], [ %112, %106 ]
%108 = getelementptr inbounds [512 x [22 x i8]], [512 x [22 x i8]]* %1, i64 0, i64 %107, i64 0
%109 = load i32, i32* %3
%110 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %108, i32 %109)
%111 = call i32 @putchar(i32 10)
%112 = add nuw nsw i64 %107, 1
%113 = icmp eq i64 %112, %103
br i1 %113, label %114, label %106
114: ; preds = %106, %100, %104
ret i32 0
}