#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 */
char *kittengets(int, int, char *);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void usage(int cat) {
  char *s;
  if (cat != cat) {
  };
  write(1, "FreeDOS LOCALIZE, version 0.1\r\n",
        strlen("FreeDOS LOCALIZE, version 0.1\r\n"));
  ;
  write(
      1, "GNU GPL - copyright 2003 Eric Auer <eric@coli.uni-sb.de>\r\n\r\n",
      strlen(
          "GNU GPL - copyright 2003 Eric Auer <eric@coli.uni-sb.de>\r\n\r\n"));
  ;
  s = kittengets(99, 0, "Prints a localized message (from localize.*)");
  write(1, s, strlen(s));
  ;
  write(1, "\r\n", strlen("\r\n"));
  ;
  write(1, "LOCALIZE x.y [etc.] [@@@ alternative message]\r\n",
        strlen("LOCALIZE x.y [etc.] [@@@ alternative message]\r\n"));
  ;
  s = kittengets(
      99, 1,
      "Prints message number x.y or the alt. message (and echoes the [etc.])");
  write(1, s, strlen(s));
  ;
  write(1, "\r\n", strlen("\r\n"));
  ;
  s = kittengets(99, 2, "Errorlevel: 0 if okay, 1 on localization error.");
  write(1, s, strlen(s));
  ;
  write(1, "\r\n", strlen("\r\n"));
  ;
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x4(%rbp),%eax
je     114c <usage+0x1c>
jmp    114c <usage+0x1c>
lea    0xead(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xe9a(%rip),%rsi
call   1030 <write@plt>
lea    0xeae(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xe9b(%rip),%rsi
call   1030 <write@plt>
mov    $0x63,%edi
xor    %esi,%esi
lea    0xec5(%rip),%rdx
call   1050 <kittengets@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
lea    0xe91(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xe7e(%rip),%rsi
call   1030 <write@plt>
lea    0xea2(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xe8f(%rip),%rsi
call   1030 <write@plt>
mov    $0x63,%edi
mov    $0x1,%esi
lea    0xea9(%rip),%rdx
call   1050 <kittengets@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
lea    0xe18(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xe05(%rip),%rsi
call   1030 <write@plt>
mov    $0x63,%edi
mov    $0x2,%esi
lea    0xe95(%rip),%rdx
call   1050 <kittengets@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
lea    0xdbe(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xdab(%rip),%rsi
call   1030 <write@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xec7(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xee6(%rip),%rdx
mov    $0x63,%edi
xor    %esi,%esi
call   1050 <kittengets@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xeb6(%rip),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xec8(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xeda(%rip),%rdx
mov    $0x63,%edi
mov    $0x1,%esi
call   1050 <kittengets@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xed9(%rip),%rdx
mov    $0x63,%edi
mov    $0x2,%esi
call   1050 <kittengets@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"FreeDOS LOCALIZE, version 0.1\0D\0A\00"
@.str.1 = [61 x i8] c"GNU GPL - copyright 2003 Eric Auer <eric@coli.uni-sb.de>\0D\0A\0D\0A\00"
@.str.2 = [45 x i8] c"Prints a localized message (from localize.*)\00"
@.str.3 = [3 x i8] c"\0D\0A\00"
@.str.4 = [48 x i8] c"LOCALIZE x.y [etc.] [@@@ alternative message]\0D\0A\00"
@.str.5 = [70 x i8] c"Prints message number x.y or the alt. message (and echoes the [etc.])\00"
@.str.6 = [48 x i8] c"Errorlevel: 0 if okay, 1 on localization error.\00"
define void @usage(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %8
7: ; preds = %1
br label %8
8: ; preds = %7, %1
%9 = call i32 @strlen(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @write(i32 1, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 @strlen(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @write(i32 1, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = call i8* @kittengets(i32 99, i32 0, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
store i8* %13, i8** %3
%14 = load i8*, i8** %3
%15 = load i8*, i8** %3
%16 = call i32 @strlen(i8* %15)
%17 = call i32 @write(i32 1, i8* %14, i32 %16)
%18 = call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = call i32 @strlen(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0))
%21 = call i32 @write(i32 1, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i32 %20)
%22 = call i8* @kittengets(i32 99, i32 1, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.5, i64 0, i64 0))
store i8* %22, i8** %3
%23 = load i8*, i8** %3
%24 = load i8*, i8** %3
%25 = call i32 @strlen(i8* %24)
%26 = call i32 @write(i32 1, i8* %23, i32 %25)
%27 = call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%28 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %27)
%29 = call i8* @kittengets(i32 99, i32 2, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0))
store i8* %29, i8** %3
%30 = load i8*, i8** %3
%31 = load i8*, i8** %3
%32 = call i32 @strlen(i8* %31)
%33 = call i32 @write(i32 1, i8* %30, i32 %32)
%34 = call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%35 = call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %34)
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"FreeDOS LOCALIZE, version 0.1\0D\0A\00"
@.str.1 = [61 x i8] c"GNU GPL - copyright 2003 Eric Auer <eric@coli.uni-sb.de>\0D\0A\0D\0A\00"
@.str.2 = [45 x i8] c"Prints a localized message (from localize.*)\00"
@.str.3 = [3 x i8] c"\0D\0A\00"
@.str.4 = [48 x i8] c"LOCALIZE x.y [etc.] [@@@ alternative message]\0D\0A\00"
@.str.5 = [70 x i8] c"Prints message number x.y or the alt. message (and echoes the [etc.])\00"
@.str.6 = [48 x i8] c"Errorlevel: 0 if okay, 1 on localization error.\00"
define void @usage(i32 %0) {
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @strlen(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = tail call i8* @kittengets(i32 99, i32 0, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @strlen(i8* %6)
%8 = tail call i32 @write(i32 1, i8* %6, i32 %7)
%9 = tail call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%10 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %9)
%11 = tail call i32 @strlen(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0))
%12 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i32 %11)
%13 = tail call i8* @kittengets(i32 99, i32 1, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.5, i64 0, i64 0))
%14 = tail call i32 @strlen(i8* %13)
%15 = tail call i32 @write(i32 1, i8* %13, i32 %14)
%16 = tail call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%17 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = tail call i8* @kittengets(i32 99, i32 2, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0))
%19 = tail call i32 @strlen(i8* %18)
%20 = tail call i32 @write(i32 1, i8* %18, i32 %19)
%21 = tail call i32 @strlen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%22 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %21)
ret void
}