#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*/ errquit(char *);
int /*<<< orphan*/ sprintf(char *, char *, int, char *);
int /*<<< orphan*/ strlen(char *);
int write(int, char *, int /*<<< orphan*/);
void ftp_reply(int fd, int code, char *comment) {
  int nwrite;
  char buf[1024];
  sprintf(buf, "%d %s\r\n", code, comment);
  nwrite = write(fd, buf, strlen(buf));
  if (nwrite == -1)
    errquit(buf);
}


x86 assembly (clang, -O0):
<ftp_reply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    0xe96(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x42c(%rbp)
lea    -0x420(%rbp),%rax
mov    %rax,-0x428(%rbp)
lea    -0x420(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x42c(%rbp),%edi
mov    -0x428(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    11bf <ftp_reply+0x7f>
lea    -0x420(%rbp),%rdi
call   1050 <errquit@plt>
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ftp_reply>:
push   %rbp
push   %rbx
sub    $0x408,%rsp
mov    %rdx,%rcx
mov    %esi,%edx
mov    %edi,%ebp
lea    0xea9(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
cmp    $0xffffffff,%eax
jne    1183 <ftp_reply+0x43>
mov    %rsp,%rdi
call   1050 <errquit@plt>
add    $0x408,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%d %s\0D\0A\00"
define void @ftp_reply(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [1024 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%10 = load i32, i32* %5
%11 = load i8*, i8** %6
%12 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %10, i8* %11)
%13 = load i32, i32* %4
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%16 = call i32 @strlen(i8* %15)
%17 = call i32 @write(i32 %13, i8* %14, i32 %16)
store i32 %17, i32* %7
%18 = load i32, i32* %7
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %23
20: ; preds = %3
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%22 = call i32 @errquit(i8* %21)
br label %23
23: ; preds = %20, %3
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"%d %s\0D\0A\00"
define void @ftp_reply(i32 %0, i32 %1, i8* %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %2)
%7 = call i32 @strlen(i8* %5)
%8 = call i32 @write(i32 %0, i8* %5, i32 %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 @errquit(i8* %5)
br label %12
12: ; preds = %10, %3
ret void
}