#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 *realloc(char *, unsigned int);
int addGuessedChars(char guess, char *guessedChars) {
  static unsigned guessedCharsLength = 25;
  static unsigned guessedCharsUsed = 0;
  int counter = 0;
  while (guessedChars[counter] != '\0') {
    if (guessedChars[counter] == guess)
      return 0;
    counter++;
  }
  if (guessedCharsUsed > (guessedCharsLength - 3)) {
    guessedCharsLength *= 1.5;
    guessedChars = realloc(guessedChars, (guessedCharsLength * sizeof(char)));
  }
  guessedChars[guessedCharsUsed] = guess;
  guessedChars[guessedCharsUsed + 1] = ' ';
  guessedChars[guessedCharsUsed + 2] = '\0';
  guessedCharsUsed += 2;
  return 1;
}


x86 assembly (clang, -O0):
<addGuessedChars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1170 <addGuessedChars+0x60>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x5(%rbp),%ecx
cmp    %ecx,%eax
jne    1162 <addGuessedChars+0x52>
movl   $0x0,-0x4(%rbp)
jmp    120e <addGuessedChars+0xfe>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <addGuessedChars+0x19>
mov    0x2eba(%rip),%eax
mov    0x2eac(%rip),%ecx
sub    $0x3,%ecx
cmp    %ecx,%eax
jbe    11c2 <addGuessedChars+0xb2>
mov    0x2e9b(%rip),%eax
cvtsi2sd %rax,%xmm0
movsd  0xe66(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %eax,0x2e7f(%rip)
mov    -0x10(%rbp),%rdi
mov    0x2e75(%rip),%eax
shl    $0x0,%rax
mov    %eax,%esi
call   1030 <realloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x5(%rbp),%dl
mov    -0x10(%rbp),%rax
mov    0x2e61(%rip),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    0x2e54(%rip),%ecx
add    $0x1,%ecx
mov    %ecx,%ecx
movb   $0x20,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    0x2e41(%rip),%ecx
add    $0x2,%ecx
mov    %ecx,%ecx
movb   $0x0,(%rax,%rcx,1)
mov    0x2e32(%rip),%eax
add    $0x2,%eax
mov    %eax,0x2e29(%rip)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addGuessedChars>:
push   %rbx
mov    %edi,%ebx
mov    (%rsi),%al
test   %al,%al
je     112f <addGuessedChars+0x1f>
lea    0x1(%rsi),%rcx
nopl   (%rax)
cmp    %bl,%al
je     118f <addGuessedChars+0x7f>
movzbl (%rcx),%eax
add    $0x1,%rcx
test   %al,%al
jne    1120 <addGuessedChars+0x10>
mov    0x2efb(%rip),%eax
mov    0x2eed(%rip),%ecx
lea    -0x3(%rcx),%edx
cmp    %edx,%eax
jbe    116f <addGuessedChars+0x5f>
mov    %ecx,%eax
cvtsi2sd %rax,%xmm0
mulsd  0xeaf(%rip),%xmm0
cvttsd2si %xmm0,%rax
mov    %eax,0x2ecc(%rip)
mov    %rsi,%rdi
mov    %eax,%esi
call   1030 <realloc@plt>
mov    %rax,%rsi
mov    0x2ec1(%rip),%eax
mov    %eax,%ecx
mov    %bl,(%rsi,%rcx,1)
lea    0x1(%rax),%ecx
movb   $0x20,(%rsi,%rcx,1)
add    $0x2,%eax
movb   $0x0,(%rsi,%rax,1)
mov    %eax,0x2ea8(%rip)
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@addGuessedChars.guessedCharsLength = internal global i32 25
@addGuessedChars.guessedCharsUsed = internal global i32 0
define i32 @addGuessedChars(i8 signext %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8*
%6 = alloca i32
store i8 %0, i8* %4
store i8* %1, i8** %5
store i32 0, i32* %6
br label %7
7: ; preds = %26, %2
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %29
15: ; preds = %7
%16 = load i8*, i8** %5
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = load i8, i8* %4
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %21, %23
br i1 %24, label %25, label %26
25: ; preds = %15
store i32 0, i32* %3
br label %63
26: ; preds = %15
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %7
29: ; preds = %7
%30 = load i32, i32* @addGuessedChars.guessedCharsUsed
%31 = load i32, i32* @addGuessedChars.guessedCharsLength
%32 = sub i32 %31, 3
%33 = icmp ugt i32 %30, %32
br i1 %33, label %34, label %45
34: ; preds = %29
%35 = load i32, i32* @addGuessedChars.guessedCharsLength
%36 = uitofp i32 %35 to double
%37 = fmul double %36, 1.500000e+00
%38 = fptoui double %37 to i32
store i32 %38, i32* @addGuessedChars.guessedCharsLength
%39 = load i8*, i8** %5
%40 = load i32, i32* @addGuessedChars.guessedCharsLength
%41 = zext i32 %40 to i64
%42 = mul i64 %41, 1
%43 = trunc i64 %42 to i32
%44 = call i8* @realloc(i8* %39, i32 %43)
store i8* %44, i8** %5
br label %45
45: ; preds = %34, %29
%46 = load i8, i8* %4
%47 = load i8*, i8** %5
%48 = load i32, i32* @addGuessedChars.guessedCharsUsed
%49 = zext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %47, i64 %49
store i8 %46, i8* %50
%51 = load i8*, i8** %5
%52 = load i32, i32* @addGuessedChars.guessedCharsUsed
%53 = add i32 %52, 1
%54 = zext i32 %53 to i64
%55 = getelementptr inbounds i8, i8* %51, i64 %54
store i8 32, i8* %55
%56 = load i8*, i8** %5
%57 = load i32, i32* @addGuessedChars.guessedCharsUsed
%58 = add i32 %57, 2
%59 = zext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %56, i64 %59
store i8 0, i8* %60
%61 = load i32, i32* @addGuessedChars.guessedCharsUsed
%62 = add i32 %61, 2
store i32 %62, i32* @addGuessedChars.guessedCharsUsed
store i32 1, i32* %3
br label %63
63: ; preds = %45, %25
%64 = load i32, i32* %3
ret i32 %64
}

LLVM IR (-O2):
@addGuessedChars.guessedCharsLength = internal unnamed_addr global i32 25
@addGuessedChars.guessedCharsUsed = internal unnamed_addr global i32 0
define i32 @addGuessedChars(i8 signext %0, i8* %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %9
5: ; preds = %9
%6 = getelementptr inbounds i8, i8* %1, i64 %13
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %2, %5
%10 = phi i64 [ %13, %5 ], [ 0, %2 ]
%11 = phi i8 [ %7, %5 ], [ %3, %2 ]
%12 = icmp eq i8 %11, %0
%13 = add nuw i64 %10, 1
br i1 %12, label %36, label %5
14: ; preds = %5, %2
%15 = load i32, i32* @addGuessedChars.guessedCharsUsed
%16 = load i32, i32* @addGuessedChars.guessedCharsLength
%17 = add i32 %16, -3
%18 = icmp ugt i32 %15, %17
br i1 %18, label %19, label %25
19: ; preds = %14
%20 = uitofp i32 %16 to double
%21 = fmul double %20, 1.500000e+00
%22 = fptoui double %21 to i32
store i32 %22, i32* @addGuessedChars.guessedCharsLength
%23 = tail call i8* @realloc(i8* %1, i32 %22)
%24 = load i32, i32* @addGuessedChars.guessedCharsUsed
br label %25
25: ; preds = %19, %14
%26 = phi i32 [ %24, %19 ], [ %15, %14 ]
%27 = phi i8* [ %23, %19 ], [ %1, %14 ]
%28 = zext i32 %26 to i64
%29 = getelementptr inbounds i8, i8* %27, i64 %28
store i8 %0, i8* %29
%30 = add i32 %26, 1
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %27, i64 %31
store i8 32, i8* %32
%33 = add i32 %26, 2
%34 = zext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %27, i64 %34
store i8 0, i8* %35
store i32 %33, i32* @addGuessedChars.guessedCharsUsed
br label %36
36: ; preds = %9, %25
%37 = phi i32 [ 1, %25 ], [ 0, %9 ]
ret i32 %37
}