#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 OSC_WritePadding(char *, int);
int OSC_padStringWithAnExtraStupidComma(char *dest, char *str) {
  int i;
  dest[0] = ',';
  for (i = 0; str[i] != '\0'; i++) {
    dest[i + 1] = str[i];
  }
  return OSC_WritePadding(dest, i + 1);
}


x86 assembly (clang, -O0):
<OSC_padStringWithAnExtraStupidComma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x2c,(%rax)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     116c <OSC_padStringWithAnExtraStupidComma+0x5c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112e <OSC_padStringWithAnExtraStupidComma+0x1e>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
call   1030 <OSC_WritePadding@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OSC_padStringWithAnExtraStupidComma>:
movb   $0x2c,(%rdi)
mov    (%rsi),%cl
test   %cl,%cl
je     1144 <OSC_padStringWithAnExtraStupidComma+0x34>
mov    %rsi,%rax
mov    $0x1,%esi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rdi,%rsi,1)
movzbl (%rax,%rsi,1),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1130 <OSC_padStringWithAnExtraStupidComma+0x20>
jmp    1030 <OSC_WritePadding@plt>
mov    $0x1,%esi
jmp    1030 <OSC_WritePadding@plt>

LLVM IR (-O0):
define i32 @OSC_padStringWithAnExtraStupidComma(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
store i8 44, i8* %7
store i32 0, i32* %5
br label %8
8: ; preds = %27, %2
%9 = load i8*, i8** %4
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %30
16: ; preds = %8
%17 = load i8*, i8** %4
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = load i8*, i8** %3
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %22, i64 %25
store i8 %21, i8* %26
br label %27
27: ; preds = %16
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %8
30: ; preds = %8
%31 = load i8*, i8** %3
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
%34 = call i32 @OSC_WritePadding(i8* %31, i32 %33)
ret i32 %34
}

LLVM IR (-O2):
define i32 @OSC_padStringWithAnExtraStupidComma(i8* %0, i8* nocapture %1) {
store i8 44, i8* %0
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %8, %5 ], [ 0, %2 ]
%7 = phi i8 [ %11, %5 ], [ %3, %2 ]
%8 = add nuw nsw i64 %6, 1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
store i8 %7, i8* %9
%10 = getelementptr inbounds i8, i8* %1, i64 %8
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5
%14 = trunc i64 %8 to i32
%15 = add i32 %14, 1
br label %16
16: ; preds = %13, %2
%17 = phi i32 [ 1, %2 ], [ %15, %13 ]
%18 = tail call i32 @OSC_WritePadding(i8* %0, i32 %17)
ret i32 %18
}