#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*/ sprintf(char *, char *, int, int);
int system(char *);
void init_voltage_files(void) {
  int res, loop_count = 0;
  int v[7] = {0, 1, 2, 3, 4, 5, 7};
  char temp[200];
  while (loop_count < 7) {
    sprintf(temp, "sccBmc -c status | grep VCC%d > voltage_level_%d.txt",
            v[loop_count], v[loop_count]);
    res = system(temp);
    loop_count++;
  }
}


x86 assembly (clang, -O0):
<init_voltage_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x8(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xebf(%rip),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x7,-0x8(%rbp)
jge    11a6 <init_voltage_files+0x86>
lea    -0x100(%rbp),%rdi
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
lea    0xe98(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x100(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    115c <init_voltage_files+0x3c>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_voltage_files>:
push   %r14
push   %rbx
sub    $0xc8,%rsp
lea    0xecf(%rip),%r14
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2,%edx
mov    $0x2,%ecx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3,%edx
mov    $0x3,%ecx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
mov    $0x4,%ecx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
mov    $0x5,%ecx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x7,%edx
mov    $0x7,%ecx
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
add    $0xc8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.init_voltage_files.v = [7 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 7]
@.str = [53 x i8] c"sccBmc -c status | grep VCC%d > voltage_level_%d.txt\00"
define void @init_voltage_files() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [7 x i32]
%4 = alloca [200 x i8]
store i32 0, i32* %2
%5 = bitcast [7 x i32]* %3 to i8*
br label %6
6: ; preds = %9, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 7
br i1 %8, label %9, label %24
9: ; preds = %6
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 %16
%18 = load i32, i32* %17
%19 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %18)
%20 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%21 = call i32 @system(i8* %20)
store i32 %21, i32* %1
%22 = load i32, i32* %2
%23 = add nsw i32 %22, 1
store i32 %23, i32* %2
br label %6
24: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [53 x i8] c"sccBmc -c status | grep VCC%d > voltage_level_%d.txt\00"
define void @init_voltage_files() {
%1 = alloca [200 x i8]
%2 = getelementptr inbounds [200 x i8], [200 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
%4 = call i32 @system(i8* %2)
%5 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 1, i32 1)
%6 = call i32 @system(i8* %2)
%7 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 2, i32 2)
%8 = call i32 @system(i8* %2)
%9 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 3, i32 3)
%10 = call i32 @system(i8* %2)
%11 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 4, i32 4)
%12 = call i32 @system(i8* %2)
%13 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 5, i32 5)
%14 = call i32 @system(i8* %2)
%15 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 7, i32 7)
%16 = call i32 @system(i8* %2)
ret void
}