#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 */
int rand();
void set_randkey128(unsigned char p_data[4][4]) {
  unsigned int i, j;
  for (i = 0; i < 4; i++)
    for (j = 0; j < 4; j++)
      p_data[j][i] = rand() & 0xff;
}


x86 assembly (clang, -O0):
<set_randkey128>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jae    1181 <set_randkey128+0x71>
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jae    116e <set_randkey128+0x5e>
mov    $0x0,%al
call   1030 <rand@plt>
and    $0xff,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
shl    $0x2,%rcx
add    %rcx,%rax
mov    -0xc(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <set_randkey128+0x24>
jmp    1173 <set_randkey128+0x63>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <set_randkey128+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_randkey128>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0x4(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0x8(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0xc(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0x1(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0x5(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0x9(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0xd(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0x2(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0x6(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0xa(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0xe(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0x3(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0x7(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0xb(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
mov    %al,0xf(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @set_randkey128([4 x i8]* %0) {
%2 = alloca [4 x i8]*
%3 = alloca i32
%4 = alloca i32
store [4 x i8]* %0, [4 x i8]** %2
store i32 0, i32* %3
br label %5
5: ; preds = %27, %1
%6 = load i32, i32* %3
%7 = icmp ult i32 %6, 4
br i1 %7, label %8, label %30
8: ; preds = %5
store i32 0, i32* %4
br label %9
9: ; preds = %23, %8
%10 = load i32, i32* %4
%11 = icmp ult i32 %10, 4
br i1 %11, label %12, label %26
12: ; preds = %9
%13 = call i32 (...) @rand()
%14 = and i32 %13, 255
%15 = trunc i32 %14 to i8
%16 = load [4 x i8]*, [4 x i8]** %2
%17 = load i32, i32* %4
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %16, i64 %18
%20 = load i32, i32* %3
%21 = zext i32 %20 to i64
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %19, i64 0, i64 %21
store i8 %15, i8* %22
br label %23
23: ; preds = %12
%24 = load i32, i32* %4
%25 = add i32 %24, 1
store i32 %25, i32* %4
br label %9
26: ; preds = %9
br label %27
27: ; preds = %26
%28 = load i32, i32* %3
%29 = add i32 %28, 1
store i32 %29, i32* %3
br label %5
30: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @set_randkey128([4 x i8]* nocapture writeonly %0) {
%2 = tail call i32 (...) @rand()
%3 = trunc i32 %2 to i8
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 0, i64 0
store i8 %3, i8* %4
%5 = tail call i32 (...) @rand()
%6 = trunc i32 %5 to i8
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 1, i64 0
store i8 %6, i8* %7
%8 = tail call i32 (...) @rand()
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 2, i64 0
store i8 %9, i8* %10
%11 = tail call i32 (...) @rand()
%12 = trunc i32 %11 to i8
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 3, i64 0
store i8 %12, i8* %13
%14 = tail call i32 (...) @rand()
%15 = trunc i32 %14 to i8
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 0, i64 1
store i8 %15, i8* %16
%17 = tail call i32 (...) @rand()
%18 = trunc i32 %17 to i8
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 1, i64 1
store i8 %18, i8* %19
%20 = tail call i32 (...) @rand()
%21 = trunc i32 %20 to i8
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 2, i64 1
store i8 %21, i8* %22
%23 = tail call i32 (...) @rand()
%24 = trunc i32 %23 to i8
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 3, i64 1
store i8 %24, i8* %25
%26 = tail call i32 (...) @rand()
%27 = trunc i32 %26 to i8
%28 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 0, i64 2
store i8 %27, i8* %28
%29 = tail call i32 (...) @rand()
%30 = trunc i32 %29 to i8
%31 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 1, i64 2
store i8 %30, i8* %31
%32 = tail call i32 (...) @rand()
%33 = trunc i32 %32 to i8
%34 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 2, i64 2
store i8 %33, i8* %34
%35 = tail call i32 (...) @rand()
%36 = trunc i32 %35 to i8
%37 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 3, i64 2
store i8 %36, i8* %37
%38 = tail call i32 (...) @rand()
%39 = trunc i32 %38 to i8
%40 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 0, i64 3
store i8 %39, i8* %40
%41 = tail call i32 (...) @rand()
%42 = trunc i32 %41 to i8
%43 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 1, i64 3
store i8 %42, i8* %43
%44 = tail call i32 (...) @rand()
%45 = trunc i32 %44 to i8
%46 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 2, i64 3
store i8 %45, i8* %46
%47 = tail call i32 (...) @rand()
%48 = trunc i32 %47 to i8
%49 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 3, i64 3
store i8 %48, i8* %49
ret void
}