#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 */
struct xcryptorADT {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ puts(char *);
struct xcryptorADT *xc_init(char *, int);
int /*<<< orphan*/ xc_next_subkey(struct xcryptorADT *, char *);
int main() {
  char key[5] = "hell";
  char subkey[5];
  struct xcryptorADT *xcrypt;
  xcrypt = xc_init(key, 1);
  xc_next_subkey(xcrypt, subkey);
  subkey[4] = '\0';
  puts(subkey);
  xc_next_subkey(xcrypt, subkey);
  puts(subkey);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xeb6(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x9(%rbp),%rdi
mov    $0x1,%esi
call   1030 <xc_init@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0xe(%rbp),%rsi
call   1050 <xc_next_subkey@plt>
movb   $0x0,-0xa(%rbp)
lea    -0xe(%rbp),%rdi
call   1040 <puts@plt>
mov    -0x18(%rbp),%rdi
lea    -0xe(%rbp),%rsi
call   1050 <xc_next_subkey@plt>
lea    -0xe(%rbp),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movb   $0x0,0x10(%rsp)
movl   $0x6c6c6568,0xc(%rsp)
6c
lea    0xc(%rsp),%rdi
mov    $0x1,%esi
call   1030 <xc_init@plt>
mov    %rax,%rbx
lea    0x13(%rsp),%r14
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <xc_next_subkey@plt>
movb   $0x0,0x17(%rsp)
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <xc_next_subkey@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.xcryptorADT = type { i32 }
@__const.main.key = [5 x i8] c"hell\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i8]
%3 = alloca [5 x i8]
%4 = alloca %struct.xcryptorADT*
store i32 0, i32* %1
%5 = bitcast [5 x i8]* %2 to i8*
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%7 = call %struct.xcryptorADT* @xc_init(i8* %6, i32 1)
store %struct.xcryptorADT* %7, %struct.xcryptorADT** %4
%8 = load %struct.xcryptorADT*, %struct.xcryptorADT** %4
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%10 = call i32 @xc_next_subkey(%struct.xcryptorADT* %8, i8* %9)
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 4
store i8 0, i8* %11
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%13 = call i32 @puts(i8* %12)
%14 = load %struct.xcryptorADT*, %struct.xcryptorADT** %4
%15 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%16 = call i32 @xc_next_subkey(%struct.xcryptorADT* %14, i8* %15)
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%18 = call i32 @puts(i8* %17)
ret i32 0
}

LLVM IR (-O2):
%struct.xcryptorADT = type { i32 }
@__const.main.key = [5 x i8] c"hell\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%5 = call %struct.xcryptorADT* @xc_init(i8* %3, i32 1)
%6 = call i32 @xc_next_subkey(%struct.xcryptorADT* %5, i8* %4)
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 4
store i8 0, i8* %7
%8 = call i32 @puts(i8* %4)
%9 = call i32 @xc_next_subkey(%struct.xcryptorADT* %5, i8* %4)
%10 = call i32 @puts(i8* %4)
ret i32 0
}