#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 */
char *copy_string(char *);
char *random_computer_word();
int /*<<< orphan*/ sprintf(char *, char *, char *, int);
scalar_t__ xrandom(int);
char *gen_random_local_name(int numothers, char **others) {
  char namebuf[100];
  sprintf(namebuf, "%s%d", (xrandom(2) == 0 ? random_computer_word() : "arg"),
          numothers + 1);
  return copy_string(namebuf);
}


x86 assembly (clang, -O0):
<gen_random_local_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    $0x2,%edi
call   1040 <xrandom@plt>
cmp    $0x0,%rax
jne    1184 <gen_random_local_name+0x44>
mov    $0x0,%al
call   1050 <random_computer_word@plt>
mov    %rax,-0x90(%rbp)
jmp    1197 <gen_random_local_name+0x57>
lea    0xe7a(%rip),%rax
mov    %rax,-0x90(%rbp)
jmp    1197 <gen_random_local_name+0x57>
mov    -0x88(%rbp),%rdi
mov    -0x90(%rbp),%rdx
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
lea    0xe4e(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x80(%rbp),%rdi
call   1030 <copy_string@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_random_local_name>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %edi,%ebx
mov    $0x2,%edi
call   1040 <xrandom@plt>
test   %rax,%rax
je     1161 <gen_random_local_name+0x21>
lea    0xea6(%rip),%rdx
jmp    116b <gen_random_local_name+0x2b>
xor    %eax,%eax
call   1050 <random_computer_word@plt>
mov    %rax,%rdx
add    $0x1,%ebx
lea    0xe8b(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %ebx,%ecx
call   1060 <sprintf@plt>
mov    %r14,%rdi
call   1030 <copy_string@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s%d\00"
@.str.1 = [4 x i8] c"arg\00"
define i8* @gen_random_local_name(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [100 x i8]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%7 = call i64 @xrandom(i32 2)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i8* (...) @random_computer_word()
br label %12
11: ; preds = %2
br label %12
12: ; preds = %11, %9
%13 = phi i8* [ %10, %9 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %11 ]
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
%16 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %15)
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%18 = call i8* @copy_string(i8* %17)
ret i8* %18
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s%d\00"
@.str.1 = [4 x i8] c"arg\00"
define i8* @gen_random_local_name(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = tail call i64 @xrandom(i32 2)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i8* (...) @random_computer_word()
br label %9
9: ; preds = %2, %7
%10 = phi i8* [ %8, %7 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %2 ]
%11 = add nsw i32 %0, 1
%12 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %11)
%13 = call i8* @copy_string(i8* %4)
ret i8* %13
}