#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*/ strncat(char *, char *, int);
const char *showarg(int has_arg) {
  static char str[6 + 1] = {0};
  str[0] = 0;
  if (has_arg > 0) {
    strncat(str, " ", 6);
    if (has_arg > 1) {
      strncat(str, "[", 6);
    }
    strncat(str, "arg", 6);
    if (has_arg > 1) {
      strncat(str, "]", 6);
    }
  }
  return str;
}


x86 assembly (clang, -O0):
<showarg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x0,0x2f07(%rip)
cmpl   $0x0,-0x4(%rbp)
jle    11a5 <showarg+0x95>
lea    0x2ef6(%rip),%rdi
lea    0xec6(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncat@plt>
cmpl   $0x1,-0x4(%rbp)
jle    1166 <showarg+0x56>
lea    0x2ed4(%rip),%rdi
lea    0xea6(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncat@plt>
lea    0x2ebc(%rip),%rdi
lea    0xe90(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncat@plt>
cmpl   $0x1,-0x4(%rbp)
jle    11a0 <showarg+0x90>
lea    0x2e9a(%rip),%rdi
lea    0xe72(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncat@plt>
jmp    11a5 <showarg+0x95>
lea    0x2e7d(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showarg>:
push   %rbx
movb   $0x0,0x2f11(%rip)
test   %edi,%edi
jle    118b <showarg+0x7b>
mov    %edi,%ebx
lea    0x2f04(%rip),%rdi
lea    0xed4(%rip),%rsi
mov    $0x6,%edx
call   1030 <strncat@plt>
cmp    $0x1,%ebx
jne    1144 <showarg+0x34>
lea    0xec2(%rip),%rsi
jmp    117a <showarg+0x6a>
lea    0x2ede(%rip),%rbx
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1030 <strncat@plt>
lea    0xe9e(%rip),%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1030 <strncat@plt>
lea    0xe8e(%rip),%rsi
lea    0x2ea8(%rip),%rdi
mov    $0x6,%edx
call   1030 <strncat@plt>
lea    0x2e97(%rip),%rax
pop    %rbx
ret

LLVM IR (-O0):
@showarg.str = internal global [7 x i8] zeroinitializer
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"[\00"
@.str.2 = [4 x i8] c"arg\00"
@.str.3 = [2 x i8] c"]\00"
define i8* @showarg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
store i8 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @showarg.str, i64 0, i64 0)
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %18
5: ; preds = %1
%6 = call i32 @strncat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @showarg.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 6)
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = call i32 @strncat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @showarg.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 6)
br label %11
11: ; preds = %9, %5
%12 = call i32 @strncat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @showarg.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 6)
%13 = load i32, i32* %2
%14 = icmp sgt i32 %13, 1
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 @strncat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @showarg.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 6)
br label %17
17: ; preds = %15, %11
br label %18
18: ; preds = %17, %1
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @showarg.str, i64 0, i64 0)
}

LLVM IR (-O2):
@showarg.str = internal global [7 x i8] zeroinitializer
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c"[\00"
@.str.2 = [4 x i8] c"arg\00"
@.str.3 = [2 x i8] c"]\00"
define i8* @showarg(i32 %0) {
store i8 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @showarg.str, i64 0, i64 0)
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %12
3: ; preds = %1
%4 = tail call i32 @strncat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @showarg.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 6)
%5 = icmp eq i32 %0, 1
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 @strncat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @showarg.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 6)
%8 = tail call i32 @strncat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @showarg.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 6)
br label %9
9: ; preds = %3, %6
%10 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), %3 ]
%11 = tail call i32 @strncat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @showarg.str, i64 0, i64 0), i8* %10, i32 6)
br label %12
12: ; preds = %9, %1
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @showarg.str, i64 0, i64 0)
}