#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*/ fprintf(int /*<<< orphan*/, char *, int);
int make_socket(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usleep(int);
int write(int, char *, int);
void cycle_identity() {
  int r;
  int socket = make_socket("localhost", "9050");
  write(socket, "AUTHENTICATE \"\"\n", 16);
  while (1) {
    r = write(socket, "signal NEWNYM\n\x00", 16);
    fprintf(stderr, "[%i: cycle_identity -> signal NEWNYM\n", r);
    usleep(300000);
  }
}


x86 assembly (clang, -O0):
<cycle_identity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    0xeb4(%rip),%rsi
call   1050 <make_socket@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    0xea7(%rip),%rsi
mov    $0x10,%edx
call   1030 <write@plt>
mov    -0x8(%rbp),%edi
lea    0xeca(%rip),%rsi
mov    $0x10,%edx
call   1030 <write@plt>
mov    %eax,-0x4(%rbp)
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xe84(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x493e0,%edi
call   1060 <usleep@plt>
jmp    1172 <cycle_identity+0x32>

x86 assembly (clang, -O2):
<cycle_identity>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xeb1(%rip),%rdi
lea    0xeb4(%rip),%rsi
call   1050 <make_socket@plt>
mov    %eax,%ebx
lea    0xeab(%rip),%rsi
mov    %eax,%edi
mov    $0x10,%edx
call   1030 <write@plt>
lea    0xecf(%rip),%r14
mov    0x2e62(%rip),%r12
lea    0xe9b(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x10,%edx
call   1030 <write@plt>
mov    (%r12),%edi
mov    %r15,%rsi
mov    %eax,%edx
call   1040 <fprintf@plt>
mov    $0x493e0,%edi
call   1060 <usleep@plt>
jmp    1190 <cycle_identity+0x50>

LLVM IR (-O0):
@.str = [10 x i8] c"localhost\00"
@.str.1 = [5 x i8] c"9050\00"
@.str.2 = [17 x i8] c"AUTHENTICATE \22\22\0A\00"
@.str.3 = [16 x i8] c"signal NEWNYM\0A\00\00"
@stderr = global i32 0
@.str.4 = [38 x i8] c"[%i: cycle_identity -> signal NEWNYM\0A\00"
define void @cycle_identity() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @make_socket(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @write(i32 %4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 16)
br label %6
6: ; preds = %0, %6
%7 = load i32, i32* %2
%8 = call i32 @write(i32 %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 16)
store i32 %8, i32* %1
%9 = load i32, i32* @stderr
%10 = load i32, i32* %1
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %10)
%12 = call i32 @usleep(i32 300000)
br label %6
}

LLVM IR (-O2):
@.str = [10 x i8] c"localhost\00"
@.str.1 = [5 x i8] c"9050\00"
@.str.2 = [17 x i8] c"AUTHENTICATE \22\22\0A\00"
@.str.3 = [16 x i8] c"signal NEWNYM\0A\00\00"
@stderr = global i32 0
@.str.4 = [38 x i8] c"[%i: cycle_identity -> signal NEWNYM\0A\00"
define void @cycle_identity() {
%1 = tail call i32 @make_socket(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @write(i32 %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 16)
br label %3
3: ; preds = %3, %0
%4 = tail call i32 @write(i32 %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 16)
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 %4)
%7 = tail call i32 @usleep(i32 300000)
br label %3
}