#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *,
                           unsigned int);
int /*<<< orphan*/ string(int /*<<< orphan*/ *, char const *);
void control(FILE *file, const char *name, const char *ctrl[], unsigned id,
             int *space) {
  if (!ctrl[id]) {
    fprintf(file, "*** invalid %s value %d ", name, id);
    assert(0);
  }
  if (ctrl[id][0]) {
    if (space && *space)
      string(file, " ");
    string(file, ctrl[id]);
    if (space)
      *space = 1;
  }
}


x86 assembly (clang, -O0):
<control>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
jne    117b <control+0x4b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
lea    0xe91(%rip),%rsi
call   1050 <fprintf@plt>
xor    %edi,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
cmpb   $0x0,(%rax)
je     11e5 <control+0xb5>
cmpq   $0x0,-0x28(%rbp)
je     11b7 <control+0x87>
mov    -0x28(%rbp),%rax
cmpl   $0x0,(%rax)
je     11b7 <control+0x87>
mov    -0x8(%rbp),%rdi
lea    0xe65(%rip),%rsi
call   1030 <string@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    (%rax,%rcx,8),%rsi
call   1030 <string@plt>
cmpq   $0x0,-0x28(%rbp)
je     11e0 <control+0xb0>
mov    -0x28(%rbp),%rax
movl   $0x1,(%rax)
jmp    11e5 <control+0xb5>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<control>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rdx,%r12
mov    %rsi,%rdx
mov    %rdi,%r15
mov    %ecx,%ebx
mov    (%r12,%rbx,8),%rsi
test   %rsi,%rsi
je     1156 <control+0x26>
cmpb   $0x0,(%rsi)
jne    1175 <control+0x45>
jmp    11a2 <control+0x72>
lea    0xea3(%rip),%rsi
mov    %r15,%rdi
call   1050 <fprintf@plt>
xor    %edi,%edi
call   1040 <assert@plt>
mov    (%r12,%rbx,8),%rsi
cmpb   $0x0,(%rsi)
je     11a2 <control+0x72>
test   %r14,%r14
je     11ae <control+0x7e>
cmpl   $0x0,(%r14)
je     1193 <control+0x63>
lea    0xe90(%rip),%rsi
mov    %r15,%rdi
call   1030 <string@plt>
mov    (%r12,%rbx,8),%rsi
mov    %r15,%rdi
call   1030 <string@plt>
movl   $0x1,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    %r15,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <string@plt>

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

LLVM IR (-O2):
@.str = [25 x i8] c"*** invalid %s value %d \00"
@.str.1 = [2 x i8] c" \00"
define void @control(i32* %0, i8* %1, i8** nocapture %2, i32 %3, i32* %4) {
%6 = zext i32 %3 to i64
%7 = getelementptr inbounds i8*, i8** %2, i64 %6
%8 = load i8*, i8** %7
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %3)
%12 = tail call i32 @assert(i32 0)
%13 = load i8*, i8** %7
br label %14
14: ; preds = %10, %5
%15 = phi i8* [ %13, %10 ], [ %8, %5 ]
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %31, label %18
18: ; preds = %14
%19 = icmp eq i32* %4, null
br i1 %19, label %29, label %20
20: ; preds = %18
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = tail call i32 @string(i32* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = load i8*, i8** %7
br label %26
26: ; preds = %20, %23
%27 = phi i8* [ %15, %20 ], [ %25, %23 ]
%28 = tail call i32 @string(i32* %0, i8* %27)
store i32 1, i32* %4
br label %31
29: ; preds = %18
%30 = tail call i32 @string(i32* %0, i8* %15)
br label %31
31: ; preds = %29, %26, %14
ret void
}