#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*/ printf(char *, ...);
char *strtok(char *, char *);
void warning_message(int code, int _pass, char *_source, int _lines,
                     int *warnings) {
  if (2 != _pass)
    return;
  printf("%s, line %d: Warning: ", strtok(_source, "\042"), _lines);
  switch (code) {
  case 1:
    printf("16-bit overflow\n");
    break;
  case 2:
    printf("8-bit overflow\n");
    break;
  case 3:
    printf("3-bit overflow\n");
    break;
  case 4:
    printf("output cannot be converted to CAS\n");
    break;
  case 5:
    printf("not official Zilog syntax\n");
    break;
  case 6:
    printf("undocumented Zilog instruction\n");
    break;
  }
  (*warnings)++;
}


x86 assembly (clang, -O0):
<warning_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    $0x2,%eax
cmp    -0x8(%rbp),%eax
je     114c <warning_message+0x2c>
jmp    1211 <warning_message+0xf1>
mov    -0x10(%rbp),%rdi
lea    0xed8(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,%rsi
mov    -0x14(%rbp),%edx
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x5,%eax
ja     1206 <warning_message+0xe6>
mov    -0x28(%rbp),%rax
lea    0xe70(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1206 <warning_message+0xe6>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1206 <warning_message+0xe6>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1206 <warning_message+0xe6>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1206 <warning_message+0xe6>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1206 <warning_message+0xe6>
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<warning_message>:
cmp    $0x2,%esi
jne    1188 <warning_message+0x58>
push   %rbp
push   %r14
push   %rbx
mov    %r8,%r14
mov    %ecx,%ebx
mov    %edi,%ebp
lea    0xed0(%rip),%rsi
mov    %rdx,%rdi
call   1050 <strtok@plt>
lea    0xeaa(%rip),%rdi
mov    %rax,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
cmp    $0x5,%ebp
ja     1180 <warning_message+0x50>
movslq %ebp,%rax
lea    0xf30(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   1030 <puts@plt>
addl   $0x1,(%r14)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"%s, line %d: Warning: \00"
@.str.1 = [2 x i8] c"\22\00"
@.str.2 = [17 x i8] c"16-bit overflow\0A\00"
@.str.3 = [16 x i8] c"8-bit overflow\0A\00"
@.str.4 = [16 x i8] c"3-bit overflow\0A\00"
@.str.5 = [35 x i8] c"output cannot be converted to CAS\0A\00"
@.str.6 = [27 x i8] c"not official Zilog syntax\0A\00"
@.str.7 = [32 x i8] c"undocumented Zilog instruction\0A\00"
define void @warning_message(i32 %0, i32 %1, i8* %2, i32 %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32* %4, i32** %10
%11 = load i32, i32* %7
%12 = icmp ne i32 2, %11
br i1 %12, label %13, label %14
13: ; preds = %5
br label %36
14: ; preds = %5
%15 = load i8*, i8** %8
%16 = call i8* @strtok(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = load i32, i32* %9
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %16, i32 %17)
%19 = load i32, i32* %6
switch i32 %19, label %32 [
i32 1, label %20
i32 2, label %22
i32 3, label %24
i32 4, label %26
i32 5, label %28
i32 6, label %30
]
20: ; preds = %14
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %32
22: ; preds = %14
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %32
24: ; preds = %14
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %32
26: ; preds = %14
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0))
br label %32
28: ; preds = %14
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
br label %32
30: ; preds = %14
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
br label %32
32: ; preds = %14, %30, %28, %26, %24, %22, %20
%33 = load i32*, i32** %10
%34 = load i32, i32* %33
%35 = add nsw i32 %34, 1
store i32 %35, i32* %33
br label %36
36: ; preds = %32, %13
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"%s, line %d: Warning: \00"
@.str.1 = [2 x i8] c"\22\00"
@str = [31 x i8] c"undocumented Zilog instruction\00"
@str.8 = [26 x i8] c"not official Zilog syntax\00"
@str.9 = [34 x i8] c"output cannot be converted to CAS\00"
@str.10 = [15 x i8] c"3-bit overflow\00"
@str.11 = [15 x i8] c"8-bit overflow\00"
@str.12 = [16 x i8] c"16-bit overflow\00"
@reltable.warning_message = [6 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @str.12 to i64), i64 ptrtoint ([6 x i32]* @reltable.warning_message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @str.11 to i64), i64 ptrtoint ([6 x i32]* @reltable.warning_message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @str.10 to i64), i64 ptrtoint ([6 x i32]* @reltable.warning_message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([34 x i8]* @str.9 to i64), i64 ptrtoint ([6 x i32]* @reltable.warning_message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @str.8 to i64), i64 ptrtoint ([6 x i32]* @reltable.warning_message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([31 x i8]* @str to i64), i64 ptrtoint ([6 x i32]* @reltable.warning_message to i64)) to i32)]
define void @warning_message(i32 %0, i32 %1, i8* %2, i32 %3, i32* nocapture %4) {
%6 = icmp eq i32 %1, 2
br i1 %6, label %7, label %20
7: ; preds = %5
%8 = tail call i8* @strtok(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %3)
%10 = add i32 %0, -1
%11 = icmp ult i32 %10, 6
br i1 %11, label %12, label %17
12: ; preds = %7
%13 = sext i32 %10 to i64
%14 = shl i64 %13, 2
%15 = call i8* @llvm.load.relative.i64(i8* bitcast ([6 x i32]* @reltable.warning_message to i8*), i64 %14)
%16 = tail call i32 @puts(i8* dereferenceable(1) %15)
br label %17
17: ; preds = %7, %12
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %20
20: ; preds = %5, %17
ret void
}