#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 call_echo(char **, char **);
int /*<<< orphan*/ my_putchar(char);
int /*<<< orphan*/ my_putstr(char *);
int my_echo(char **env, char **s) {
  int n;
  (void)env;
  n = 0;
  if (s[1] == NULL) {
    my_putchar('\n');
    return (1);
  }
  if (call_echo(s, env) == 1) {
    n = 1;
    while (s[n] != NULL) {
      my_putstr(s[n++]);
      my_putchar(' ');
    }
    my_putchar('\n');
  }
  return (0);
}


x86 assembly (clang, -O0):
<my_echo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jne    116c <my_echo+0x3c>
mov    $0xa,%edi
call   1040 <my_putchar@plt>
movl   $0x1,-0x4(%rbp)
jmp    11d7 <my_echo+0xa7>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <call_echo@plt>
cmp    $0x1,%eax
jne    11d0 <my_echo+0xa0>
movl   $0x1,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11c6 <my_echo+0x96>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <my_putstr@plt>
mov    $0x20,%edi
call   1040 <my_putchar@plt>
jmp    1189 <my_echo+0x59>
mov    $0xa,%edi
call   1040 <my_putchar@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_echo>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmpq   $0x0,0x8(%rsi)
je     117d <my_echo+0x4d>
mov    %rdi,%rsi
mov    %rbx,%rdi
call   1030 <call_echo@plt>
xor    %ebp,%ebp
cmp    $0x1,%eax
jne    118c <my_echo+0x5c>
mov    0x8(%rbx),%rdi
xor    %ebp,%ebp
test   %rdi,%rdi
je     1182 <my_echo+0x52>
add    $0x10,%rbx
xchg   %ax,%ax
call   1050 <my_putstr@plt>
mov    $0x20,%edi
call   1040 <my_putchar@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1160 <my_echo+0x30>
jmp    1182 <my_echo+0x52>
mov    $0x1,%ebp
mov    $0xa,%edi
call   1040 <my_putchar@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @my_echo(i8** %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8**
%6 = alloca i32
store i8** %0, i8*** %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %4
store i32 0, i32* %6
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @my_putchar(i8 signext 10)
store i32 1, i32* %3
br label %39
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = load i8**, i8*** %4
%17 = call i32 @call_echo(i8** %15, i8** %16)
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %38
19: ; preds = %14
store i32 1, i32* %6
br label %20
20: ; preds = %27, %19
%21 = load i8**, i8*** %5
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = load i8*, i8** %24
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %36
27: ; preds = %20
%28 = load i8**, i8*** %5
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds i8*, i8** %28, i64 %31
%33 = load i8*, i8** %32
%34 = call i32 @my_putstr(i8* %33)
%35 = call i32 @my_putchar(i8 signext 32)
br label %20
36: ; preds = %20
%37 = call i32 @my_putchar(i8 signext 10)
br label %38
38: ; preds = %36, %14
store i32 0, i32* %3
br label %39
39: ; preds = %38, %12
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
define i32 @my_echo(i8** %0, i8** %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %21, label %6
6: ; preds = %2
%7 = tail call i32 @call_echo(i8** %1, i8** %0)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %24
9: ; preds = %6
%10 = load i8*, i8** %3
%11 = icmp eq i8* %10, null
br i1 %11, label %21, label %12
12: ; preds = %9, %12
%13 = phi i64 [ %15, %12 ], [ 1, %9 ]
%14 = phi i8* [ %19, %12 ], [ %10, %9 ]
%15 = add nuw i64 %13, 1
%16 = tail call i32 @my_putstr(i8* %14)
%17 = tail call i32 @my_putchar(i8 signext 32)
%18 = getelementptr inbounds i8*, i8** %1, i64 %15
%19 = load i8*, i8** %18
%20 = icmp eq i8* %19, null
br i1 %20, label %21, label %12
21: ; preds = %12, %9, %2
%22 = phi i32 [ 1, %2 ], [ 0, %9 ], [ 0, %12 ]
%23 = tail call i32 @my_putchar(i8 signext 10)
br label %24
24: ; preds = %21, %6
%25 = phi i32 [ 0, %6 ], [ %22, %21 ]
ret i32 %25
}