#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 creerSegment(int, char *, int);
int /*<<< orphan*/ detruitSegment(int);
int /*<<< orphan*/ exit(int);
int fork();
int getpid();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
char *shmat(int, int /*<<< orphan*/, int);
int shmdt(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ wait(int /*<<< orphan*/);
int main(void) {
  int pid;
  char *mem;
  int shmid;
  int flag = 0;
  char *name;
  name = "WrongSharedMemory.c";
  shmid = creerSegment(100, name, 1);
  switch (pid = fork()) {
  case -1: {
    perror("impossible de creer un fils");
    return -1;
  }
  case 0: {
    printf("Salut, je suis le fils %d\n", getpid());
    printf("Je commence par m'attacher le segment de memoire\n");
    mem = shmat(shmid, 0, flag);
    if (mem == (char *)-1) {
      perror("attachement impossible");
      exit(1);
    }
    printf("je vais ecrire un message que papa va afficher\n");
    strcpy(mem, "La vie est belle");
    printf("Bon, c'est pas tout ca mais il est temps de mourir\n");
    printf("avant tout detachons le segment partage\n");
    if (shmdt(mem) == -1) {
      perror("detachement impossible");
      exit(1);
    }
    printf("maintenant que c'est fait, bye bye\n");
    printf("Le fils se suicide\n");
    return 1;
  }
  default: {
    printf("Je suis le pere\n");
    printf("Je commence par m'attacher le segment de memoire\n");
    mem = shmat(shmid, 0, flag);
    if (mem == (char *)-1) {
      perror("attachement impossible");
      exit(1);
    }
    printf("je vais afficher un message que mon fils a ecrit\n");
    printf("%s\n", mem);
    printf("Sacre plaisantin ce fiston\n");
    printf("Bon, c'est pas tout ca mais il est temps de mourir\n");
    printf("avant tout detachons le segment partage");
    if (shmdt(mem) == -1) {
      perror("detachement impossible");
      exit(1);
    }
  }
  }
  printf("Le pere attend la mort de son fils\n");
  wait(0);
  printf("Bon, faisons le menage et supprimons le segment partagee\n");
  detruitSegment(shmid);
  printf("Le pere se suicide\n");
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe33(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
mov    $0x64,%edi
mov    $0x1,%edx
call   1070 <creerSegment@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
call   10d0 <fork@plt>
mov    %eax,-0x8(%rbp)
mov    %eax,%ecx
mov    %ecx,-0x24(%rbp)
sub    $0xffffffff,%eax
je     1214 <main+0x64>
jmp    1204 <main+0x54>
mov    -0x24(%rbp),%eax
test   %eax,%eax
je     122c <main+0x7c>
jmp    1313 <main+0x163>
lea    0xdf9(%rip),%rdi
call   1080 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    141e <main+0x26e>
mov    $0x0,%al
call   1050 <getpid@plt>
mov    %eax,%esi
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe01(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%edx
xor    %esi,%esi
call   1090 <shmat@plt>
mov    %rax,-0x10(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    %rax,-0x10(%rbp)
jne    1289 <main+0xd9>
lea    0xe03(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xe22(%rip),%rsi
call   1030 <strcpy@plt>
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <shmdt@plt>
cmp    $0xffffffff,%eax
jne    12eb <main+0x13b>
lea    0xe56(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    141e <main+0x26e>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd23(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%edx
xor    %esi,%esi
call   1090 <shmat@plt>
mov    %rax,-0x10(%rbp)
mov    $0xffffffffffffffff,%rax
cmp    %rax,-0x10(%rbp)
jne    1367 <main+0x1b7>
lea    0xd25(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xd39(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <shmdt@plt>
cmp    $0xffffffff,%eax
jne    13d9 <main+0x229>
lea    0xd68(%rip),%rdi
call   1080 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
jmp    13de <main+0x22e>
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
call   10c0 <wait@plt>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
call   10b0 <detruitSegment@plt>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xe36(%rip),%rsi
mov    $0x64,%edi
mov    $0x1,%edx
call   1080 <creerSegment@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   10e0 <fork@plt>
test   %eax,%eax
je     12a0 <main+0xe0>
cmp    $0xffffffff,%eax
je     133b <main+0x17b>
lea    0xf1d(%rip),%rdi
call   1040 <puts@plt>
lea    0xf21(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10a0 <shmat@plt>
cmp    $0xffffffffffffffff,%rax
je     134e <main+0x18e>
mov    %rax,%rbx
lea    0xf2e(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
lea    0xf4b(%rip),%rdi
call   1040 <puts@plt>
lea    0xf5a(%rip),%rdi
call   1040 <puts@plt>
lea    0xe63(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,%rdi
call   1050 <shmdt@plt>
cmp    $0xffffffff,%eax
je     1357 <main+0x197>
lea    0xf62(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   10d0 <wait@plt>
lea    0xf72(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%edi
call   10c0 <detruitSegment@plt>
lea    0xf98(%rip),%rdi
jmp    132a <main+0x16a>
xor    %eax,%eax
call   1060 <getpid@plt>
lea    0xd82(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe69(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10a0 <shmat@plt>
cmp    $0xffffffffffffffff,%rax
je     134e <main+0x18e>
mov    %rax,%rbx
lea    0xdac(%rip),%rdi
call   1040 <puts@plt>
lea    0xd78(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xeab(%rip),%rdi
call   1040 <puts@plt>
lea    0xdb4(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <shmdt@plt>
cmp    $0xffffffff,%eax
je     1357 <main+0x197>
lea    0xdc3(%rip),%rdi
call   1040 <puts@plt>
lea    0xdda(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xcd2(%rip),%rdi
call   1090 <perror@plt>
mov    $0xffffffff,%eax
jmp    1334 <main+0x174>
lea    0xcf6(%rip),%rdi
jmp    135e <main+0x19e>
lea    0xd15(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"WrongSharedMemory.c\00"
@.str.1 = [28 x i8] c"impossible de creer un fils\00"
@.str.2 = [27 x i8] c"Salut, je suis le fils %d\0A\00"
@.str.3 = [50 x i8] c"Je commence par m'attacher le segment de memoire\0A\00"
@.str.4 = [23 x i8] c"attachement impossible\00"
@.str.5 = [48 x i8] c"je vais ecrire un message que papa va afficher\0A\00"
@.str.6 = [17 x i8] c"La vie est belle\00"
@.str.7 = [52 x i8] c"Bon, c'est pas tout ca mais il est temps de mourir\0A\00"
@.str.8 = [41 x i8] c"avant tout detachons le segment partage\0A\00"
@.str.9 = [23 x i8] c"detachement impossible\00"
@.str.10 = [36 x i8] c"maintenant que c'est fait, bye bye\0A\00"
@.str.11 = [20 x i8] c"Le fils se suicide\0A\00"
@.str.12 = [17 x i8] c"Je suis le pere\0A\00"
@.str.13 = [50 x i8] c"je vais afficher un message que mon fils a ecrit\0A\00"
@.str.14 = [4 x i8] c"%s\0A\00"
@.str.15 = [28 x i8] c"Sacre plaisantin ce fiston\0A\00"
@.str.16 = [40 x i8] c"avant tout detachons le segment partage\00"
@.str.17 = [36 x i8] c"Le pere attend la mort de son fils\0A\00"
@.str.18 = [58 x i8] c"Bon, faisons le menage et supprimons le segment partagee\0A\00"
@.str.19 = [20 x i8] c"Le pere se suicide\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 0, i32* %1
store i32 0, i32* %5
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = load i8*, i8** %6
%8 = call i32 @creerSegment(i32 100, i8* %7, i32 1)
store i32 %8, i32* %4
%9 = call i32 (...) @fork()
store i32 %9, i32* %2
switch i32 %9, label %39 [
i32 -1, label %10
i32 0, label %12
]
10: ; preds = %0
%11 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %1
br label %71
12: ; preds = %0
%13 = call i32 (...) @getpid()
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
%16 = load i32, i32* %4
%17 = load i32, i32* %5
%18 = call i8* @shmat(i32 %16, i32 0, i32 %17)
store i8* %18, i8** %3
%19 = load i8*, i8** %3
%20 = icmp eq i8* %19, inttoptr (i64 -1 to i8*)
br i1 %20, label %21, label %24
21: ; preds = %12
%22 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %12
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0))
%26 = load i8*, i8** %3
%27 = call i32 @strcpy(i8* %26, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0))
%30 = load i8*, i8** %3
%31 = call i32 @shmdt(i8* %30)
%32 = icmp eq i32 %31, -1
br i1 %32, label %33, label %36
33: ; preds = %24
%34 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %24
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.10, i64 0, i64 0))
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.11, i64 0, i64 0))
store i32 1, i32* %1
br label %71
39: ; preds = %0
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0))
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
%42 = load i32, i32* %4
%43 = load i32, i32* %5
%44 = call i8* @shmat(i32 %42, i32 0, i32 %43)
store i8* %44, i8** %3
%45 = load i8*, i8** %3
%46 = icmp eq i8* %45, inttoptr (i64 -1 to i8*)
br i1 %46, label %47, label %50
47: ; preds = %39
%48 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %39
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.13, i64 0, i64 0))
%52 = load i8*, i8** %3
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i8* %52)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.15, i64 0, i64 0))
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0))
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.16, i64 0, i64 0))
%57 = load i8*, i8** %3
%58 = call i32 @shmdt(i8* %57)
%59 = icmp eq i32 %58, -1
br i1 %59, label %60, label %63
60: ; preds = %50
%61 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%62 = call i32 @exit(i32 1)
unreachable
63: ; preds = %50
br label %64
64: ; preds = %63
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.17, i64 0, i64 0))
%66 = call i32 @wait(i32 0)
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.18, i64 0, i64 0))
%68 = load i32, i32* %4
%69 = call i32 @detruitSegment(i32 %68)
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.19, i64 0, i64 0))
store i32 1, i32* %1
br label %71
71: ; preds = %64, %36, %10
%72 = load i32, i32* %1
ret i32 %72
}

