void abms_init_loop(void) {
  char lcmd[255];
  sprintf(lcmd, "%s%s /dev/tty%d c 4 %d", "/app/os/sys/bin/", "mknod", 8, 8);
  abms_system(lcmd);
  sprintf(lcmd, "%s%s og-r /dev/%s", "/app/os/sys/bin/", "chmod", "tty8");
  abms_system(lcmd);
  sprintf(lcmd, "%s%s -l %s%s -f %s 38400 %s", "/app/os/sys/bin/", "getty",
          "/app/os/sys/bin/", "login", "/etc/issue.net", "tty8");
  abms_system(lcmd);
  printf("\n\n");
  printf("Spliced Networks (R) Appliance Operating System Software\n");
  printf("AppOS (R) Boot Management System, Version %s\n", "4.0.0");
  printf("%s\n\n", "Copyright (c) 2002-2008 Spliced Networks LLC");
  printf("\nAppliance active, please use management console.\n\n");
  return;
  while (1) {
    sleep(10);
  }
  abms_init_loop();
}


x86 assembly (clang, -O0):
<abms_init_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
lea    -0x100(%rbp),%rdi
lea    0xeb7(%rip),%rsi
lea    0xec7(%rip),%rdx
lea    0xed1(%rip),%rcx
mov    $0x8,%r9d
mov    %r9d,%r8d
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    -0x100(%rbp),%rdi
mov    $0x0,%al
call   1040 <abms_system@plt>
lea    -0x100(%rbp),%rdi
lea    0xeab(%rip),%rsi
lea    0xe8d(%rip),%rdx
lea    0xeaf(%rip),%rcx
lea    0xeae(%rip),%r8
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    -0x100(%rbp),%rdi
mov    $0x0,%al
call   1040 <abms_system@plt>
lea    -0x100(%rbp),%rdi
lea    0xe90(%rip),%rsi
lea    0xe55(%rip),%r8
lea    0xe9e(%rip),%rcx
lea    0xe9d(%rip),%r9
lea    0xe9c(%rip),%r10
lea    0xe68(%rip),%rax
mov    %r8,%rdx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    -0x100(%rbp),%rdi
mov    $0x0,%al
call   1040 <abms_system@plt>
lea    0xf4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
lea    0xec1(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    0xeb7(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<abms_init_loop>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
lea    0xead(%rip),%rsi
lea    0xebd(%rip),%r14
lea    0xec7(%rip),%rcx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
mov    $0x8,%r8d
mov    $0x8,%r9d
xor    %eax,%eax
call   1060 <sprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <abms_system@plt>
lea    0xea0(%rip),%rsi
lea    0xeab(%rip),%rcx
lea    0xeaa(%rip),%r15
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r15,%r8
xor    %eax,%eax
call   1060 <sprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <abms_system@plt>
lea    0xeb6(%rip),%r10
lea    0xe87(%rip),%rsi
lea    0xe9c(%rip),%rcx
lea    0xe9b(%rip),%r9
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r14,%r8
xor    %eax,%eax
push   %r15
push   %r10
call   1060 <sprintf@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <abms_system@plt>
lea    0xebe(%rip),%rdi
call   1030 <puts@plt>
lea    0xee1(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6f(%rip),%rdi
lea    0xe96(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8e(%rip),%rdi
lea    0xe8c(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c"%s%s /dev/tty%d c 4 %d\00"
@.str.1 = [17 x i8] c"/app/os/sys/bin/\00"
@.str.2 = [6 x i8] c"mknod\00"
@.str.3 = [18 x i8] c"%s%s og-r /dev/%s\00"
@.str.4 = [6 x i8] c"chmod\00"
@.str.5 = [5 x i8] c"tty8\00"
@.str.6 = [28 x i8] c"%s%s -l %s%s -f %s 38400 %s\00"
@.str.7 = [6 x i8] c"getty\00"
@.str.8 = [6 x i8] c"login\00"
@.str.9 = [15 x i8] c"/etc/issue.net\00"
@.str.10 = [3 x i8] c"\0A\0A\00"
@.str.11 = [58 x i8] c"Spliced Networks (R) Appliance Operating System Software\0A\00"
@.str.12 = [46 x i8] c"AppOS (R) Boot Management System, Version %s\0A\00"
@.str.13 = [6 x i8] c"4.0.0\00"
@.str.14 = [5 x i8] c"%s\0A\0A\00"
@.str.15 = [45 x i8] c"Copyright (c) 2002-2008 Spliced Networks LLC\00"
@.str.16 = [52 x i8] c"\0AAppliance active, please use management console.\0A\0A\00"
define void @abms_init_loop() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 8, i32 8)
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @abms_system to i32 (i8*, ...)*)(i8* %4)
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%7 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%8 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @abms_system to i32 (i8*, ...)*)(i8* %8)
%10 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%11 = call i32 (i8*, i8*, ...) @sprintf(i8* %10, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%12 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%13 = call i32 (i8*, ...) bitcast (i32 (...)* @abms_system to i32 (i8*, ...)*)(i8* %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.11, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.15, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.16, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"%s%s /dev/tty%d c 4 %d\00"
@.str.1 = [17 x i8] c"/app/os/sys/bin/\00"
@.str.2 = [6 x i8] c"mknod\00"
@.str.3 = [18 x i8] c"%s%s og-r /dev/%s\00"
@.str.4 = [6 x i8] c"chmod\00"
@.str.5 = [5 x i8] c"tty8\00"
@.str.6 = [28 x i8] c"%s%s -l %s%s -f %s 38400 %s\00"
@.str.7 = [6 x i8] c"getty\00"
@.str.8 = [6 x i8] c"login\00"
@.str.9 = [15 x i8] c"/etc/issue.net\00"
@.str.12 = [46 x i8] c"AppOS (R) Boot Management System, Version %s\0A\00"
@.str.13 = [6 x i8] c"4.0.0\00"
@.str.14 = [5 x i8] c"%s\0A\0A\00"
@.str.15 = [45 x i8] c"Copyright (c) 2002-2008 Spliced Networks LLC\00"
@str = [2 x i8] c"\0A\00"
@str.17 = [57 x i8] c"Spliced Networks (R) Appliance Operating System Software\00"
@str.18 = [51 x i8] c"\0AAppliance active, please use management console.\0A\00"
define void @abms_init_loop() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 8, i32 8)
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @abms_system to i32 (i8*, ...)*)(i8* %2)
%5 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @abms_system to i32 (i8*, ...)*)(i8* %2)
%7 = call i32 (i8*, i8*, ...) @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @abms_system to i32 (i8*, ...)*)(i8* %2)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.17, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.13, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.15, i64 0, i64 0))
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.18, i64 0, i64 0))
ret void
}