#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, int, char *,
                           char *);
char *pS(char *);
void genInfix(FILE *out, char *op, int left, int prior, int right, char *cmt) {
  char *assoc = left < prior && right < prior ? "infix"
                : left < prior                ? "right"
                                              : "left";
  fprintf(out, "\\tt %s&\\small{}%d&\\small{}%s&\\small{}%s\\\\\n", pS(op),
          prior, assoc, cmt);
}


x86 assembly (clang, -O0):
<genInfix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1166 <genInfix+0x46>
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1166 <genInfix+0x46>
lea    0xea3(%rip),%rax
mov    %rax,-0x38(%rbp)
jmp    1184 <genInfix+0x64>
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%esi
lea    0xe99(%rip),%rax
lea    0xe8c(%rip),%rcx
cmp    %esi,%edx
cmovl  %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <pS@plt>
mov    -0x40(%rbp),%rdi
mov    %rax,%rdx
mov    -0x18(%rbp),%ecx
mov    -0x30(%rbp),%r8
mov    -0x28(%rbp),%r9
lea    0xe5b(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genInfix>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r9,%r14
mov    %ecx,%ebp
mov    %rdi,%r15
cmp    %ecx,%edx
jge    1141 <genInfix+0x21>
cmp    %ebp,%r8d
jge    114a <genInfix+0x2a>
lea    0xec1(%rip),%rbx
jmp    1151 <genInfix+0x31>
lea    0xec4(%rip),%rbx
jmp    1151 <genInfix+0x31>
lea    0xeb5(%rip),%rbx
mov    %rsi,%rdi
call   1040 <pS@plt>
lea    0xeb1(%rip),%rsi
mov    %r15,%rdi
mov    %rax,%rdx
mov    %ebp,%ecx
mov    %rbx,%r8
mov    %r14,%r9
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"infix\00"
@.str.1 = [6 x i8] c"right\00"
@.str.2 = [5 x i8] c"left\00"
@.str.3 = [43 x i8] c"\\tt %s&\\small{}%d&\\small{}%s&\\small{}%s\\\\\0A\00"
define void @genInfix(i32* %0, i8* %1, i32 %2, i32 %3, i32 %4, i8* %5) {
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
store i32* %0, i32** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i8* %5, i8** %12
%14 = load i32, i32* %9
%15 = load i32, i32* %10
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %22
17: ; preds = %6
%18 = load i32, i32* %11
%19 = load i32, i32* %10
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %17
br label %28
22: ; preds = %17, %6
%23 = load i32, i32* %9
%24 = load i32, i32* %10
%25 = icmp slt i32 %23, %24
%26 = zext i1 %25 to i64
%27 = select i1 %25, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
br label %28
28: ; preds = %22, %21
%29 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %21 ], [ %27, %22 ]
store i8* %29, i8** %13
%30 = load i32*, i32** %7
%31 = load i8*, i8** %8
%32 = call i8* @pS(i8* %31)
%33 = load i32, i32* %10
%34 = load i8*, i8** %13
%35 = load i8*, i8** %12
%36 = call i32 @fprintf(i32* %30, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i8* %32, i32 %33, i8* %34, i8* %35)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"infix\00"
@.str.1 = [6 x i8] c"right\00"
@.str.2 = [5 x i8] c"left\00"
@.str.3 = [43 x i8] c"\\tt %s&\\small{}%d&\\small{}%s&\\small{}%s\\\\\0A\00"
define void @genInfix(i32* nocapture %0, i8* %1, i32 %2, i32 %3, i32 %4, i8* %5) {
%7 = icmp slt i32 %2, %3
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = icmp slt i32 %4, %3
br i1 %9, label %12, label %10
10: ; preds = %8, %6
%11 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %8 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %6 ]
br label %12
12: ; preds = %8, %10
%13 = phi i8* [ %11, %10 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %8 ]
%14 = tail call i8* @pS(i8* %1)
%15 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i8* %14, i32 %3, i8* %13, i8* %5)
ret void
}