#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ memset(char **, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ read(int, char *, int);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
int smtp_parseResponse(int socket, int showResult) {
  char buf[1024];
  memset(&buf, 0, 1024);
  read(socket, buf, 1024);
  if (buf[0] == '5') {
    fprintf(stderr, "%s\n", strchr(buf, ' '));
    exit(EXIT_FAILURE);
  }
  if (showResult != 0) {
    printf("%s\n", strchr(buf, ' '));
  }
}


x86 assembly (clang, -O0):
<smtp_parseResponse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
mov    -0x8(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
call   1060 <read@plt>
movsbl -0x410(%rbp),%eax
cmp    $0x35,%eax
jne    11eb <smtp_parseResponse+0x8b>
mov    0x2e31(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x414(%rbp)
lea    -0x410(%rbp),%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
mov    -0x414(%rbp),%edi
mov    %rax,%rdx
lea    0xe28(%rip),%rsi
call   1070 <fprintf@plt>
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
cmpl   $0x0,-0xc(%rbp)
je     1215 <smtp_parseResponse+0xb5>
lea    -0x410(%rbp),%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
mov    %rax,%rsi
lea    0xdf0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smtp_parseResponse>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1050 <memset@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x400,%edx
call   1060 <read@plt>
cmpb   $0x35,(%rsp)
je     11c2 <smtp_parseResponse+0x62>
test   %ebx,%ebx
je     11b6 <smtp_parseResponse+0x56>
mov    %rsp,%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
lea    0xe52(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2e17(%rip),%rax
mov    (%rax),%ebx
mov    %rsp,%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
lea    0xe21(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1070 <fprintf@plt>
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @smtp_parseResponse(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [1024 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = bitcast [1024 x i8]* %6 to i8**
%8 = call i32 @memset(i8** %7, i32 0, i32 1024)
%9 = load i32, i32* %4
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%11 = call i32 @read(i32 %9, i8* %10, i32 1024)
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 53
br i1 %15, label %16, label %23
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%19 = call i8* @strchr(i8* %18, i8 signext 32)
%20 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @exit(i32 %21)
unreachable
23: ; preds = %2
%24 = load i32, i32* %5
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%28 = call i8* @strchr(i8* %27, i8 signext 32)
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %28)
br label %30
30: ; preds = %26, %23
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @smtp_parseResponse(i32 %0, i32 %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = bitcast [1024 x i8]* %3 to i8**
%6 = call i32 @memset(i8** %5, i32 0, i32 1024)
%7 = call i32 @read(i32 %0, i8* %4, i32 1024)
%8 = load i8, i8* %4
%9 = icmp eq i8 %8, 53
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = call i8* @strchr(i8* %4, i8 signext 32)
%13 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %2
%17 = icmp eq i32 %1, 0
br i1 %17, label %21, label %18
18: ; preds = %16
%19 = call i8* @strchr(i8* %4, i8 signext 32)
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %18, %16
ret i32 undef
}