#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 *, ...);
void gen_func_proto(FILE *f, const char *name, int *params) {
  int i;
  fprintf(f, "void gen_%s(struct op_queue *opq, int end", name);
  for (i = 0; (i < (3 + 1)) && params[i]; i++) {
    fprintf(f, ", uorreg_t param%i", i + 1);
  }
  fprintf(f, ")");
}


x86 assembly (clang, -O0):
<gen_func_proto>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xecd(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x1c(%rbp)
xor    %eax,%eax
cmpl   $0x4,-0x1c(%rbp)
mov    %al,-0x1d(%rbp)
jge    1162 <gen_func_proto+0x52>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1172 <gen_func_proto+0x62>
jmp    1198 <gen_func_proto+0x88>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
lea    0xea7(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1141 <gen_func_proto+0x31>
mov    -0x8(%rbp),%rdi
lea    0xe9a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_func_proto>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rdx
mov    %rdi,%rbx
lea    0xecc(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
cmpl   $0x0,(%r14)
je     11ae <gen_func_proto+0x8e>
lea    0xee2(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
cmpl   $0x0,0x4(%r14)
je     11ae <gen_func_proto+0x8e>
lea    0xec5(%rip),%rsi
mov    %rbx,%rdi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
cmpl   $0x0,0x8(%r14)
je     11ae <gen_func_proto+0x8e>
lea    0xea8(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
cmpl   $0x0,0xc(%r14)
je     11ae <gen_func_proto+0x8e>
lea    0xe8b(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x29,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"void gen_%s(struct op_queue *opq, int end\00"
@.str.1 = [19 x i8] c", uorreg_t param%i\00"
@.str.2 = [2 x i8] c")\00"
define void @gen_func_proto(i32* %0, i8* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%8 = load i32*, i32** %4
%9 = load i8*, i8** %5
%10 = call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %9)
store i32 0, i32* %7
br label %11
11: ; preds = %28, %3
%12 = load i32, i32* %7
%13 = icmp slt i32 %12, 4
br i1 %13, label %14, label %21
14: ; preds = %11
%15 = load i32*, i32** %6
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
%19 = load i32, i32* %18
%20 = icmp ne i32 %19, 0
br label %21
21: ; preds = %14, %11
%22 = phi i1 [ false, %11 ], [ %20, %14 ]
br i1 %22, label %23, label %31
23: ; preds = %21
%24 = load i32*, i32** %4
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
%27 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %23
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
br label %11
31: ; preds = %21
%32 = load i32*, i32** %4
%33 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"void gen_%s(struct op_queue *opq, int end\00"
@.str.1 = [19 x i8] c", uorreg_t param%i\00"
define void @gen_func_proto(i32* nocapture %0, i8* %1, i32* nocapture %2) {
%4 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %1)
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
br i1 %6, label %24, label %7
7: ; preds = %3
%8 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 1)
%9 = getelementptr inbounds i32, i32* %2, i64 1
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %24, label %12
12: ; preds = %7
%13 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 2)
%14 = getelementptr inbounds i32, i32* %2, i64 2
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 0
br i1 %16, label %24, label %17
17: ; preds = %12
%18 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 3)
%19 = getelementptr inbounds i32, i32* %2, i64 3
%20 = load i32, i32* %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %17
%23 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 4)
br label %24
24: ; preds = %22, %17, %12, %7, %3
%25 = tail call i32 @fputc(i32 41, i32* %0)
ret void
}