#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 write_tcx_header(FILE *tcxfile) {
  fprintf(tcxfile,
          "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>\n");
  fprintf(
      tcxfile,
      "<TrainingCenterDatabase "
      "xmlns=\"http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2\" "
      "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
      "xsi:schemaLocation=\"http://www.garmin.com/xmlschemas/ActivityExtension/"
      "v2 http://www.garmin.com/xmlschemas/ActivityExtensionv2.xsd "
      "http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2 "
      "http://www.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd\">\n\n");
  fprintf(tcxfile, "  <Activities>\n");
  return;
}


x86 assembly (clang, -O0):
<write_tcx_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf02(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x1083(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_tcx_header>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    $0x38,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xf05(%rip),%rdi
mov    $0x190,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0x107d(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
pop    %rbx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [57 x i8] c"<?xml version=\221.0\22 encoding=\22UTF-8\22 standalone=\22no\22 ?>\0A\00"
@.str.1 = [401 x i8] c"<TrainingCenterDatabase xmlns=\22http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2\22 xmlns:xsi=\22http://www.w3.org/2001/XMLSchema-instance\22 xsi:schemaLocation=\22http://www.garmin.com/xmlschemas/ActivityExtension/v2 http://www.garmin.com/xmlschemas/ActivityExtensionv2.xsd http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2 http://www.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd\22>\0A\0A\00"
@.str.2 = [16 x i8] c" <Activities>\0A\00"
define void @write_tcx_header(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([401 x i8], [401 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32*, i32** %2
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [57 x i8] c"<?xml version=\221.0\22 encoding=\22UTF-8\22 standalone=\22no\22 ?>\0A\00"
@.str.1 = [401 x i8] c"<TrainingCenterDatabase xmlns=\22http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2\22 xmlns:xsi=\22http://www.w3.org/2001/XMLSchema-instance\22 xsi:schemaLocation=\22http://www.garmin.com/xmlschemas/ActivityExtension/v2 http://www.garmin.com/xmlschemas/ActivityExtensionv2.xsd http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2 http://www.garmin.com/xmlschemas/TrainingCenterDatabasev2.xsd\22>\0A\0A\00"
@.str.2 = [16 x i8] c" <Activities>\0A\00"
define void @write_tcx_header(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i64 56, i64 1, i32* %0)
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([401 x i8], [401 x i8]* @.str.1, i64 0, i64 0), i64 400, i64 1, i32* %0)
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i64 15, i64 1, i32* %0)
ret void
}