#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 */
typedef int /*<<< orphan*/ variables;

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ process_eqn(char *, int *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ save_results(int *);
int /*<<< orphan*/ stdin;
void solve() {
  char curr_eqn[32];
  int variables[20];
  memset(variables, 0, sizeof(variables));
  puts("Enter equations, use a blank line to end");
  while (1) {
    fgets(curr_eqn, 32, stdin);
    if (curr_eqn[0] == '\n') {
      break;
    } else {
      process_eqn(curr_eqn, variables);
    }
  }
  save_results(variables);
}


x86 assembly (clang, -O0):
<solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1040 <memset@plt>
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
lea    -0x20(%rbp),%rdi
mov    0x2e69(%rip),%rax
mov    (%rax),%edx
mov    $0x20,%esi
call   1050 <fgets@plt>
movsbl -0x20(%rbp),%eax
cmp    $0xa,%eax
jne    119d <solve+0x4d>
jmp    11af <solve+0x5f>
lea    -0x20(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1070 <process_eqn@plt>
jmp    1174 <solve+0x24>
lea    -0x70(%rbp),%rdi
call   1060 <save_results@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
lea    0x20(%rsp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1040 <memset@plt>
lea    0xe8f(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e6b(%rip),%r15
mov    (%r15),%edx
mov    %rsp,%rdi
mov    $0x20,%esi
call   1050 <fgets@plt>
cmpb   $0xa,(%rsp)
je     11c1 <solve+0x71>
mov    %rsp,%rbx
lea    0x20(%rsp),%r14
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <process_eqn@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1050 <fgets@plt>
cmpb   $0xa,(%rsp)
jne    11a0 <solve+0x50>
lea    0x20(%rsp),%rdi
call   1060 <save_results@plt>
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Enter equations, use a blank line to end\00"
@stdin = global i32 0
define void @solve() {
%1 = alloca [32 x i8]
%2 = alloca [20 x i32]
%3 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%4 = call i32 @memset(i32* %3, i32 0, i32 80)
%5 = call i32 @puts(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %0, %19
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %7, i32 32, i32 %8)
%10 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 10
br i1 %13, label %14, label %15
14: ; preds = %6
br label %20
15: ; preds = %6
%16 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%17 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%18 = call i32 @process_eqn(i8* %16, i32* %17)
br label %19
19: ; preds = %15
br label %6
20: ; preds = %14
%21 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%22 = call i32 @save_results(i32* %21)
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"Enter equations, use a blank line to end\00"
@stdin = global i32 0
define void @solve() {
%1 = alloca [32 x i8]
%2 = alloca [20 x i32]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%4 = bitcast [20 x i32]* %2 to i8*
%5 = getelementptr inbounds [20 x i32], [20 x i32]* %2, i64 0, i64 0
%6 = call i32 @memset(i32* %5, i32 0, i32 80)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %3, i32 32, i32 %8)
%10 = load i8, i8* %3
%11 = icmp eq i8 %10, 10
br i1 %11, label %18, label %12
12: ; preds = %0, %12
%13 = call i32 @process_eqn(i8* %3, i32* %5)
%14 = load i32, i32* @stdin
%15 = call i32 @fgets(i8* %3, i32 32, i32 %14)
%16 = load i8, i8* %3
%17 = icmp eq i8 %16, 10
br i1 %17, label %18, label %12
18: ; preds = %12, %0
%19 = call i32 @save_results(i32* %5)
ret void
}