LLVM IR (-O2):
@.str = [20 x i8] c"WrongSharedMemory.c\00"
@.str.1 = [28 x i8] c"impossible de creer un fils\00"
@.str.2 = [27 x i8] c"Salut, je suis le fils %d\0A\00"
@.str.4 = [23 x i8] c"attachement impossible\00"
@.str.6 = [17 x i8] c"La vie est belle\00"
@.str.9 = [23 x i8] c"detachement impossible\00"
@str.20 = [47 x i8] c"je vais ecrire un message que papa va afficher\00"
@str.22 = [40 x i8] c"avant tout detachons le segment partage\00"
@str.23 = [35 x i8] c"maintenant que c'est fait, bye bye\00"
@str.24 = [19 x i8] c"Le fils se suicide\00"
@str.25 = [16 x i8] c"Je suis le pere\00"
@str.26 = [49 x i8] c"Je commence par m'attacher le segment de memoire\00"
@str.27 = [49 x i8] c"je vais afficher un message que mon fils a ecrit\00"
@str.28 = [27 x i8] c"Sacre plaisantin ce fiston\00"
@str.29 = [51 x i8] c"Bon, c'est pas tout ca mais il est temps de mourir\00"
@str.30 = [35 x i8] c"Le pere attend la mort de son fils\00"
@str.31 = [57 x i8] c"Bon, faisons le menage et supprimons le segment partagee\00"
@str.32 = [19 x i8] c"Le pere se suicide\00"
define i32 @main() {
%1 = tail call i32 @creerSegment(i32 100, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 (...) @fork()
switch i32 %2, label %27 [
i32 -1, label %3
i32 0, label %5
]
3: ; preds = %0
%4 = tail call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
br label %52
5: ; preds = %0
%6 = tail call i32 (...) @getpid()
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.26, i64 0, i64 0))
%9 = tail call i8* @shmat(i32 %1, i32 0, i32 0)
%10 = icmp eq i8* %9, inttoptr (i64 -1 to i8*)
br i1 %10, label %11, label %14
11: ; preds = %5
%12 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %5
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.20, i64 0, i64 0))
%16 = tail call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0))
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.29, i64 0, i64 0))
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.22, i64 0, i64 0))
%19 = tail call i32 @shmdt(i8* %9)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %24
21: ; preds = %14
%22 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %14
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.23, i64 0, i64 0))
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.24, i64 0, i64 0))
br label %52
27: ; preds = %0
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.25, i64 0, i64 0))
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.26, i64 0, i64 0))
%30 = tail call i8* @shmat(i32 %1, i32 0, i32 0)
%31 = icmp eq i8* %30, inttoptr (i64 -1 to i8*)
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%34 = tail call i32 @exit(i32 1)
unreachable
35: ; preds = %27
%36 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.27, i64 0, i64 0))
%37 = tail call i32 @puts(i8* dereferenceable(1) %30)
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.28, i64 0, i64 0))
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.29, i64 0, i64 0))
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.22, i64 0, i64 0))
%41 = tail call i32 @shmdt(i8* %30)
%42 = icmp eq i32 %41, -1
br i1 %42, label %43, label %46
43: ; preds = %35
%44 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
%45 = tail call i32 @exit(i32 1)
unreachable
46: ; preds = %35
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.30, i64 0, i64 0))
%48 = tail call i32 @wait(i32 0)
%49 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.31, i64 0, i64 0))
%50 = tail call i32 @detruitSegment(i32 %1)
%51 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.32, i64 0, i64 0))
br label %52
52: ; preds = %46, %24, %3
%53 = phi i32 [ 1, %46 ], [ 1, %24 ], [ -1, %3 ]
ret i32 %53
}