#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 /*<<< orphan*/ data_setai(int, int);
int /*<<< orphan*/ data_setsleeptime(int);
int /*<<< orphan*/ setanimate(int);
int apply_settings(int *set) {
  int i;
  for (i = 0; i < 4; i++)
    data_setai(i, set[i]);
  data_setsleeptime(set[5]);
  setanimate(set[6]);
  return set[4];
}


x86 assembly (clang, -O0):
<apply_settings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    116e <apply_settings+0x3e>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1030 <data_setai@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <apply_settings+0x13>
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%edi
call   1040 <data_setsleeptime@plt>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%edi
call   1050 <setanimate@plt>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<apply_settings>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%esi
xor    %edi,%edi
call   1030 <data_setai@plt>
mov    0x4(%rbx),%esi
mov    $0x1,%edi
call   1030 <data_setai@plt>
mov    0x8(%rbx),%esi
mov    $0x2,%edi
call   1030 <data_setai@plt>
mov    0xc(%rbx),%esi
mov    $0x3,%edi
call   1030 <data_setai@plt>
mov    0x14(%rbx),%edi
call   1040 <data_setsleeptime@plt>
mov    0x18(%rbx),%edi
call   1050 <setanimate@plt>
mov    0x10(%rbx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @apply_settings(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
br label %4
4: ; preds = %15, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 4
br i1 %6, label %7, label %18
7: ; preds = %4
%8 = load i32, i32* %3
%9 = load i32*, i32** %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %9, i64 %11
%13 = load i32, i32* %12
%14 = call i32 @data_setai(i32 %8, i32 %13)
br label %15
15: ; preds = %7
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %4
18: ; preds = %4
%19 = load i32*, i32** %2
%20 = getelementptr inbounds i32, i32* %19, i64 5
%21 = load i32, i32* %20
%22 = call i32 @data_setsleeptime(i32 %21)
%23 = load i32*, i32** %2
%24 = getelementptr inbounds i32, i32* %23, i64 6
%25 = load i32, i32* %24
%26 = call i32 @setanimate(i32 %25)
%27 = load i32*, i32** %2
%28 = getelementptr inbounds i32, i32* %27, i64 4
%29 = load i32, i32* %28
ret i32 %29
}

LLVM IR (-O2):
define i32 @apply_settings(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @data_setai(i32 0, i32 %2)
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = tail call i32 @data_setai(i32 1, i32 %5)
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = tail call i32 @data_setai(i32 2, i32 %8)
%10 = getelementptr inbounds i32, i32* %0, i64 3
%11 = load i32, i32* %10
%12 = tail call i32 @data_setai(i32 3, i32 %11)
%13 = getelementptr inbounds i32, i32* %0, i64 5
%14 = load i32, i32* %13
%15 = tail call i32 @data_setsleeptime(i32 %14)
%16 = getelementptr inbounds i32, i32* %0, i64 6
%17 = load i32, i32* %16
%18 = tail call i32 @setanimate(i32 %17)
%19 = getelementptr inbounds i32, i32* %0, i64 4
%20 = load i32, i32* %19
ret i32 %20
}