#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*/ memcpy(char *, char const *, int);
int /*<<< orphan*/ print_opt(char *, int, char const *);
int /*<<< orphan*/ putchar(char);
char *strchr(char const *, char);
int /*<<< orphan*/ strcpy(char *, char const *);
void printopts(int tabw, const char *a, const char *s) {
  char buf[80];
  const char *p;
  while (*s) {
    p = strchr(s, '\n');
    if (p) {
      memcpy(buf, s, p - s);
      buf[p - s] = '\0';
      s = p + 1;
    } else {
      strcpy(buf, s);
      s = "";
    }
    if (buf[0])
      print_opt(buf, tabw, a);
    putchar('\n');
  }
}


x86 assembly (clang, -O0):
<printopts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     120c <printopts+0xbc>
mov    -0x18(%rbp),%rdi
mov    $0xa,%esi
call   1060 <strchr@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
je     11cb <printopts+0x7b>
lea    -0x70(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x78(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1070 <memcpy@plt>
mov    -0x78(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
movb   $0x0,-0x70(%rbp,%rax,1)
mov    -0x78(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11e3 <printopts+0x93>
lea    -0x70(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcpy@plt>
lea    0xe21(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpb   $0x0,-0x70(%rbp)
je     11fd <printopts+0xad>
lea    -0x70(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1050 <print_opt@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1166 <printopts+0x16>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printopts>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
cmpb   $0x0,(%rdx)
je     11f8 <printopts+0xa8>
mov    %rdx,%r13
mov    %rsi,%r14
mov    %edi,%r15d
mov    %rsp,%r12
jmp    1191 <printopts+0x41>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpb   $0x0,0x0(%r13)
je     11f8 <printopts+0xa8>
mov    %r13,%rdi
mov    $0xa,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     11d0 <printopts+0x80>
mov    %rax,%rbp
mov    %rax,%rbx
sub    %r13,%rbx
mov    %r12,%rdi
mov    %r13,%rsi
mov    %ebx,%edx
call   1070 <memcpy@plt>
movb   $0x0,(%rsp,%rbx,1)
add    $0x1,%rbp
mov    %rbp,%r13
cmpb   $0x0,(%rsp)
jne    11e8 <printopts+0x98>
jmp    1180 <printopts+0x30>
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %r13,%rsi
call   1040 <strcpy@plt>
lea    0xe1e(%rip),%r13
cmpb   $0x0,(%rsp)
je     1180 <printopts+0x30>
mov    %r12,%rdi
mov    %r15d,%esi
mov    %r14,%rdx
call   1050 <print_opt@plt>
jmp    1180 <printopts+0x30>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @printopts(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [80 x i8]
%8 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
br label %9
9: ; preds = %49, %3
%10 = load i8*, i8** %6
%11 = load i8, i8* %10
%12 = icmp ne i8 %11, 0
br i1 %12, label %13, label %51
13: ; preds = %9
%14 = load i8*, i8** %6
%15 = call i8* @strchr(i8* %14, i8 signext 10)
store i8* %15, i8** %8
%16 = load i8*, i8** %8
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %36
18: ; preds = %13
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%20 = load i8*, i8** %6
%21 = load i8*, i8** %8
%22 = load i8*, i8** %6
%23 = ptrtoint i8* %21 to i64
%24 = ptrtoint i8* %22 to i64
%25 = sub i64 %23, %24
%26 = trunc i64 %25 to i32
%27 = call i32 @memcpy(i8* %19, i8* %20, i32 %26)
%28 = load i8*, i8** %8
%29 = load i8*, i8** %6
%30 = ptrtoint i8* %28 to i64
%31 = ptrtoint i8* %29 to i64
%32 = sub i64 %30, %31
%33 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 %32
store i8 0, i8* %33
%34 = load i8*, i8** %8
%35 = getelementptr inbounds i8, i8* %34, i64 1
store i8* %35, i8** %6
br label %40
36: ; preds = %13
%37 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%38 = load i8*, i8** %6
%39 = call i32 @strcpy(i8* %37, i8* %38)
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %6
br label %40
40: ; preds = %36, %18
%41 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%42 = load i8, i8* %41
%43 = icmp ne i8 %42, 0
br i1 %43, label %44, label %49
44: ; preds = %40
%45 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%46 = load i32, i32* %4
%47 = load i8*, i8** %5
%48 = call i32 @print_opt(i8* %45, i32 %46, i8* %47)
br label %49
49: ; preds = %44, %40
%50 = call i32 @putchar(i8 signext 10)
br label %9
51: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @printopts(i32 %0, i8* %1, i8* %2) {
%4 = alloca [80 x i8]
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%6 = load i8, i8* %2
%7 = icmp eq i8 %6, 0
br i1 %7, label %32, label %8
8: ; preds = %3, %28
%9 = phi i8* [ %23, %28 ], [ %2, %3 ]
%10 = call i8* @strchr(i8* %9, i8 signext 10)
%11 = icmp eq i8* %10, null
br i1 %11, label %20, label %12
12: ; preds = %8
%13 = ptrtoint i8* %10 to i64
%14 = ptrtoint i8* %9 to i64
%15 = sub i64 %13, %14
%16 = trunc i64 %15 to i32
%17 = call i32 @memcpy(i8* %5, i8* %9, i32 %16)
%18 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 %15
store i8 0, i8* %18
%19 = getelementptr inbounds i8, i8* %10, i64 1
br label %22
20: ; preds = %8
%21 = call i32 @strcpy(i8* %5, i8* %9)
br label %22
22: ; preds = %20, %12
%23 = phi i8* [ %19, %12 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %20 ]
%24 = load i8, i8* %5
%25 = icmp eq i8 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %22
%27 = call i32 @print_opt(i8* %5, i32 %0, i8* %1)
br label %28
28: ; preds = %26, %22
%29 = call i32 @putchar(i8 signext 10)
%30 = load i8, i8* %23
%31 = icmp eq i8 %30, 0
br i1 %31, label %32, label %8
32: ; preds = %28, %3
ret void
}