#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*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ getdata(int /*<<< orphan*/, unsigned long long, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putdata(int /*<<< orphan*/, unsigned long long, char *, int);
void nopmode(pid_t pid, unsigned long long int bersaglio) {
  char iniettando[] = {0x90, 0x90, 0x90, 0x90, 0x90};
  int i;
  char salvato[9];
  getdata(pid, bersaglio, salvato, 8);
  printf("prima: ");
  for (i = 0; i < 8; i++)
    printf("%x ", salvato[i]);
  printf("\n(nopmode) dopo: ");
  for (i = 0; i < 5; i++) {
    salvato[i] = iniettando[i];
    printf("%x ", iniettando[i]);
  }
  printf("\n");
  putdata(pid, bersaglio, salvato, 8);
}


x86 assembly (clang, -O0):
<nopmode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0x15(%rbp)
mov    0xeb6(%rip),%al
mov    %al,-0x11(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x25(%rbp),%rdx
mov    $0x8,%ecx
call   1050 <getdata@plt>
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    11aa <nopmode+0x7a>
movslq -0x1c(%rbp),%rax
movsbl -0x25(%rbp,%rax,1),%esi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    117b <nopmode+0x4b>
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    11fe <nopmode+0xce>
movslq -0x1c(%rbp),%rax
mov    -0x15(%rbp,%rax,1),%cl
movslq -0x1c(%rbp),%rax
mov    %cl,-0x25(%rbp,%rax,1)
movslq -0x1c(%rbp),%rax
movsbl -0x15(%rbp,%rax,1),%esi
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11bf <nopmode+0x8f>
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x25(%rbp),%rdx
mov    $0x8,%ecx
call   1030 <putdata@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nopmode>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
mov    %edi,%ebp
lea    0xf(%rsp),%r14
mov    %r14,%rdx
mov    $0x8,%ecx
call   1060 <getdata@plt>
lea    0xe98(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0xf(%rsp),%esi
lea    0xe8d(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x10(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x11(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x12(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x13(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x14(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x15(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl 0x16(%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe17(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movb   $0x90,0xf(%rsp)
mov    %rbx,%rdi
mov    $0xffffff90,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movb   $0x90,0x10(%rsp)
mov    %rbx,%rdi
mov    $0xffffff90,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movb   $0x90,0x11(%rsp)
mov    %rbx,%rdi
mov    $0xffffff90,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movb   $0x90,0x12(%rsp)
mov    %rbx,%rdi
mov    $0xffffff90,%esi
xor    %eax,%eax
call   1050 <printf@plt>
movb   $0x90,0x13(%rsp)
mov    %rbx,%rdi
mov    $0xffffff90,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r14,%rdx
mov    $0x8,%ecx
call   1040 <putdata@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.nopmode.iniettando = [5 x i8] c"\90\90\90\90\90"
@.str = [8 x i8] c"prima: \00"
@.str.1 = [4 x i8] c"%x \00"
@.str.2 = [18 x i8] c"\0A(nopmode) dopo: \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @nopmode(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca [5 x i8]
%6 = alloca i32
%7 = alloca [9 x i8]
store i32 %0, i32* %3
store i64 %1, i64* %4
%8 = bitcast [5 x i8]* %5 to i8*
%9 = load i32, i32* %3
%10 = load i64, i64* %4
%11 = getelementptr inbounds [9 x i8], [9 x i8]* %7, i64 0, i64 0
%12 = call i32 @getdata(i32 %9, i64 %10, i8* %11, i32 8)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %14
14: ; preds = %24, %2
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 8
br i1 %16, label %17, label %27
17: ; preds = %14
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [9 x i8], [9 x i8]* %7, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %22)
br label %24
24: ; preds = %17
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %14
27: ; preds = %14
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %6
br label %29
29: ; preds = %46, %27
%30 = load i32, i32* %6
%31 = icmp slt i32 %30, 5
br i1 %31, label %32, label %49
32: ; preds = %29
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 %34
%36 = load i8, i8* %35
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [9 x i8], [9 x i8]* %7, i64 0, i64 %38
store i8 %36, i8* %39
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %44)
br label %46
46: ; preds = %32
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
store i32 %48, i32* %6
br label %29
49: ; preds = %29
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%51 = load i32, i32* %3
%52 = load i64, i64* %4
%53 = getelementptr inbounds [9 x i8], [9 x i8]* %7, i64 0, i64 0
%54 = call i32 @putdata(i32 %51, i64 %52, i8* %53, i32 8)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"prima: \00"
@.str.1 = [4 x i8] c"%x \00"
@.str.2 = [18 x i8] c"\0A(nopmode) dopo: \00"
define void @nopmode(i32 %0, i64 %1) {
%3 = alloca [9 x i8]
%4 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 0
%5 = call i32 @getdata(i32 %0, i64 %1, i8* %4, i32 8)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 1
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 2
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 3
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 4
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 5
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 6
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = getelementptr inbounds [9 x i8], [9 x i8]* %3, i64 0, i64 7
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
store i8 -112, i8* %4
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 -112)
store i8 -112, i8* %10
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 -112)
store i8 -112, i8* %14
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 -112)
store i8 -112, i8* %18
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 -112)
store i8 -112, i8* %22
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 -112)
%44 = call i32 @putchar(i32 10)
%45 = call i32 @putdata(i32 %0, i64 %1, i8* %4, i32 8)
ret void
}