#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};
typedef scalar_t__ pid_t;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ SIGKILL;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
scalar_t__ getpid();
int kill(scalar_t__, int /*<<< orphan*/);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdout;
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int kill_childs(pid_t *childs_id) {
  int exit_status = EXIT_SUCCESS;
  for (pid_t *iterator = childs_id; *iterator; iterator++) {
    if (kill(*iterator, SIGKILL) == -1) {
      {
        char __tb[101];
        time_t t = time(NULL);
        struct tm *tmp = localtime(&t);
        strftime(__tb, 100, "%d/%m/%Y %H:%M:%S ", tmp);
        printf("%s [pid=%d]", __tb, (int)getpid());
        printf("\x1b[31m");
        printf(" ERROR! ");
        printf("\x1b[0m");
        printf("process with id=%d was not killed correctly", (int)(*iterator));
        printf(" (%s)\n", strerror(errno));
        fflush(stdout);
      };
      exit_status = EXIT_FAILURE;
    } else {
      ;
      ;
    }
  }
  return exit_status;
}


x86 assembly (clang, -O0):
<kill_childs>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e2a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     12d0 <kill_childs+0x150>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    0x2e11(%rip),%rax
mov    (%rax),%esi
call   1060 <kill@plt>
cmp    $0xffffffff,%eax
jne    12b5 <kill_childs+0x135>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,-0x84(%rbp)
lea    -0x84(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x90(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x90(%rbp),%rcx
mov    $0x64,%esi
lea    0xdf8(%rip),%rdx
call   1090 <strftime@plt>
lea    -0x80(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x98(%rbp),%rsi
mov    %eax,%edx
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdd5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %eax,%esi
lea    0xdc3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2d62(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    %rax,%rsi
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2d2b(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    0x2d2d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
jmp    12ba <kill_childs+0x13a>
jmp    12ba <kill_childs+0x13a>
jmp    12bf <kill_childs+0x13f>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
jmp    11a3 <kill_childs+0x23>
mov    -0xc(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kill_childs>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rdi,%rbx
mov    0x2e28(%rip),%rax
mov    (%rax),%r14d
mov    (%rdi),%rdi
test   %rdi,%rdi
je     12a0 <kill_childs+0x120>
add    $0x8,%rbx
mov    0x2e1e(%rip),%r15
lea    0x10(%rsp),%r12
lea    0xea1(%rip),%rbp
mov    0x2e13(%rip),%r13
jmp    11e0 <kill_childs+0x60>
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
je     12a0 <kill_childs+0x120>
mov    (%r15),%esi
call   1060 <kill@plt>
cmp    $0xffffffff,%eax
jne    11d0 <kill_childs+0x50>
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %r12,%rdi
mov    $0x64,%esi
lea    0xdef(%rip),%rdx
mov    %rax,%rcx
call   1090 <strftime@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xdec(%rip),%rdi
mov    %r12,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xde5(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xddd(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdd8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x8(%rbx),%esi
lea    0xdcc(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
call   10a0 <strerror@plt>
mov    %rbp,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2d38(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    0x0(%r13),%r14d
jmp    11d0 <kill_childs+0x50>
mov    %r14d,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@EXIT_SUCCESS = global i32 0
@SIGKILL = global i32 0
@.str = [19 x i8] c"%d/%m/%Y %H:%M:%S \00"
@.str.1 = [12 x i8] c"%s [pid=%d]\00"
@.str.2 = [6 x i8] c"\1B[31m\00"
@.str.3 = [9 x i8] c" ERROR! \00"
@.str.4 = [5 x i8] c"\1B[0m\00"
@.str.5 = [44 x i8] c"process with id=%d was not killed correctly\00"
@.str.6 = [7 x i8] c" (%s)\0A\00"
@errno = global i32 0
@stdout = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @kill_childs(i64* %0) {
%2 = alloca i64*
%3 = alloca i32
%4 = alloca i64*
%5 = alloca [101 x i8]
%6 = alloca i32
%7 = alloca %struct.tm*
store i64* %0, i64** %2
%8 = load i32, i32* @EXIT_SUCCESS
store i32 %8, i32* %3
%9 = load i64*, i64** %2
store i64* %9, i64** %4
br label %10
10: ; preds = %45, %1
%11 = load i64*, i64** %4
%12 = load i64, i64* %11
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %48
14: ; preds = %10
%15 = load i64*, i64** %4
%16 = load i64, i64* %15
%17 = load i32, i32* @SIGKILL
%18 = call i32 @kill(i64 %16, i32 %17)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %43
20: ; preds = %14
%21 = call i32 @time(i32* null)
store i32 %21, i32* %6
%22 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %22, %struct.tm** %7
%23 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 0
%24 = load %struct.tm*, %struct.tm** %7
%25 = call i32 @strftime(i8* %23, i32 100, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), %struct.tm* %24)
%26 = getelementptr inbounds [101 x i8], [101 x i8]* %5, i64 0, i64 0
%27 = call i64 (...) @getpid()
%28 = trunc i64 %27 to i32
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %26, i32 %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%33 = load i64*, i64** %4
%34 = load i64, i64* %33
%35 = trunc i64 %34 to i32
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i32 %35)
%37 = load i32, i32* @errno
%38 = call i8* @strerror(i32 %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %38)
%40 = load i32, i32* @stdout
%41 = call i32 @fflush(i32 %40)
%42 = load i32, i32* @EXIT_FAILURE
store i32 %42, i32* %3
br label %44
43: ; preds = %14
br label %44
44: ; preds = %43, %20
br label %45
45: ; preds = %44
%46 = load i64*, i64** %4
%47 = getelementptr inbounds i64, i64* %46, i32 1
store i64* %47, i64** %4
br label %10
48: ; preds = %10
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@EXIT_SUCCESS = global i32 0
@SIGKILL = global i32 0
@.str = [19 x i8] c"%d/%m/%Y %H:%M:%S \00"
@.str.1 = [12 x i8] c"%s [pid=%d]\00"
@.str.2 = [6 x i8] c"\1B[31m\00"
@.str.3 = [9 x i8] c" ERROR! \00"
@.str.4 = [5 x i8] c"\1B[0m\00"
@.str.5 = [44 x i8] c"process with id=%d was not killed correctly\00"
@.str.6 = [7 x i8] c" (%s)\0A\00"
@errno = global i32 0
@stdout = global i32 0
@EXIT_FAILURE = global i32 0
define i32 @kill_childs(i64* nocapture %0) {
%2 = alloca [101 x i8]
%3 = alloca i32
%4 = load i32, i32* @EXIT_SUCCESS
%5 = load i64, i64* %0
%6 = icmp eq i64 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%9 = bitcast i32* %3 to i8*
br label %12
10: ; preds = %38, %1
%11 = phi i32 [ %4, %1 ], [ %39, %38 ]
ret i32 %11
12: ; preds = %7, %38
%13 = phi i64 [ %5, %7 ], [ %41, %38 ]
%14 = phi i32 [ %4, %7 ], [ %39, %38 ]
%15 = phi i64* [ %0, %7 ], [ %40, %38 ]
%16 = load i32, i32* @SIGKILL
%17 = call i32 @kill(i64 %13, i32 %16)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %38
19: ; preds = %12
%20 = call i32 @time(i32* null)
store i32 %20, i32* %3
%21 = call %struct.tm* @localtime(i32* %3)
%22 = call i32 @strftime(i8* %8, i32 100, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), %struct.tm* %21)
%23 = call i64 (...) @getpid()
%24 = trunc i64 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %8, i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%29 = load i64, i64* %15
%30 = trunc i64 %29 to i32
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i32 %30)
%32 = load i32, i32* @errno
%33 = call i8* @strerror(i32 %32)
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %33)
%35 = load i32, i32* @stdout
%36 = call i32 @fflush(i32 %35)
%37 = load i32, i32* @EXIT_FAILURE
br label %38
38: ; preds = %19, %12
%39 = phi i32 [ %37, %19 ], [ %14, %12 ]
%40 = getelementptr inbounds i64, i64* %15, i64 1
%41 = load i64, i64* %40
%42 = icmp eq i64 %41, 0
br i1 %42, label %10, label %12
}