#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 printTerm(int coeff, int degree) {
  if (coeff == 0)
    return;
  if (coeff != 1 || degree == 0)
    printf("%d", coeff);
  if (degree == 0)
    return;
  if (degree != 1)
    printf("x^%d", degree);
  else
    printf("x");
}


x86 assembly (clang, -O0):
<printTerm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    112d <printTerm+0x1d>
jmp    118f <printTerm+0x7f>
cmpl   $0x1,-0x4(%rbp)
jne    1141 <printTerm+0x31>
cmpl   $0x0,-0x8(%rbp)
jne    1152 <printTerm+0x42>
mov    -0x4(%rbp),%esi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1161 <printTerm+0x51>
jmp    118f <printTerm+0x7f>
cmpl   $0x1,-0x8(%rbp)
je     1181 <printTerm+0x71>
mov    -0x8(%rbp),%esi
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    118f <printTerm+0x7f>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printTerm>:
push   %rbx
test   %edi,%edi
je     1158 <printTerm+0x38>
mov    %esi,%ebx
mov    %edi,%esi
cmp    $0x1,%edi
jne    1146 <printTerm+0x26>
test   %ebx,%ebx
je     1146 <printTerm+0x26>
test   %ebx,%ebx
je     1158 <printTerm+0x38>
cmp    $0x1,%ebx
jne    115a <printTerm+0x3a>
mov    $0x78,%edi
pop    %rbx
jmp    1030 <putchar@plt>
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
jne    1136 <printTerm+0x16>
pop    %rbx
ret
lea    0xe9f(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"x^%d\00"
define void @printTerm(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %17, label %4
4: ; preds = %2
%5 = icmp ne i32 %0, 1
%6 = icmp eq i32 %1, 0
%7 = or i1 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %10
10: ; preds = %4, %8
br i1 %6, label %17, label %11
11: ; preds = %10
%12 = icmp eq i32 %1, 1
br i1 %12, label %15, label %13
13: ; preds = %11
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %1)
br label %17
15: ; preds = %11
%16 = tail call i32 @putchar(i32 120)
br label %17
17: ; preds = %10, %2, %15, %13
ret void
}