#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
scalar_t__ isprint(char);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ puth(char, int /*<<< orphan*/ *);
void print_str_array(int argc, char **argv, FILE *f) {
  int i = 0;
  for (;;) {
    putc('\'', f);
    char *arg = argv[i];
    char c;
    while ((c = *arg++)) {
      if (c == '\'') {
        fputs("'\''", f);
      } else if (isprint(c)) {
        fputc(c, f);
      } else {
        fputc('\\', f);
        puth(c, f);
      }
    }
    putc('\'', f);
    i++;
    if (i == argc)
      break;
    putc(' ', f);
  }
}


x86 assembly (clang, -O0):
<print_str_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0x27,%edi
call   1060 <putc@plt>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
mov    (%rax),%al
mov    %al,-0x29(%rbp)
cmp    $0x0,%al
je     1214 <print_str_array+0xc4>
movsbl -0x29(%rbp),%eax
cmp    $0x27,%eax
jne    11c6 <print_str_array+0x76>
mov    -0x18(%rbp),%rsi
lea    0xe44(%rip),%rdi
call   1040 <fputs@plt>
jmp    120f <print_str_array+0xbf>
movsbl -0x29(%rbp),%edi
call   1070 <isprint@plt>
cmp    $0x0,%rax
je     11ed <print_str_array+0x9d>
mov    -0x29(%rbp),%al
mov    -0x18(%rbp),%rsi
movsbl %al,%edi
call   1050 <fputc@plt>
jmp    120a <print_str_array+0xba>
mov    -0x18(%rbp),%rsi
mov    $0x5c,%edi
call   1050 <fputc@plt>
mov    -0x29(%rbp),%al
mov    -0x18(%rbp),%rsi
movsbl %al,%edi
call   1030 <puth@plt>
jmp    120f <print_str_array+0xbf>
jmp    1188 <print_str_array+0x38>
mov    -0x18(%rbp),%rsi
mov    $0x27,%edi
call   1060 <putc@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    123c <print_str_array+0xec>
jmp    124f <print_str_array+0xff>
mov    -0x18(%rbp),%rsi
mov    $0x20,%edi
call   1060 <putc@plt>
jmp    116a <print_str_array+0x1a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_str_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,(%rsp)
mov    %edi,%r12d
xor    %r13d,%r13d
lea    0xe91(%rip),%r15
nop
mov    $0x27,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
mov    (%rsp),%rax
mov    (%rax,%r13,8),%r14
jmp    11a5 <print_str_array+0x55>
nopw   0x0(%rax,%rax,1)
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %rbx,%rcx
call   1070 <fwrite@plt>
movzbl (%r14),%eax
add    $0x1,%r14
cmp    $0x27,%al
je     1190 <print_str_array+0x40>
test   %al,%al
je     11f0 <print_str_array+0xa0>
movsbl %al,%ebp
mov    %ebp,%edi
call   1060 <isprint@plt>
test   %rax,%rax
je     11d0 <print_str_array+0x80>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
jmp    11a5 <print_str_array+0x55>
mov    $0x5c,%edi
mov    %rbx,%rsi
call   1040 <fputc@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <puth@plt>
jmp    11a5 <print_str_array+0x55>
nopl   0x0(%rax)
mov    $0x27,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
add    $0x1,%r13
cmp    %r12,%r13
je     1218 <print_str_array+0xc8>
mov    $0x20,%edi
mov    %rbx,%rsi
call   1050 <putc@plt>
jmp    1170 <print_str_array+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"'''\00"
define void @print_str_array(i32 %0, i8** nocapture %1, i32* %2) {
%4 = zext i32 %0 to i64
br label %5
5: ; preds = %29, %3
%6 = phi i64 [ %27, %29 ], [ 0, %3 ]
%7 = tail call i32 @putc(i8 signext 39, i32* %2)
%8 = getelementptr inbounds i8*, i8** %1, i64 %6
%9 = load i8*, i8** %8
br label %10
10: ; preds = %21, %5
%11 = phi i8* [ %9, %5 ], [ %12, %21 ]
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %11
switch i8 %13, label %16 [
i8 0, label %25
i8 39, label %14
]
14: ; preds = %10
%15 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 3, i64 1, i32* %2)
br label %21
16: ; preds = %10
%17 = tail call i64 @isprint(i8 signext %13)
%18 = icmp eq i64 %17, 0
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = tail call i32 @fputc(i8 signext %13, i32* %2)
br label %21
21: ; preds = %19, %22, %14
br label %10
22: ; preds = %16
%23 = tail call i32 @fputc(i8 signext 92, i32* %2)
%24 = tail call i32 @puth(i8 signext %13, i32* %2)
br label %21
25: ; preds = %10
%26 = tail call i32 @putc(i8 signext 39, i32* %2)
%27 = add nuw nsw i64 %6, 1
%28 = icmp eq i64 %27, %4
br i1 %28, label %31, label %29
29: ; preds = %25
%30 = tail call i32 @putc(i8 signext 32, i32* %2)
br label %5
31: ; preds = %25
ret void
}