#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 const *);
int /*<<< orphan*/ midnam_avail_channel(int /*<<< orphan*/ *, int);
void midnam_channe_set(FILE *f, const char *name, const char *ctrl, int c) {
  fprintf(f,
          "    <ChannelNameSet Name=\"%s\">\n"
          "      <AvailableForChannels>\n",
          name);
  midnam_avail_channel(f, c + 1);
  fprintf(f,
          "      </AvailableForChannels>\n"
          "      <UsesControlNameList Name=\"%s\"/>\n"
          "      <PatchBank Name=\"Global Patches Bank 1\">\n"
          "        <UsesPatchNameList Name=\"Programmes\"/>\n"
          "      </PatchBank>\n"
          "    </ChannelNameSet>\n",
          ctrl);
}


x86 assembly (clang, -O0):
<midnam_channe_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeba(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
call   1040 <midnam_avail_channel@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xed4(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<midnam_channe_set>:
push   %r15
push   %r14
push   %rbx
mov    %ecx,%ebx
mov    %rdx,%r14
mov    %rsi,%rdx
mov    %rdi,%r15
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x1,%ebx
mov    %r15,%rdi
mov    %ebx,%esi
call   1040 <midnam_avail_channel@plt>
lea    0xeed(%rip),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [61 x i8] c" <ChannelNameSet Name=\22%s\22>\0A <AvailableForChannels>\0A\00"
@.str.1 = [205 x i8] c" </AvailableForChannels>\0A <UsesControlNameList Name=\22%s\22/>\0A <PatchBank Name=\22Global Patches Bank 1\22>\0A <UsesPatchNameList Name=\22Programmes\22/>\0A </PatchBank>\0A </ChannelNameSet>\0A\00"
define void @midnam_channe_set(i32* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32*, i32** %5
%10 = load i8*, i8** %6
%11 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32*, i32** %5
%13 = load i32, i32* %8
%14 = add nsw i32 %13, 1
%15 = call i32 @midnam_avail_channel(i32* %12, i32 %14)
%16 = load i32*, i32** %5
%17 = load i8*, i8** %7
%18 = call i32 @fprintf(i32* %16, i8* getelementptr inbounds ([205 x i8], [205 x i8]* @.str.1, i64 0, i64 0), i8* %17)
ret void
}

LLVM IR (-O2):
@.str = [61 x i8] c" <ChannelNameSet Name=\22%s\22>\0A <AvailableForChannels>\0A\00"
@.str.1 = [205 x i8] c" </AvailableForChannels>\0A <UsesControlNameList Name=\22%s\22/>\0A <PatchBank Name=\22Global Patches Bank 1\22>\0A <UsesPatchNameList Name=\22Programmes\22/>\0A </PatchBank>\0A </ChannelNameSet>\0A\00"
define void @midnam_channe_set(i32* %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = add nsw i32 %3, 1
%7 = tail call i32 @midnam_avail_channel(i32* %0, i32 %6)
%8 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([205 x i8], [205 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret void
}