#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 printf(char *, ...);
int /*<<< orphan*/ putchar(char);
char *strchr(char *, char);
void print_opt(char *buf, int tabw, const char *a) {
  int n = 0;
  char *p;
  p = strchr(buf, '\t');
  if (!p) {
    printf("  -");
    p = buf;
  } else {
    *p = '\0';
    p++;
    if (buf[0])
      n = printf("  -%s ", buf);
    if (n > tabw) {
      putchar('\n');
      n = 0;
    }
    do
      putchar(' ');
    while (++n < tabw);
  }
  printf(p, a);
  putchar('.');
}


x86 assembly (clang, -O0):
<print_opt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x9,%esi
call   1040 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1182 <print_opt+0x52>
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    11fa <print_opt+0xca>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11b7 <print_opt+0x87>
mov    -0x8(%rbp),%rsi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11d4 <print_opt+0xa4>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x0,-0x1c(%rbp)
jmp    11d9 <print_opt+0xa9>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmp    -0xc(%rbp),%eax
jl     11d9 <print_opt+0xa9>
jmp    11fa <print_opt+0xca>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_opt>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%ebp
mov    %rdi,%rbx
mov    $0x9,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1196 <print_opt+0x66>
mov    %rax,%r15
movb   $0x0,(%rax)
cmpb   $0x0,(%rbx)
je     11c5 <print_opt+0x95>
lea    0xea4(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %eax,%ebx
cmp    %ebp,%ebx
jle    117c <print_opt+0x4c>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
add    $0x1,%r15
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    %ebp,%ebx
jl     1180 <print_opt+0x50>
mov    %r15,%rbx
jmp    11a4 <print_opt+0x74>
lea    0xe63(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x2e,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>
xor    %ebx,%ebx
cmp    %ebp,%ebx
jg     1170 <print_opt+0x40>
jmp    117c <print_opt+0x4c>

LLVM IR (-O0):
@.str = [4 x i8] c" -\00"
@.str.1 = [7 x i8] c" -%s \00"
define void @print_opt(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
store i32 0, i32* %7
%9 = load i8*, i8** %4
%10 = call i8* @strchr(i8* %9, i8 signext 9)
store i8* %10, i8** %8
%11 = load i8*, i8** %8
%12 = icmp ne i8* %11, null
br i1 %12, label %16, label %13
13: ; preds = %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%15 = load i8*, i8** %4
store i8* %15, i8** %8
br label %42
16: ; preds = %3
%17 = load i8*, i8** %8
store i8 0, i8* %17
%18 = load i8*, i8** %8
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %8
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = icmp ne i8 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %16
%25 = load i8*, i8** %4
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %25)
store i32 %26, i32* %7
br label %27
27: ; preds = %24, %16
%28 = load i32, i32* %7
%29 = load i32, i32* %5
%30 = icmp sgt i32 %28, %29
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @putchar(i8 signext 10)
store i32 0, i32* %7
br label %33
33: ; preds = %31, %27
br label %34
34: ; preds = %36, %33
%35 = call i32 @putchar(i8 signext 32)
br label %36
36: ; preds = %34
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
%39 = load i32, i32* %5
%40 = icmp slt i32 %38, %39
br i1 %40, label %34, label %41
41: ; preds = %36
br label %42
42: ; preds = %41, %13
%43 = load i8*, i8** %8
%44 = load i8*, i8** %6
%45 = call i32 (i8*, ...) @printf(i8* %43, i8* %44)
%46 = call i32 @putchar(i8 signext 46)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c" -\00"
@.str.1 = [7 x i8] c" -%s \00"
define void @print_opt(i8* %0, i32 %1, i8* %2) {
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 9)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %26
8: ; preds = %3
store i8 0, i8* %4
%9 = getelementptr inbounds i8, i8* %4, i64 1
%10 = load i8, i8* %0
%11 = icmp eq i8 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %8
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %14
14: ; preds = %12, %8
%15 = phi i32 [ %13, %12 ], [ 0, %8 ]
%16 = icmp sgt i32 %15, %1
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = tail call i32 @putchar(i8 signext 10)
br label %19
19: ; preds = %17, %14
%20 = phi i32 [ %15, %14 ], [ 0, %17 ]
br label %21
21: ; preds = %19, %21
%22 = phi i32 [ %24, %21 ], [ %20, %19 ]
%23 = tail call i32 @putchar(i8 signext 32)
%24 = add nsw i32 %22, 1
%25 = icmp slt i32 %24, %1
br i1 %25, label %21, label %26
26: ; preds = %21, %6
%27 = phi i8* [ %0, %6 ], [ %9, %21 ]
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %27, i8* %2)
%29 = tail call i32 @putchar(i8 signext 46)
ret void
}