#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*/ key4;

/* Variables and functions */
int /*<<< orphan*/ gen_key(char *, int);
int /*<<< orphan*/ print_char(char *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int main(int argc, char *argv[]) {
  printf("---- Test case 4 ----\n");
  char key4[16] = {0};
  gen_key(key4, sizeof(key4) - 1);
  print_char(key4, sizeof(key4));
  sleep(1);
  gen_key(key4, sizeof(key4) - 1);
  print_char(key4, sizeof(key4));
  sleep(1);
  gen_key(key4, sizeof(key4) - 1);
  print_char(key4, sizeof(key4));
  sleep(1);
  gen_key(key4, sizeof(key4) - 1);
  print_char(key4, sizeof(key4));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
lea    -0x20(%rbp),%rdi
mov    $0xf,%esi
call   1060 <gen_key@plt>
lea    -0x20(%rbp),%rdi
mov    $0x10,%esi
call   1050 <print_char@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
lea    -0x20(%rbp),%rdi
mov    $0xf,%esi
call   1060 <gen_key@plt>
lea    -0x20(%rbp),%rdi
mov    $0x10,%esi
call   1050 <print_char@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
lea    -0x20(%rbp),%rdi
mov    $0xf,%esi
call   1060 <gen_key@plt>
lea    -0x20(%rbp),%rdi
mov    $0x10,%esi
call   1050 <print_char@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
lea    -0x20(%rbp),%rdi
mov    $0xf,%esi
call   1060 <gen_key@plt>
lea    -0x20(%rbp),%rdi
mov    $0x10,%esi
call   1050 <print_char@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
call   1030 <puts@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xf,%esi
call   1050 <gen_key@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <print_char@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1050 <gen_key@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <print_char@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1050 <gen_key@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <print_char@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1050 <gen_key@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <print_char@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"---- Test case 4 ----\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [16 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%8 = bitcast [16 x i8]* %6 to i8*
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%10 = call i32 @gen_key(i8* %9, i32 15)
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%12 = call i32 @print_char(i8* %11, i32 16)
%13 = call i32 @sleep(i32 1)
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%15 = call i32 @gen_key(i8* %14, i32 15)
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%17 = call i32 @print_char(i8* %16, i32 16)
%18 = call i32 @sleep(i32 1)
%19 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%20 = call i32 @gen_key(i8* %19, i32 15)
%21 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%22 = call i32 @print_char(i8* %21, i32 16)
%23 = call i32 @sleep(i32 1)
%24 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%25 = call i32 @gen_key(i8* %24, i32 15)
%26 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%27 = call i32 @print_char(i8* %26, i32 16)
ret i32 0
}

LLVM IR (-O2):
@str = [22 x i8] c"---- Test case 4 ----\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [16 x i8]
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%5 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%6 = call i32 @gen_key(i8* %5, i32 15)
%7 = call i32 @print_char(i8* %5, i32 16)
%8 = call i32 @sleep(i32 1)
%9 = call i32 @gen_key(i8* %5, i32 15)
%10 = call i32 @print_char(i8* %5, i32 16)
%11 = call i32 @sleep(i32 1)
%12 = call i32 @gen_key(i8* %5, i32 15)
%13 = call i32 @print_char(i8* %5, i32 16)
%14 = call i32 @sleep(i32 1)
%15 = call i32 @gen_key(i8* %5, i32 15)
%16 = call i32 @print_char(i8* %5, i32 16)
ret i32 0
}