#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*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void write_users(FILE *f, int large_pos, int pos) {
  int i;
  if (pos == large_pos) {
    if (large_pos == 3)
      fprintf(f, ":three");
    for (i = 0; i < 500; i++)
      fprintf(f, ",user%03d", i);
  }
  fprintf(f, "\n");
}


x86 assembly (clang, -O0):
<write_users>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1186 <write_users+0x76>
cmpl   $0x3,-0xc(%rbp)
jne    114a <write_users+0x3a>
mov    -0x8(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x1f4,-0x14(%rbp)
jge    1181 <write_users+0x71>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe9b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1151 <write_users+0x41>
jmp    1186 <write_users+0x76>
mov    -0x8(%rbp),%rdi
lea    0xe80(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_users>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
cmp    %esi,%edx
jne    118a <write_users+0x5a>
cmp    $0x3,%edx
jne    1159 <write_users+0x29>
lea    0xeb9(%rip),%rdi
mov    $0x6,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0xea7(%rip),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
add    $0x1,%ebp
cmp    $0x1f4,%ebp
jne    1170 <write_users+0x40>
mov    $0xa,%edi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fputc@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c":three\00"
@.str.1 = [10 x i8] c",user%03d\00"
define void @write_users(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, %1
br i1 %4, label %5, label %15
5: ; preds = %3
%6 = icmp eq i32 %2, 3
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 6, i64 1, i32* %0)
br label %9
9: ; preds = %7, %5
br label %10
10: ; preds = %9, %10
%11 = phi i32 [ %13, %10 ], [ 0, %9 ]
%12 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = add nuw nsw i32 %11, 1
%14 = icmp eq i32 %13, 500
br i1 %14, label %15, label %10
15: ; preds = %10, %3
%16 = tail call i32 @fputc(i32 10, i32* %0)
ret void
}