#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*/ D_Trace(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ sprintf(char *, char *, int, char *);
void stopServ(int TS, char *m, int n) {
  char buf[20];
  perror(m);
  if (TS)
    sprintf(buf, "main_Serv : Erreur %d %s\n", n, m);
  else
    sprintf(buf, "main_Nrpc : Erreur %d %s\n", n, m);
  D_Trace(buf);
  exit(n);
}


x86 assembly (clang, -O0):
<stopServ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <perror@plt>
cmpl   $0x0,-0x4(%rbp)
je     1181 <stopServ+0x41>
lea    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    0xe89(%rip),%rsi
call   1050 <sprintf@plt>
jmp    1198 <stopServ+0x58>
lea    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    0xe87(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x30(%rbp),%rdi
call   1030 <D_Trace@plt>
mov    -0x14(%rbp),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<stopServ>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <perror@plt>
test   %ebp,%ebp
lea    0xeb9(%rip),%rax
lea    0xe98(%rip),%rsi
cmove  %rax,%rsi
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %r14d,%edx
mov    %rbx,%rcx
call   1050 <sprintf@plt>
mov    %rbp,%rdi
call   1030 <D_Trace@plt>
mov    %r14d,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"main_Serv : Erreur %d %s\0A\00"
@.str.1 = [26 x i8] c"main_Nrpc : Erreur %d %s\0A\00"
define void @stopServ(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [20 x i8]
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %5
%9 = call i32 @perror(i8* %8)
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%14 = load i32, i32* %6
%15 = load i8*, i8** %5
%16 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %14, i8* %15)
br label %22
17: ; preds = %3
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%19 = load i32, i32* %6
%20 = load i8*, i8** %5
%21 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %19, i8* %20)
br label %22
22: ; preds = %17, %12
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%24 = call i32 @D_Trace(i8* %23)
%25 = load i32, i32* %6
%26 = call i32 @exit(i32 %25)
unreachable
}

LLVM IR (-O2):
@.str = [26 x i8] c"main_Serv : Erreur %d %s\0A\00"
@.str.1 = [26 x i8] c"main_Nrpc : Erreur %d %s\0A\00"
define void @stopServ(i32 %0, i8* %1, i32 %2) {
%4 = alloca [20 x i8]
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%6 = tail call i32 @perror(i8* %1)
%7 = icmp eq i32 %0, 0
%8 = select i1 %7, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0)
%9 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) %8, i32 %2, i8* %1)
%10 = call i32 @D_Trace(i8* %5)
%11 = call i32 @exit(i32 %2)
unreachable
}