#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 ft_strlen(char *);
int /*<<< orphan*/ write(int, char *, int);
int arg_error(int ac, char **av) {
  if (ac != 1) {
    write(1, "Problem with ", 13);
    write(1, av[1], ft_strlen(av[1]));
    write(1, "\n42sh cannot work with arguments.\n", 34);
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<arg_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     119a <arg_error+0x7a>
mov    $0x1,%edi
lea    0xebb(%rip),%rsi
mov    $0xd,%edx
call   1030 <write@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <ft_strlen@plt>
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
mov    $0x1,%edi
lea    0xe8a(%rip),%rsi
mov    $0x22,%edx
call   1030 <write@plt>
movl   $0x1,-0x4(%rbp)
jmp    11a1 <arg_error+0x81>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arg_error>:
push   %rbp
push   %r14
push   %rbx
xor    %ebp,%ebp
cmp    $0x1,%edi
je     117a <arg_error+0x5a>
mov    %rsi,%r14
lea    0xecb(%rip),%rsi
mov    $0x1,%ebp
mov    $0x1,%edi
mov    $0xd,%edx
call   1030 <write@plt>
mov    0x8(%r14),%rbx
mov    %rbx,%rdi
call   1040 <ft_strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xea3(%rip),%rsi
mov    $0x1,%edi
mov    $0x22,%edx
call   1030 <write@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Problem with \00"
@.str.1 = [35 x i8] c"\0A42sh cannot work with arguments.\0A\00"
define i32 @arg_error(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 1
br i1 %7, label %8, label %19
8: ; preds = %2
%9 = call i32 @write(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 13)
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @ft_strlen(i8* %15)
%17 = call i32 @write(i32 1, i8* %12, i32 %16)
%18 = call i32 @write(i32 1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 34)
store i32 1, i32* %3
br label %20
19: ; preds = %2
store i32 0, i32* %3
br label %20
20: ; preds = %19, %8
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@.str = [14 x i8] c"Problem with \00"
@.str.1 = [35 x i8] c"\0A42sh cannot work with arguments.\0A\00"
define i32 @arg_error(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 13)
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @ft_strlen(i8* %7)
%9 = tail call i32 @write(i32 1, i8* %7, i32 %8)
%10 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i32 34)
br label %11
11: ; preds = %2, %4
%12 = phi i32 [ 1, %4 ], [ 0, %2 ]
ret i32 %12
}