#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 */
char *extract_xml(char *, char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void GetDeviceCapabilities(char *res) {
  char play[256];
  char rec[256];
  char qual[256];
  char *p;
  fprintf(stderr, "#\tPlay\tRec\tQuality\n");
  p = extract_xml(play, res, "PlayMedia");
  p = extract_xml(rec, p, "RecMedia");
  p = extract_xml(qual, p, "RecQualityModes");
  fprintf(stderr, "Caps:\t%s\t%s\t%s\n", play, rec, qual);
}


x86 assembly (clang, -O0):
<GetDeviceCapabilities>:
push   %rbp
mov    %rsp,%rbp
sub    $0x320,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
lea    0xec1(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rsi
lea    0xebc(%rip),%rdx
call   1030 <extract_xml@plt>
mov    %rax,-0x318(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x318(%rbp),%rsi
lea    0xea5(%rip),%rdx
call   1030 <extract_xml@plt>
mov    %rax,-0x318(%rbp)
lea    -0x310(%rbp),%rdi
mov    -0x318(%rbp),%rsi
lea    0xe8d(%rip),%rdx
call   1030 <extract_xml@plt>
mov    %rax,-0x318(%rbp)
mov    0x2e33(%rip),%rax
mov    (%rax),%edi
lea    -0x110(%rbp),%rdx
lea    -0x210(%rbp),%rcx
lea    -0x310(%rbp),%r8
lea    0xe6c(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x320,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetDeviceCapabilities>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x308,%rsp
mov    %rdi,%rbx
mov    0x2ea8(%rip),%r12
mov    (%r12),%edi
lea    0xebd(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xec3(%rip),%rdx
lea    0x200(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <extract_xml@plt>
lea    0xeb3(%rip),%rdx
lea    0x100(%rsp),%r15
mov    %r15,%rdi
mov    %rax,%rsi
call   1030 <extract_xml@plt>
lea    0xea2(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <extract_xml@plt>
mov    (%r12),%edi
lea    0xe99(%rip),%rsi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x308,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"#\09Play\09Rec\09Quality\0A\00"
@.str.1 = [10 x i8] c"PlayMedia\00"
@.str.2 = [9 x i8] c"RecMedia\00"
@.str.3 = [16 x i8] c"RecQualityModes\00"
@.str.4 = [16 x i8] c"Caps:\09%s\09%s\09%s\0A\00"
define void @GetDeviceCapabilities(i8* %0) {
%2 = alloca i8*
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = alloca [256 x i8]
%6 = alloca i8*
store i8* %0, i8** %2
%7 = load i32, i32* @stderr
%8 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%10 = load i8*, i8** %2
%11 = call i8* @extract_xml(i8* %9, i8* %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
store i8* %11, i8** %6
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%13 = load i8*, i8** %6
%14 = call i8* @extract_xml(i8* %12, i8* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
store i8* %14, i8** %6
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%16 = load i8*, i8** %6
%17 = call i8* @extract_xml(i8* %15, i8* %16, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
store i8* %17, i8** %6
%18 = load i32, i32* @stderr
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %19, i8* %20, i8* %21)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"#\09Play\09Rec\09Quality\0A\00"
@.str.1 = [10 x i8] c"PlayMedia\00"
@.str.2 = [9 x i8] c"RecMedia\00"
@.str.3 = [16 x i8] c"RecQualityModes\00"
@.str.4 = [16 x i8] c"Caps:\09%s\09%s\09%s\0A\00"
define void @GetDeviceCapabilities(i8* %0) {
%2 = alloca [256 x i8]
%3 = alloca [256 x i8]
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%10 = call i8* @extract_xml(i8* %5, i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%11 = call i8* @extract_xml(i8* %6, i8* %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%12 = call i8* @extract_xml(i8* %7, i8* %11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%13 = load i32, i32* @stderr
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* %5, i8* %6, i8* %7)
ret void
}