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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ fwrite(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(unsigned char *, char *, unsigned char);
void w_key192(FILE *fp, unsigned char key[4][6]) {
  int i, j;
  unsigned char tmp;
  unsigned char buff[32];
  fprintf(fp, "@%08x\n", 0x00000018);
  for (i = 0; i < 6; i++)
    for (j = 0; j < 4; j++) {
      tmp = key[3 - j][i];
      sprintf(buff, "%02x\n", tmp);
      fwrite(buff, 1, 3, fp);
    }
  for (i = 0; i < 2; i++)
    for (j = 0; j < 4; j++) {
      tmp = 0;
      sprintf(buff, "%02x\n", tmp);
      fwrite(buff, 1, 3, fp);
    }
}


x86 assembly (clang, -O0):
<w_key192>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb5(%rip),%rsi
mov    $0x18,%edx
call   1030 <fprintf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x6,-0x14(%rbp)
jge    11e3 <w_key192+0xb3>
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    11d0 <w_key192+0xa0>
mov    -0x10(%rbp),%rax
mov    $0x3,%ecx
sub    -0x18(%rbp),%ecx
movslq %ecx,%rcx
imul   $0x6,%rcx,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x19(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xe65(%rip),%rsi
movzbl -0x19(%rbp),%edx
call   1040 <sprintf@plt>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x3,%edx
call   1050 <fwrite@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    116d <w_key192+0x3d>
jmp    11d5 <w_key192+0xa5>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115c <w_key192+0x2c>
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    1255 <w_key192+0x125>
movl   $0x0,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jge    1242 <w_key192+0x112>
movb   $0x0,-0x19(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xdf3(%rip),%rsi
movzbl -0x19(%rbp),%edx
call   1040 <sprintf@plt>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x3,%edx
call   1050 <fwrite@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11fb <w_key192+0xcb>
jmp    1247 <w_key192+0x117>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ea <w_key192+0xba>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<w_key192>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xeb6(%rip),%rsi
mov    $0x18,%edx
call   1030 <fprintf@plt>
mov    $0xfffffffffffffffa,%rbx
lea    0xea5(%rip),%r14
mov    %rsp,%r13
cs nopw 0x0(%rax,%rax,1)
nop
movzbl 0x18(%r15,%rbx,1),%edx
mov    %r13,%rdi
mov    %r14,%rsi
call   1040 <sprintf@plt>
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    %r12,%rcx
call   1050 <fwrite@plt>
movzbl 0x12(%r15,%rbx,1),%edx
mov    %r13,%rdi
mov    %r14,%rsi
call   1040 <sprintf@plt>
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    %r12,%rcx
call   1050 <fwrite@plt>
movzbl 0xc(%r15,%rbx,1),%edx
mov    %r13,%rdi
mov    %r14,%rsi
call   1040 <sprintf@plt>
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    %r12,%rcx
call   1050 <fwrite@plt>
movzbl 0x6(%r15,%rbx,1),%edx
mov    %r13,%rdi
mov    %r14,%rsi
call   1040 <sprintf@plt>
mov    %r13,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    %r12,%rcx
call   1050 <fwrite@plt>
inc    %rbx
jne    1170 <w_key192+0x40>
lea    0xdef(%rip),%r15
mov    %rsp,%r14
mov    %r14,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1040 <sprintf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    %r12,%rcx
call   1050 <fwrite@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1040 <sprintf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    %r12,%rcx
call   1050 <fwrite@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1040 <sprintf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    %r12,%rcx
call   1050 <fwrite@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1040 <sprintf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    %r12,%rcx
call   1050 <fwrite@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1040 <sprintf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    %r12,%rcx
call   1050 <fwrite@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1040 <sprintf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    %r12,%rcx
call   1050 <fwrite@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1040 <sprintf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    %r12,%rcx
call   1050 <fwrite@plt>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1040 <sprintf@plt>
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x3,%edx
mov    %r12,%rcx
call   1050 <fwrite@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"@%08x\0A\00"
@.str.1 = [6 x i8] c"%02x\0A\00"
define void @w_key192(i32* %0, [6 x i8]* %1) {
%3 = alloca i32*
%4 = alloca [6 x i8]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = alloca [32 x i8]
store i32* %0, i32** %3
store [6 x i8]* %1, [6 x i8]** %4
%9 = load i32*, i32** %3
%10 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 24)
store i32 0, i32* %5
br label %11
11: ; preds = %38, %2
%12 = load i32, i32* %5
%13 = icmp slt i32 %12, 6
br i1 %13, label %14, label %41
14: ; preds = %11
store i32 0, i32* %6
br label %15
15: ; preds = %34, %14
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 4
br i1 %17, label %18, label %37
18: ; preds = %15
%19 = load [6 x i8]*, [6 x i8]** %4
%20 = load i32, i32* %6
%21 = sub nsw i32 3, %20
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [6 x i8], [6 x i8]* %19, i64 %22
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [6 x i8], [6 x i8]* %23, i64 0, i64 %25
%27 = load i8, i8* %26
store i8 %27, i8* %7
%28 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%29 = load i8, i8* %7
%30 = call i32 @sprintf(i8* %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %29)
%31 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%32 = load i32*, i32** %3
%33 = call i32 @fwrite(i8* %31, i32 1, i32 3, i32* %32)
br label %34
34: ; preds = %18
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %15
37: ; preds = %15
br label %38
38: ; preds = %37
%39 = load i32, i32* %5
%40 = add nsw i32 %39, 1
store i32 %40, i32* %5
br label %11
41: ; preds = %11
store i32 0, i32* %5
br label %42
42: ; preds = %60, %41
%43 = load i32, i32* %5
%44 = icmp slt i32 %43, 2
br i1 %44, label %45, label %63
45: ; preds = %42
store i32 0, i32* %6
br label %46
46: ; preds = %56, %45
%47 = load i32, i32* %6
%48 = icmp slt i32 %47, 4
br i1 %48, label %49, label %59
49: ; preds = %46
store i8 0, i8* %7
%50 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%51 = load i8, i8* %7
%52 = call i32 @sprintf(i8* %50, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %51)
%53 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%54 = load i32*, i32** %3
%55 = call i32 @fwrite(i8* %53, i32 1, i32 3, i32* %54)
br label %56
56: ; preds = %49
%57 = load i32, i32* %6
%58 = add nsw i32 %57, 1
store i32 %58, i32* %6
br label %46
59: ; preds = %46
br label %60
60: ; preds = %59
%61 = load i32, i32* %5
%62 = add nsw i32 %61, 1
store i32 %62, i32* %5
br label %42
63: ; preds = %42
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"@%08x\0A\00"
@.str.1 = [6 x i8] c"%02x\0A\00"
define void @w_key192(i32* nocapture %0, [6 x i8]* nocapture %1) {
%3 = alloca [32 x i8]
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 24)
br label %6
6: ; preds = %2, %6
%7 = phi i64 [ 0, %2 ], [ %24, %6 ]
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 3, i64 %7
%9 = load i8, i8* %8
%10 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %9)
%11 = call i32 @fwrite(i8* %4, i32 1, i32 3, i32* %0)
%12 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 2, i64 %7
%13 = load i8, i8* %12
%14 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %13)
%15 = call i32 @fwrite(i8* %4, i32 1, i32 3, i32* %0)
%16 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 1, i64 %7
%17 = load i8, i8* %16
%18 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %17)
%19 = call i32 @fwrite(i8* %4, i32 1, i32 3, i32* %0)
%20 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 %7
%21 = load i8, i8* %20
%22 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext %21)
%23 = call i32 @fwrite(i8* %4, i32 1, i32 3, i32* %0)
%24 = add nuw nsw i64 %7, 1
%25 = icmp eq i64 %24, 6
br i1 %25, label %26, label %6
26: ; preds = %6
%27 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext 0)
%28 = call i32 @fwrite(i8* %4, i32 1, i32 3, i32* %0)
%29 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext 0)
%30 = call i32 @fwrite(i8* %4, i32 1, i32 3, i32* %0)
%31 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext 0)
%32 = call i32 @fwrite(i8* %4, i32 1, i32 3, i32* %0)
%33 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext 0)
%34 = call i32 @fwrite(i8* %4, i32 1, i32 3, i32* %0)
%35 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext 0)
%36 = call i32 @fwrite(i8* %4, i32 1, i32 3, i32* %0)
%37 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext 0)
%38 = call i32 @fwrite(i8* %4, i32 1, i32 3, i32* %0)
%39 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext 0)
%40 = call i32 @fwrite(i8* %4, i32 1, i32 3, i32* %0)
%41 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8 zeroext 0)
%42 = call i32 @fwrite(i8* %4, i32 1, i32 3, i32* %0)
ret void
}