#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 /*<<< orphan*/ wyswietl_wspolczynnik(int, int);
void formatuj_rownanie(int a, int b, int c) {
  int first = 1;
  if (a != 0) {
    wyswietl_wspolczynnik(a, first);
    printf("xx ");
    first = 0;
  }
  if (b != 0) {
    wyswietl_wspolczynnik(b, first);
    printf("x ");
    first = 0;
  }
  if ((a == 0) && (b == 0)) {
    printf("%d", c);
  } else if (c != 0) {
    wyswietl_wspolczynnik(c, first);
  }
  printf(" = 0\n");
}


x86 assembly (clang, -O0):
<formatuj_rownanie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1162 <formatuj_rownanie+0x42>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <wyswietl_wspolczynnik@plt>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     118c <formatuj_rownanie+0x6c>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <wyswietl_wspolczynnik@plt>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    11b6 <formatuj_rownanie+0x96>
cmpl   $0x0,-0x8(%rbp)
jne    11b6 <formatuj_rownanie+0x96>
mov    -0xc(%rbp),%esi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d0 <formatuj_rownanie+0xb0>
cmpl   $0x0,-0xc(%rbp)
je     11cb <formatuj_rownanie+0xab>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <wyswietl_wspolczynnik@plt>
jmp    11d0 <formatuj_rownanie+0xb0>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<formatuj_rownanie>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
test   %edi,%edi
je     1194 <formatuj_rownanie+0x64>
mov    %ebx,%edi
mov    $0x1,%esi
call   1050 <wyswietl_wspolczynnik@plt>
lea    0xeab(%rip),%rdi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebp,%ebp
je     117e <formatuj_rownanie+0x4e>
mov    %ebp,%edi
mov    %r15d,%esi
call   1050 <wyswietl_wspolczynnik@plt>
lea    0xe8d(%rip),%rdi
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <printf@plt>
or     %ebx,%ebp
je     11a0 <formatuj_rownanie+0x70>
test   %r14d,%r14d
je     11b1 <formatuj_rownanie+0x81>
mov    %r14d,%edi
mov    %r15d,%esi
call   1050 <wyswietl_wspolczynnik@plt>
jmp    11b1 <formatuj_rownanie+0x81>
mov    $0x1,%r15d
test   %ebp,%ebp
jne    1163 <formatuj_rownanie+0x33>
jmp    117e <formatuj_rownanie+0x4e>
lea    0xe5d(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe4f(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <puts@plt>

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

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