#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int resmx(char *);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
int main(int argc, char **argv) {
  if (argc > 1) {
    char *ch = strchr(argv[1], '@');
    if (!ch) {
      fprintf(stderr, "TODO: SMTP protocol not yet implemented\n");
    } else
      return resmx(ch + 1);
  } else
    printf("Usage: dmc-smtp [user@domain]	 # Get MX for domain\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11b5 <main+0x75>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x40,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    119b <main+0x5b>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
lea    0xe6f(%rip),%rsi
call   1050 <fprintf@plt>
jmp    11b0 <main+0x70>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1060 <resmx@plt>
mov    %eax,-0x4(%rbp)
jmp    11c8 <main+0x88>
jmp    11c1 <main+0x81>
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jl     1166 <main+0x26>
mov    0x8(%rsi),%rdi
mov    $0x40,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1174 <main+0x34>
add    $0x1,%rax
mov    %rax,%rdi
pop    %rax
jmp    1060 <resmx@plt>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
jmp    1189 <main+0x49>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xe7c(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [41 x i8] c"TODO: SMTP protocol not yet implemented\0A\00"
@.str.1 = [52 x i8] c"Usage: dmc-smtp [user@domain]\09 # Get MX for domain\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %24
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i8* @strchr(i8* %12, i8 signext 64)
store i8* %13, i8** %6
%14 = load i8*, i8** %6
%15 = icmp ne i8* %14, null
br i1 %15, label %19, label %16
16: ; preds = %9
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %23
19: ; preds = %9
%20 = load i8*, i8** %6
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = call i32 @resmx(i8* %21)
store i32 %22, i32* %3
br label %27
23: ; preds = %16
br label %26
24: ; preds = %2
%25 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %24, %23
store i32 0, i32* %3
br label %27
27: ; preds = %26, %19
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [41 x i8] c"TODO: SMTP protocol not yet implemented\0A\00"
@str = [51 x i8] c"Usage: dmc-smtp [user@domain]\09 # Get MX for domain\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i8* @strchr(i8* dereferenceable(1) %6, i8 signext 64)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %17
12: ; preds = %4
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = tail call i32 @resmx(i8* %13)
br label %17
15: ; preds = %2
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
br label %17
17: ; preds = %15, %9, %12
%18 = phi i32 [ %14, %12 ], [ 0, %9 ], [ 0, %15 ]
ret i32 %18
}