#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 _wc_do(int, unsigned int *, unsigned int *, unsigned int *, char *);
int /*<<< orphan*/ _wc_print(int, unsigned int, unsigned int, unsigned int,
                             char *);
int _wc(int flags, int argc, char *argv[]) {
  int ret = 0;
  unsigned int cm = 0;
  unsigned int l = 0;
  unsigned int w = 0;
  int i;
  if (argc == 0)
    return _wc_do(flags, &cm, &l, &w, NULL);
  if (argc == 1)
    return _wc_do(flags, &cm, &l, &w, argv[0]);
  for (i = 0; i < argc; i++)
    ret |= _wc_do(flags, &cm, &l, &w, argv[i]);
  _wc_print(flags, cm, l, w, "total");
  return ret;
}


x86 assembly (clang, -O0):
<_wc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1179 <_wc+0x59>
mov    -0x8(%rbp),%edi
lea    -0x20(%rbp),%rsi
lea    -0x24(%rbp),%rdx
lea    -0x28(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <_wc_do@plt>
mov    %eax,-0x4(%rbp)
jmp    120b <_wc+0xeb>
cmpl   $0x1,-0xc(%rbp)
jne    11a6 <_wc+0x86>
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%r8
lea    -0x20(%rbp),%rsi
lea    -0x24(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1030 <_wc_do@plt>
mov    %eax,-0x4(%rbp)
jmp    120b <_wc+0xeb>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ed <_wc+0xcd>
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%r8
lea    -0x20(%rbp),%rsi
lea    -0x24(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1030 <_wc_do@plt>
or     -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11ad <_wc+0x8d>
mov    -0x8(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
lea    0xe00(%rip),%r8
call   1040 <_wc_print@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_wc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,%r14d
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
test   %esi,%esi
je     116c <_wc+0x4c>
mov    %rdx,%rbx
cmp    $0x1,%esi
jne    118a <_wc+0x6a>
mov    (%rbx),%r8
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
mov    %r14d,%edi
jmp    1181 <_wc+0x61>
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
mov    %r14d,%edi
xor    %r8d,%r8d
call   1030 <_wc_do@plt>
mov    %eax,%ebp
jmp    11e9 <_wc+0xc9>
jl     11d2 <_wc+0xb2>
mov    %esi,%r15d
xor    %r12d,%r12d
lea    0xc(%rsp),%r13
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    (%rbx,%r12,8),%r8
mov    %r14d,%edi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
mov    %r13,%rcx
call   1030 <_wc_do@plt>
or     %eax,%ebp
add    $0x1,%r12
cmp    %r12,%r15
jne    11a0 <_wc+0x80>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
jmp    11da <_wc+0xba>
xor    %ecx,%ecx
xor    %edx,%edx
xor    %esi,%esi
xor    %ebp,%ebp
lea    0xe1f(%rip),%r8
mov    %r14d,%edi
call   1040 <_wc_print@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"total\00"
define i32 @_wc(i32 %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %3
%16 = load i32, i32* %5
%17 = call i32 @_wc_do(i32 %16, i32* %9, i32* %10, i32* %11, i8* null)
store i32 %17, i32* %4
br label %52
18: ; preds = %3
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load i32, i32* %5
%23 = load i8**, i8*** %7
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 @_wc_do(i32 %22, i32* %9, i32* %10, i32* %11, i8* %25)
store i32 %26, i32* %4
br label %52
27: ; preds = %18
store i32 0, i32* %12
br label %28
28: ; preds = %42, %27
%29 = load i32, i32* %12
%30 = load i32, i32* %6
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %45
32: ; preds = %28
%33 = load i32, i32* %5
%34 = load i8**, i8*** %7
%35 = load i32, i32* %12
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = call i32 @_wc_do(i32 %33, i32* %9, i32* %10, i32* %11, i8* %38)
%40 = load i32, i32* %8
%41 = or i32 %40, %39
store i32 %41, i32* %8
br label %42
42: ; preds = %32
%43 = load i32, i32* %12
%44 = add nsw i32 %43, 1
store i32 %44, i32* %12
br label %28
45: ; preds = %28
%46 = load i32, i32* %5
%47 = load i32, i32* %9
%48 = load i32, i32* %10
%49 = load i32, i32* %11
%50 = call i32 @_wc_print(i32 %46, i32 %47, i32 %48, i32 %49, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%51 = load i32, i32* %8
store i32 %51, i32* %4
br label %52
52: ; preds = %45, %21, %15
%53 = load i32, i32* %4
ret i32 %53
}

LLVM IR (-O2):
@.str = [6 x i8] c"total\00"
define i32 @_wc(i32 %0, i32 %1, i8** nocapture %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%8 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%9 = bitcast i32* %6 to i8*
store i32 0, i32* %6
switch i32 %1, label %10 [
i32 0, label %14
i32 1, label %16
]
10: ; preds = %3
%11 = icmp sgt i32 %1, 0
br i1 %11, label %12, label %32
12: ; preds = %10
%13 = zext i32 %1 to i64
br label %19
14: ; preds = %3
%15 = call i32 @_wc_do(i32 %0, i32* %4, i32* %5, i32* %6, i8* null)
br label %38
16: ; preds = %3
%17 = load i8*, i8** %2
%18 = call i32 @_wc_do(i32 %0, i32* %4, i32* %5, i32* %6, i8* %17)
br label %38
19: ; preds = %12, %19
%20 = phi i64 [ 0, %12 ], [ %26, %19 ]
%21 = phi i32 [ 0, %12 ], [ %25, %19 ]
%22 = getelementptr inbounds i8*, i8** %2, i64 %20
%23 = load i8*, i8** %22
%24 = call i32 @_wc_do(i32 %0, i32* %4, i32* %5, i32* %6, i8* %23)
%25 = or i32 %24, %21
%26 = add nuw nsw i64 %20, 1
%27 = icmp eq i64 %26, %13
br i1 %27, label %28, label %19
28: ; preds = %19
%29 = load i32, i32* %4
%30 = load i32, i32* %5
%31 = load i32, i32* %6
br label %32
32: ; preds = %28, %10
%33 = phi i32 [ 0, %10 ], [ %31, %28 ]
%34 = phi i32 [ 0, %10 ], [ %30, %28 ]
%35 = phi i32 [ 0, %10 ], [ %29, %28 ]
%36 = phi i32 [ 0, %10 ], [ %25, %28 ]
%37 = call i32 @_wc_print(i32 %0, i32 %35, i32 %34, i32 %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %38
38: ; preds = %32, %16, %14
%39 = phi i32 [ %15, %14 ], [ %18, %16 ], [ %36, %32 ]
ret i32 %39
}