#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*/ Display;

/* Variables and functions */
int /*<<< orphan*/ XNVCTRLQueryStringAttribute(int /*<<< orphan*/ *, int,
                                               int /*<<< orphan*/, int,
                                               char **);
int /*<<< orphan*/ XNVCTRLSetStringAttribute(int /*<<< orphan*/ *, int,
                                             int /*<<< orphan*/, int, char *);
int /*<<< orphan*/ XSync(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int strlen(char *);
char *strstr(char *, char *);
int AddAttributesToDisplayOfCurrentMetaMode(Display *xDpy, int screenId,
                                            int nvDpyId,
                                            const char *attributes) {
  char *pOldCurrentMetaMode = NULL;
  char *pCurrentMetaMode = NULL;
  char displayName[512];
  char *pDisplay;
  char *newMetaMode = NULL;
  int error = 1;
  XNVCTRLQueryStringAttribute(xDpy, screenId, 0, 45, &pOldCurrentMetaMode);
  pCurrentMetaMode = strstr(pOldCurrentMetaMode, "::");
  pCurrentMetaMode += 2;
  sprintf(displayName, "DPY-%i", nvDpyId);
  pDisplay = strstr(pCurrentMetaMode, displayName);
  if (pDisplay) {
    int foundBeginAttr = 0;
    char newAttribute[256];
    int endOfString = 1;
    int neededLength;
    while (*(++pDisplay)) {
      if (*pDisplay == '{') {
        foundBeginAttr = 1;
      }
      if (*pDisplay == '}') {
        endOfString = 0;
        break;
      }
      if (*pDisplay == ',' && !foundBeginAttr) {
        endOfString = 0;
        break;
      }
    }
    if (!endOfString) {
      *pDisplay = 0;
      pDisplay++;
    }
    if (endOfString) {
      sprintf(newAttribute, " {%s}", attributes);
    }
    if (foundBeginAttr) {
      sprintf(newAttribute, ", %s}", attributes);
    } else {
      sprintf(newAttribute, " {%s},", attributes);
    }
    neededLength =
        strlen(pCurrentMetaMode) + strlen(newAttribute) + strlen(pDisplay);
    newMetaMode = malloc(neededLength + 3);
    if (!newMetaMode) {
      goto cleanup;
    }
    sprintf(newMetaMode, "%s%s%s", pCurrentMetaMode, newAttribute, pDisplay);
  } else {
    goto cleanup;
  }
  XNVCTRLSetStringAttribute(xDpy, screenId, 0, 45, newMetaMode);
  XSync(xDpy, 0);
  error = 0;
cleanup:
  if (newMetaMode) {
    free(newMetaMode);
  }
  if (pOldCurrentMetaMode) {
    free(pOldCurrentMetaMode);
  }
  return error;
}


x86 assembly (clang, -O0):
<AddAttributesToDisplayOfCurrentMetaMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x360,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x240(%rbp)
movl   $0x1,-0x244(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
xor    %edx,%edx
mov    $0x2d,%ecx
lea    -0x20(%rbp),%r8
call   1040 <XNVCTRLQueryStringAttribute@plt>
mov    -0x20(%rbp),%rdi
lea    0xe20(%rip),%rsi
call   10a0 <strstr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x28(%rbp)
lea    -0x230(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xdfd(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
mov    -0x28(%rbp),%rdi
lea    -0x230(%rbp),%rsi
call   10a0 <strstr@plt>
mov    %rax,-0x238(%rbp)
cmpq   $0x0,-0x238(%rbp)
je     1406 <AddAttributesToDisplayOfCurrentMetaMode+0x286>
movl   $0x0,-0x248(%rbp)
movl   $0x1,-0x354(%rbp)
mov    -0x238(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x238(%rbp)
cmpb   $0x0,0x1(%rax)
je     12d8 <AddAttributesToDisplayOfCurrentMetaMode+0x158>
mov    -0x238(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7b,%eax
jne    1282 <AddAttributesToDisplayOfCurrentMetaMode+0x102>
movl   $0x1,-0x248(%rbp)
mov    -0x238(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7d,%eax
jne    12a4 <AddAttributesToDisplayOfCurrentMetaMode+0x124>
movl   $0x0,-0x354(%rbp)
jmp    12d8 <AddAttributesToDisplayOfCurrentMetaMode+0x158>
mov    -0x238(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
jne    12d3 <AddAttributesToDisplayOfCurrentMetaMode+0x153>
cmpl   $0x0,-0x248(%rbp)
jne    12d3 <AddAttributesToDisplayOfCurrentMetaMode+0x153>
movl   $0x0,-0x354(%rbp)
jmp    12d8 <AddAttributesToDisplayOfCurrentMetaMode+0x158>
jmp    1246 <AddAttributesToDisplayOfCurrentMetaMode+0xc6>
cmpl   $0x0,-0x354(%rbp)
jne    1301 <AddAttributesToDisplayOfCurrentMetaMode+0x181>
mov    -0x238(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x238(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x238(%rbp)
cmpl   $0x0,-0x354(%rbp)
je     1327 <AddAttributesToDisplayOfCurrentMetaMode+0x1a7>
lea    -0x350(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xcea(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
cmpl   $0x0,-0x248(%rbp)
je     1352 <AddAttributesToDisplayOfCurrentMetaMode+0x1d2>
lea    -0x350(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xcca(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
jmp    136b <AddAttributesToDisplayOfCurrentMetaMode+0x1eb>
lea    -0x350(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xcb2(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
mov    -0x28(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x360(%rbp)
lea    -0x350(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x360(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x35c(%rbp)
mov    -0x238(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x35c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x358(%rbp)
mov    -0x358(%rbp),%edi
add    $0x3,%edi
call   1070 <malloc@plt>
mov    %rax,-0x240(%rbp)
cmpq   $0x0,-0x240(%rbp)
jne    13da <AddAttributesToDisplayOfCurrentMetaMode+0x25a>
jmp    143a <AddAttributesToDisplayOfCurrentMetaMode+0x2ba>
mov    -0x240(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    -0x350(%rbp),%rcx
mov    -0x238(%rbp),%r8
lea    0xc23(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
jmp    140b <AddAttributesToDisplayOfCurrentMetaMode+0x28b>
jmp    143a <AddAttributesToDisplayOfCurrentMetaMode+0x2ba>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x240(%rbp),%r8
xor    %edx,%edx
mov    $0x2d,%ecx
call   1060 <XNVCTRLSetStringAttribute@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1080 <XSync@plt>
movl   $0x0,-0x244(%rbp)
cmpq   $0x0,-0x240(%rbp)
je     1454 <AddAttributesToDisplayOfCurrentMetaMode+0x2d4>
mov    -0x240(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x20(%rbp)
je     1468 <AddAttributesToDisplayOfCurrentMetaMode+0x2e8>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x244(%rbp),%eax
add    $0x360,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AddAttributesToDisplayOfCurrentMetaMode>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x328,%rsp
mov    %rcx,%r12
mov    %edx,%r14d
mov    %esi,%r13d
movq   $0x0,0x8(%rsp)
xor    %ebp,%ebp
lea    0x8(%rsp),%r8
mov    %rdi,0x18(%rsp)
xor    %edx,%edx
mov    $0x2d,%ecx
call   1040 <XNVCTRLQueryStringAttribute@plt>
mov    0x8(%rsp),%rdi
lea    0xe39(%rip),%rsi
call   10a0 <strstr@plt>
mov    %rax,%r15
add    $0x2,%r15
lea    0xe29(%rip),%rsi
lea    0x120(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14d,%edx
xor    %eax,%eax
call   1090 <sprintf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   10a0 <strstr@plt>
test   %rax,%rax
je     1304 <AddAttributesToDisplayOfCurrentMetaMode+0x184>
add    $0x1,%rax
mov    %r13d,0x14(%rsp)
nopl   0x0(%rax)
mov    %rax,%rbx
movzbl (%rax),%ecx
mov    $0x1,%edx
cmp    $0x7b,%cl
je     122b <AddAttributesToDisplayOfCurrentMetaMode+0xab>
test   %cl,%cl
je     1247 <AddAttributesToDisplayOfCurrentMetaMode+0xc7>
cmp    $0x7d,%cl
je     123e <AddAttributesToDisplayOfCurrentMetaMode+0xbe>
mov    %ebp,%edx
lea    0x1(%rbx),%rax
mov    %edx,%ebp
cmp    $0x2c,%cl
jne    1210 <AddAttributesToDisplayOfCurrentMetaMode+0x90>
mov    %edx,%ebp
test   %edx,%edx
jne    1210 <AddAttributesToDisplayOfCurrentMetaMode+0x90>
xor    %ebp,%ebp
movb   $0x0,(%rbx)
add    $0x1,%rbx
jmp    125d <AddAttributesToDisplayOfCurrentMetaMode+0xdd>
lea    0xdbc(%rip),%rsi
lea    0x20(%rsp),%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1090 <sprintf@plt>
test   %ebp,%ebp
lea    0xdb0(%rip),%rax
lea    0xda3(%rip),%rsi
cmove  %rax,%rsi
xor    %r13d,%r13d
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
mov    %r12,%rdx
xor    %eax,%eax
call   1090 <sprintf@plt>
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %eax,%r14d
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <strlen@plt>
add    %r14d,%ebp
lea    (%rax,%rbp,1),%edi
add    $0x3,%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     1304 <AddAttributesToDisplayOfCurrentMetaMode+0x184>
mov    %rax,%rbp
lea    0xd5d(%rip),%rsi
lea    0x20(%rsp),%rcx
mov    %rax,%rdi
mov    %r15,%rdx
mov    %rbx,%r8
xor    %eax,%eax
call   1090 <sprintf@plt>
mov    0x18(%rsp),%rbx
mov    %rbx,%rdi
mov    0x14(%rsp),%esi
xor    %edx,%edx
mov    $0x2d,%ecx
mov    %rbp,%r8
call   1060 <XNVCTRLSetStringAttribute@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <XSync@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
jmp    130a <AddAttributesToDisplayOfCurrentMetaMode+0x18a>
mov    $0x1,%r13d
mov    0x8(%rsp),%rdi
test   %rdi,%rdi
je     1319 <AddAttributesToDisplayOfCurrentMetaMode+0x199>
call   1030 <free@plt>
mov    %r13d,%eax
add    $0x328,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"::\00"
@.str.1 = [7 x i8] c"DPY-%i\00"
@.str.2 = [6 x i8] c" {%s}\00"
@.str.3 = [6 x i8] c", %s}\00"
@.str.4 = [7 x i8] c" {%s},\00"
@.str.5 = [7 x i8] c"%s%s%s\00"
define i32 @AddAttributesToDisplayOfCurrentMetaMode(i32* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [512 x i8]
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca [256 x i8]
%17 = alloca i32
%18 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
store i8* null, i8** %9
store i8* null, i8** %10
store i8* null, i8** %13
store i32 1, i32* %14
%19 = load i32*, i32** %5
%20 = load i32, i32* %6
%21 = call i32 @XNVCTRLQueryStringAttribute(i32* %19, i32 %20, i32 0, i32 45, i8** %9)
%22 = load i8*, i8** %9
%23 = call i8* @strstr(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %23, i8** %10
%24 = load i8*, i8** %10
%25 = getelementptr inbounds i8, i8* %24, i64 2
store i8* %25, i8** %10
%26 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%27 = load i32, i32* %7
%28 = call i32 (i8*, i8*, ...) @sprintf(i8* %26, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = load i8*, i8** %10
%30 = getelementptr inbounds [512 x i8], [512 x i8]* %11, i64 0, i64 0
%31 = call i8* @strstr(i8* %29, i8* %30)
store i8* %31, i8** %12
%32 = load i8*, i8** %12
%33 = icmp ne i8* %32, null
br i1 %33, label %34, label %108
34: ; preds = %4
store i32 0, i32* %15
store i32 1, i32* %17
br label %35
35: ; preds = %61, %34
%36 = load i8*, i8** %12
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %12
%38 = load i8, i8* %37
%39 = icmp ne i8 %38, 0
br i1 %39, label %40, label %62
40: ; preds = %35
%41 = load i8*, i8** %12
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 123
br i1 %44, label %45, label %46
45: ; preds = %40
store i32 1, i32* %15
br label %46
46: ; preds = %45, %40
%47 = load i8*, i8** %12
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 125
br i1 %50, label %51, label %52
51: ; preds = %46
store i32 0, i32* %17
br label %62
52: ; preds = %46
%53 = load i8*, i8** %12
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 44
br i1 %56, label %57, label %61
57: ; preds = %52
%58 = load i32, i32* %15
%59 = icmp ne i32 %58, 0
br i1 %59, label %61, label %60
60: ; preds = %57
store i32 0, i32* %17
br label %62
61: ; preds = %57, %52
br label %35
62: ; preds = %60, %51, %35
%63 = load i32, i32* %17
%64 = icmp ne i32 %63, 0
br i1 %64, label %69, label %65
65: ; preds = %62
%66 = load i8*, i8** %12
store i8 0, i8* %66
%67 = load i8*, i8** %12
%68 = getelementptr inbounds i8, i8* %67, i32 1
store i8* %68, i8** %12
br label %69
69: ; preds = %65, %62
%70 = load i32, i32* %17
%71 = icmp ne i32 %70, 0
br i1 %71, label %72, label %76
72: ; preds = %69
%73 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%74 = load i8*, i8** %8
%75 = call i32 (i8*, i8*, ...) @sprintf(i8* %73, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %74)
br label %76
76: ; preds = %72, %69
%77 = load i32, i32* %15
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %83
79: ; preds = %76
%80 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%81 = load i8*, i8** %8
%82 = call i32 (i8*, i8*, ...) @sprintf(i8* %80, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %81)
br label %87
83: ; preds = %76
%84 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%85 = load i8*, i8** %8
%86 = call i32 (i8*, i8*, ...) @sprintf(i8* %84, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %85)
br label %87
87: ; preds = %83, %79
%88 = load i8*, i8** %10
%89 = call i32 @strlen(i8* %88)
%90 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%91 = call i32 @strlen(i8* %90)
%92 = add nsw i32 %89, %91
%93 = load i8*, i8** %12
%94 = call i32 @strlen(i8* %93)
%95 = add nsw i32 %92, %94
store i32 %95, i32* %18
%96 = load i32, i32* %18
%97 = add nsw i32 %96, 3
%98 = call i8* @malloc(i32 %97)
store i8* %98, i8** %13
%99 = load i8*, i8** %13
%100 = icmp ne i8* %99, null
br i1 %100, label %102, label %101
101: ; preds = %87
br label %116
102: ; preds = %87
%103 = load i8*, i8** %13
%104 = load i8*, i8** %10
%105 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 0, i64 0
%106 = load i8*, i8** %12
%107 = call i32 (i8*, i8*, ...) @sprintf(i8* %103, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %104, i8* %105, i8* %106)
br label %109
108: ; preds = %4
br label %116
109: ; preds = %102
%110 = load i32*, i32** %5
%111 = load i32, i32* %6
%112 = load i8*, i8** %13
%113 = call i32 @XNVCTRLSetStringAttribute(i32* %110, i32 %111, i32 0, i32 45, i8* %112)
%114 = load i32*, i32** %5
%115 = call i32 @XSync(i32* %114, i32 0)
store i32 0, i32* %14
br label %116
116: ; preds = %109, %108, %101
%117 = load i8*, i8** %13
%118 = icmp ne i8* %117, null
br i1 %118, label %119, label %122
119: ; preds = %116
%120 = load i8*, i8** %13
%121 = call i32 @free(i8* %120)
br label %122
122: ; preds = %119, %116
%123 = load i8*, i8** %9
%124 = icmp ne i8* %123, null
br i1 %124, label %125, label %128
125: ; preds = %122
%126 = load i8*, i8** %9
%127 = call i32 @free(i8* %126)
br label %128
128: ; preds = %125, %122
%129 = load i32, i32* %14
ret i32 %129
}

LLVM IR (-O2):
@.str = [3 x i8] c"::\00"
@.str.1 = [7 x i8] c"DPY-%i\00"
@.str.2 = [6 x i8] c" {%s}\00"
@.str.3 = [6 x i8] c", %s}\00"
@.str.4 = [7 x i8] c" {%s},\00"
@.str.5 = [7 x i8] c"%s%s%s\00"
define i32 @AddAttributesToDisplayOfCurrentMetaMode(i32* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca [512 x i8]
%7 = alloca [256 x i8]
%8 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%10 = call i32 @XNVCTRLQueryStringAttribute(i32* %0, i32 %1, i32 0, i32 45, i8** %5)
%11 = load i8*, i8** %5
%12 = call i8* @strstr(i8* dereferenceable(1) %11, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = getelementptr inbounds i8, i8* %12, i64 2
%14 = call i32 (i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%15 = call i8* @strstr(i8* %13, i8* %9)
%16 = icmp eq i8* %15, null
br i1 %16, label %55, label %17
17: ; preds = %4
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
br label %19
19: ; preds = %25, %17
%20 = phi i8* [ %15, %17 ], [ %22, %25 ]
%21 = phi i32 [ 0, %17 ], [ %26, %25 ]
%22 = getelementptr inbounds i8, i8* %20, i64 1
%23 = load i8, i8* %22
switch i8 %23, label %24 [
i8 0, label %33
i8 123, label %25
i8 125, label %30
]
24: ; preds = %19
br label %25
25: ; preds = %19, %24
%26 = phi i32 [ 1, %19 ], [ %21, %24 ]
%27 = icmp ne i8 %23, 44
%28 = icmp ne i32 %26, 0
%29 = select i1 %27, i1 true, i1 %28
br i1 %29, label %19, label %30
30: ; preds = %19, %25
%31 = phi i32 [ 0, %25 ], [ %21, %19 ]
store i8 0, i8* %22
%32 = getelementptr inbounds i8, i8* %20, i64 2
br label %35
33: ; preds = %19
%34 = call i32 (i8*, i8*, ...) @sprintf(i8* %18, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %3)
br label %35
35: ; preds = %30, %33
%36 = phi i8* [ %32, %30 ], [ %22, %33 ]
%37 = phi i32 [ %31, %30 ], [ %21, %33 ]
%38 = icmp eq i32 %37, 0
%39 = select i1 %38, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0)
%40 = call i32 (i8*, i8*, ...) @sprintf(i8* %18, i8* dereferenceable(1) %39, i8* %3)
%41 = call i32 @strlen(i8* %13)
%42 = call i32 @strlen(i8* %18)
%43 = call i32 @strlen(i8* %36)
%44 = add i32 %41, 3
%45 = add i32 %44, %42
%46 = add i32 %45, %43
%47 = call i8* @malloc(i32 %46)
%48 = icmp eq i8* %47, null
br i1 %48, label %49, label %50
49: ; preds = %35
br label %55
50: ; preds = %35
%51 = call i32 (i8*, i8*, ...) @sprintf(i8* %47, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %13, i8* %18, i8* %36)
%52 = call i32 @XNVCTRLSetStringAttribute(i32* %0, i32 %1, i32 0, i32 45, i8* %47)
%53 = call i32 @XSync(i32* %0, i32 0)
%54 = call i32 @free(i8* %47)
br label %55
55: ; preds = %4, %49, %50
%56 = phi i32 [ 0, %50 ], [ 1, %49 ], [ 1, %4 ]
%57 = load i8*, i8** %5
%58 = icmp eq i8* %57, null
br i1 %58, label %61, label %59
59: ; preds = %55
%60 = call i32 @free(i8* %57)
br label %61
61: ; preds = %55, %59
ret i32 %56
}