#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*/ code(int *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int main(int argc, char **argv) {
  int elements[10];
  int i = 48;
  const int size = 58;
  for (; i < size; i++)
    elements[i - 1] = i;
  FILE *swap = fopen("/tmp/codes.list", "w+");
  code(elements, 4, swap);
  fclose(swap);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x30,-0x44(%rbp)
movl   $0x3a,-0x48(%rbp)
cmpl   $0x3a,-0x44(%rbp)
jge    117b <main+0x4b>
mov    -0x44(%rbp),%ecx
mov    -0x44(%rbp),%eax
sub    $0x1,%eax
cltq
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1154 <main+0x24>
lea    0xe7e(%rip),%rdi
lea    0xe87(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x50(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x50(%rbp),%rdx
mov    $0x4,%esi
call   1050 <code@plt>
mov    -0x50(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movaps 0xec4(%rip),%xmm0
movups %xmm0,0xbc(%rsp)
movaps 0xec5(%rip),%xmm0
movups %xmm0,0xcc(%rsp)
movabs $0x3900000038,%rax
mov    %rax,0xdc(%rsp)
lea    0xeb4(%rip),%rdi
lea    0xebd(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    $0x4,%esi
mov    %rax,%rdx
call   1050 <code@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"/tmp/codes.list\00"
@.str.1 = [3 x i8] c"w+\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 48, i32* %7
store i32 58, i32* %8
br label %10
10: ; preds = %19, %2
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 58
br i1 %12, label %13, label %22
13: ; preds = %10
%14 = load i32, i32* %7
%15 = load i32, i32* %7
%16 = sub nsw i32 %15, 1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %17
store i32 %14, i32* %18
br label %19
19: ; preds = %13
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 1
store i32 %21, i32* %7
br label %10
22: ; preds = %10
%23 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %23, i32** %9
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%25 = load i32*, i32** %9
%26 = call i32 @code(i32* %24, i32 4, i32* %25)
%27 = load i32*, i32** %9
%28 = call i32 @fclose(i32* %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"/tmp/codes.list\00"
@.str.1 = [3 x i8] c"w+\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %3 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 47
%6 = bitcast i32* %5 to <4 x i32>*
store <4 x i32> <i32 48, i32 49, i32 50, i32 51>, <4 x i32>* %6
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 51
%8 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> <i32 52, i32 53, i32 54, i32 55>, <4 x i32>* %8
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 55
store i32 56, i32* %9
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 56
store i32 57, i32* %10
%11 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%13 = call i32 @code(i32* %12, i32 4, i32* %11)
%14 = call i32 @fclose(i32* %11)
ret i32 0
}