#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 */
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
void sys_get_audio_apis(char *buf) {
  int n = 0;
  strcpy(buf, "{ ");
  sprintf(buf + strlen(buf), "{dummy %d} ", 9);
  n++;
  strcat(buf, "}");
  if (n < 2)
    strcpy(buf, "{}");
}


x86 assembly (clang, -O0):
<sys_get_audio_apis>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rdi
cltq
add    %rax,%rdi
lea    0xe7f(%rip),%rsi
mov    $0x9,%edx
call   1060 <sprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe6e(%rip),%rsi
call   1050 <strcat@plt>
cmpl   $0x2,-0xc(%rbp)
jge    11c1 <sys_get_audio_apis+0x81>
mov    -0x8(%rbp),%rdi
lea    0xe53(%rip),%rsi
call   1030 <strcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_get_audio_apis>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
lea    0xe9e(%rip),%rsi
mov    $0x9,%edx
call   1060 <sprintf@plt>
lea    0xe9a(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
lea    0xe8a(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"{ \00"
@.str.1 = [12 x i8] c"{dummy %d} \00"
@.str.2 = [2 x i8] c"}\00"
@.str.3 = [3 x i8] c"{}\00"
define void @sys_get_audio_apis(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %2
%7 = load i8*, i8** %2
%8 = call i32 @strlen(i8* %7)
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %6, i64 %9
%11 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 9)
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
%14 = load i8*, i8** %2
%15 = call i32 @strcat(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 2
br i1 %17, label %18, label %21
18: ; preds = %1
%19 = load i8*, i8** %2
%20 = call i32 @strcpy(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %21
21: ; preds = %18, %1
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"{ \00"
@.str.1 = [12 x i8] c"{dummy %d} \00"
@.str.2 = [2 x i8] c"}\00"
@.str.3 = [3 x i8] c"{}\00"
define void @sys_get_audio_apis(i8* %0) {
%2 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @strlen(i8* %0)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = tail call i32 @sprintf(i8* dereferenceable(1) %5, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 9)
%7 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}