#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*/ exec_and_send(int, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ get_dependencies_fmt(char **);
char *malloc(int const);
int /*<<< orphan*/ snprintf(char *, int const, char *, char *);
int strlen(char *);
void get_dependencies(char *pkg, int clientfd) {
  char *fmt;
  get_dependencies_fmt(&fmt);
  const int len = strlen(fmt) + 1 - 2 + strlen(pkg);
  char *cmd = malloc(len);
  snprintf(cmd, len, fmt, pkg);
  exec_and_send(clientfd, cmd);
  free(cmd);
}


x86 assembly (clang, -O0):
<get_dependencies>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x18(%rbp),%rdi
call   1080 <get_dependencies_fmt@plt>
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
sub    $0x2,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%rcx
call   1050 <snprintf@plt>
mov    -0xc(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1060 <exec_and_send@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_dependencies>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%r15
mov    %rsp,%rdi
call   1080 <get_dependencies_fmt@plt>
mov    (%rsp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1040 <strlen@plt>
add    %eax,%ebp
add    $0xffffffff,%ebp
mov    %ebp,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    (%rsp),%rdx
mov    %rax,%rdi
mov    %ebp,%esi
mov    %r15,%rcx
call   1050 <snprintf@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1060 <exec_and_send@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @get_dependencies(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%8 = call i32 @get_dependencies_fmt(i8** %5)
%9 = load i8*, i8** %5
%10 = call i32 @strlen(i8* %9)
%11 = add nsw i32 %10, 1
%12 = sub nsw i32 %11, 2
%13 = load i8*, i8** %3
%14 = call i32 @strlen(i8* %13)
%15 = add nsw i32 %12, %14
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = call i8* @malloc(i32 %16)
store i8* %17, i8** %7
%18 = load i8*, i8** %7
%19 = load i32, i32* %6
%20 = load i8*, i8** %5
%21 = load i8*, i8** %3
%22 = call i32 @snprintf(i8* %18, i32 %19, i8* %20, i8* %21)
%23 = load i32, i32* %4
%24 = load i8*, i8** %7
%25 = call i32 @exec_and_send(i32 %23, i8* %24)
%26 = load i8*, i8** %7
%27 = call i32 @free(i8* %26)
ret void
}

LLVM IR (-O2):
define void @get_dependencies(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i32 @get_dependencies_fmt(i8** %3)
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
%8 = add nsw i32 %7, -1
%9 = call i32 @strlen(i8* %0)
%10 = add nsw i32 %8, %9
%11 = call i8* @malloc(i32 %10)
%12 = load i8*, i8** %3
%13 = call i32 @snprintf(i8* %11, i32 %10, i8* %12, i8* %0)
%14 = call i32 @exec_and_send(i32 %1, i8* %11)
%15 = call i32 @free(i8* %11)
ret void
}