#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*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int sscanf(char *, char *, int *, int *, int *);
void read_header(FILE *in, int *workers, int *queue_size, int *iterations) {
  char buf[1024];
  *workers = *queue_size = *iterations = 0;
  while (!feof(in)) {
    int workers_tmp, queue_size_tmp, iterations_tmp;
    fgets(buf, 1024, in);
    if (sscanf(buf,
               "Main: running %d workers on %d queue_size for %d iterations\n",
               &workers_tmp, &queue_size_tmp, &iterations_tmp) == 3) {
      *workers = workers_tmp;
      *queue_size = queue_size_tmp;
      *iterations = iterations_tmp;
    }
  }
}


x86 assembly (clang, -O0):
<read_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1187 <read_header+0x57>
jmp    11f6 <read_header+0xc6>
lea    -0x420(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x400,%esi
call   1030 <fgets@plt>
lea    -0x420(%rbp),%rdi
lea    0xe56(%rip),%rsi
lea    -0x424(%rbp),%rdx
lea    -0x428(%rbp),%rcx
lea    -0x42c(%rbp),%r8
call   1050 <sscanf@plt>
cmp    $0x3,%eax
jne    11f1 <read_header+0xc1>
mov    -0x424(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x428(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x42c(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    1169 <read_header+0x39>
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_header>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x428,%rsp
mov    %rsi,%r12
mov    %rdi,%rbx
mov    %rcx,0x18(%rsp)
movl   $0x0,(%rcx)
mov    %rdx,0x10(%rsp)
movl   $0x0,(%rdx)
movl   $0x0,(%rsi)
call   1040 <feof@plt>
test   %eax,%eax
je     117e <read_header+0x4e>
add    $0x428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x20(%rsp),%r13
lea    0xc(%rsp),%rbp
lea    0x8(%rsp),%r14
lea    0x4(%rsp),%r15
jmp    11ac <read_header+0x7c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1040 <feof@plt>
test   %eax,%eax
jne    116c <read_header+0x3c>
mov    %r13,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   1030 <fgets@plt>
mov    %r13,%rdi
lea    0xe3a(%rip),%rsi
mov    %rbp,%rdx
mov    %r14,%rcx
mov    %r15,%r8
call   1050 <sscanf@plt>
cmp    $0x3,%eax
jne    11a0 <read_header+0x70>
mov    0xc(%rsp),%eax
mov    %eax,(%r12)
mov    0x8(%rsp),%eax
mov    0x10(%rsp),%rcx
mov    %eax,(%rcx)
mov    0x4(%rsp),%eax
mov    0x18(%rsp),%rcx
mov    %eax,(%rcx)
jmp    11a0 <read_header+0x70>

LLVM IR (-O0):
@.str = [61 x i8] c"Main: running %d workers on %d queue_size for %d iterations\0A\00"
define void @read_header(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca [1024 x i8]
%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
%13 = load i32*, i32** %8
store i32 0, i32* %13
%14 = load i32*, i32** %7
store i32 0, i32* %14
%15 = load i32*, i32** %6
store i32 0, i32* %15
br label %16
16: ; preds = %35, %4
%17 = load i32*, i32** %5
%18 = call i32 @feof(i32* %17)
%19 = icmp ne i32 %18, 0
%20 = xor i1 %19, true
br i1 %20, label %21, label %36
21: ; preds = %16
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%23 = load i32*, i32** %5
%24 = call i32 @fgets(i8* %22, i32 1024, i32* %23)
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%26 = call i32 @sscanf(i8* %25, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i32* %10, i32* %11, i32* %12)
%27 = icmp eq i32 %26, 3
br i1 %27, label %28, label %35
28: ; preds = %21
%29 = load i32, i32* %10
%30 = load i32*, i32** %6
store i32 %29, i32* %30
%31 = load i32, i32* %11
%32 = load i32*, i32** %7
store i32 %31, i32* %32
%33 = load i32, i32* %12
%34 = load i32*, i32** %8
store i32 %33, i32* %34
br label %35
35: ; preds = %28, %21
br label %16
36: ; preds = %16
ret void
}

LLVM IR (-O2):
@.str = [61 x i8] c"Main: running %d workers on %d queue_size for %d iterations\0A\00"
define void @read_header(i32* nocapture %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = alloca [1024 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
store i32 0, i32* %3
store i32 0, i32* %2
store i32 0, i32* %1
%10 = call i32 @feof(i32* %0)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %27
12: ; preds = %4
%13 = bitcast i32* %6 to i8*
%14 = bitcast i32* %7 to i8*
%15 = bitcast i32* %8 to i8*
br label %16
16: ; preds = %12, %24
%17 = call i32 @fgets(i8* %9, i32 1024, i32* %0)
%18 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i32* %6, i32* %7, i32* %8)
%19 = icmp eq i32 %18, 3
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i32, i32* %6
store i32 %21, i32* %1
%22 = load i32, i32* %7
store i32 %22, i32* %2
%23 = load i32, i32* %8
store i32 %23, i32* %3
br label %24
24: ; preds = %20, %16
%25 = call i32 @feof(i32* %0)
%26 = icmp eq i32 %25, 0
br i1 %26, label %16, label %27
27: ; preds = %24, %4
ret void
}