#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*/ printf(char *);
void addslave(int *slave) {
  printf("A prisoner stands before you.\n'Thanks! Thanks so much! Because you "
         "freed me, I will help in a battle!'\n");
  int i;
  for (i = 0; i < 10; i++) {
    if (*(slave + i) == 0)
      *(slave + i) = 1;
    return;
  }
  printf("'...but it seems that your group is too much large and there isn't a "
         "place for me.'");
}


x86 assembly (clang, -O0):
<addslave>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    115f <addslave+0x4f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    115a <addslave+0x4a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    116b <addslave+0x5b>
lea    0xf02(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addslave>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,(%rbx)
je     1127 <addslave+0x17>
pop    %rbx
ret
movl   $0x1,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
@.str = [104 x i8] c"A prisoner stands before you.\0A'Thanks! Thanks so much! Because you freed me, I will help in a battle!'\0A\00"
@.str.1 = [84 x i8] c"'...but it seems that your group is too much large and there isn't a place for me.'\00"
define void @addslave(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %5
5: ; preds = %21, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %24
8: ; preds = %5
%9 = load i32*, i32** %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %9, i64 %11
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %8
%16 = load i32*, i32** %2
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
store i32 1, i32* %19
br label %20
20: ; preds = %15, %8
br label %26
21: ; No predecessors!
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %5
24: ; preds = %5
%25 = call i32 @printf(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %24, %20
ret void
}

LLVM IR (-O2):
@str = [103 x i8] c"A prisoner stands before you.\0A'Thanks! Thanks so much! Because you freed me, I will help in a battle!'\00"
define void @addslave(i32* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([103 x i8], [103 x i8]* @str, i64 0, i64 0))
%3 = load i32, i32* %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
store i32 1, i32* %0
br label %6
6: ; preds = %1, %5
ret void
}