#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 */
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, int *, int *, int *);
void load_assembly_instructions(FILE *fp, int *opcode, int *lexlevel,
                                int *modifier) {
  int linenum = 0;
  int oc, l, m;
  while (fscanf(fp, "%d %d %d", &oc, &l, &m)) {
    opcode[linenum] = oc;
    lexlevel[linenum] = l;
    modifier[linenum] = m;
    ++linenum;
  }
}


x86 assembly (clang, -O0):
<load_assembly_instructions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec6(%rip),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
lea    -0x30(%rbp),%r8
call   1030 <fscanf@plt>
cmp    $0x0,%rax
je     118d <load_assembly_instructions+0x7d>
mov    -0x28(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x2c(%rbp),%edx
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%edx
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112f <load_assembly_instructions+0x1f>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_assembly_instructions>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
lea    0xecf(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
call   1030 <fscanf@plt>
test   %rax,%rax
je     119d <load_assembly_instructions+0x8d>
xor    %r13d,%r13d
lea    0xc(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x14(%rsp),%eax
mov    %eax,(%r12,%r13,1)
mov    0x10(%rsp),%eax
mov    %eax,(%r15,%r13,1)
mov    0xc(%rsp),%eax
mov    %eax,(%r14,%r13,1)
mov    %rbx,%rdi
lea    0xe7e(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
mov    %rbp,%r8
call   1030 <fscanf@plt>
add    $0x4,%r13
test   %rax,%rax
jne    1160 <load_assembly_instructions+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d %d %d\00"
define void @load_assembly_instructions(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
store i32 0, i32* %9
br label %13
13: ; preds = %17, %4
%14 = load i32*, i32** %5
%15 = call i64 @fscanf(i32* %14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %10, i32* %11, i32* %12)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %35
17: ; preds = %13
%18 = load i32, i32* %10
%19 = load i32*, i32** %6
%20 = load i32, i32* %9
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i32, i32* %19, i64 %21
store i32 %18, i32* %22
%23 = load i32, i32* %11
%24 = load i32*, i32** %7
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
store i32 %23, i32* %27
%28 = load i32, i32* %12
%29 = load i32*, i32** %8
%30 = load i32, i32* %9
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %29, i64 %31
store i32 %28, i32* %32
%33 = load i32, i32* %9
%34 = add nsw i32 %33, 1
store i32 %34, i32* %9
br label %13
35: ; preds = %13
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d %d %d\00"
define void @load_assembly_instructions(i32* nocapture %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %5 to i8*
%9 = bitcast i32* %6 to i8*
%10 = bitcast i32* %7 to i8*
%11 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %6, i32* %7)
%12 = icmp eq i64 %11, 0
br i1 %12, label %24, label %13
13: ; preds = %4, %13
%14 = phi i64 [ %21, %13 ], [ 0, %4 ]
%15 = load i32, i32* %5
%16 = getelementptr inbounds i32, i32* %1, i64 %14
store i32 %15, i32* %16
%17 = load i32, i32* %6
%18 = getelementptr inbounds i32, i32* %2, i64 %14
store i32 %17, i32* %18
%19 = load i32, i32* %7
%20 = getelementptr inbounds i32, i32* %3, i64 %14
store i32 %19, i32* %20
%21 = add nuw i64 %14, 1
%22 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %6, i32* %7)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %13
24: ; preds = %13, %4
ret void
}