#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*/ snprintf(char *, int, char *, int, int);
int /*<<< orphan*/ system(char *);
int usb_mount() {
  char source[128];
  char target[128];
  char buf[128];
  int i;
  int rval;
  for (i = 1; i < 16; i++) {
    snprintf(buf, 128, "/bin/mount -t vfat /dev/sda%d /tmp/mnt/usb%d", i, i);
    system(buf);
    snprintf(buf, 128, "/bin/mount -t ntfs /dev/sda%d /tmp/mnt/usb%d", i, i);
    system(buf);
  }
  return 0;
}


x86 assembly (clang, -O0):
<usb_mount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
movl   $0x1,-0x184(%rbp)
cmpl   $0x10,-0x184(%rbp)
jge    11b8 <usb_mount+0x98>
lea    -0x180(%rbp),%rdi
mov    -0x184(%rbp),%ecx
mov    -0x184(%rbp),%r8d
mov    $0x80,%esi
lea    0xe9e(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x180(%rbp),%rdi
call   1030 <system@plt>
lea    -0x180(%rbp),%rdi
mov    -0x184(%rbp),%ecx
mov    -0x184(%rbp),%r8d
mov    $0x80,%esi
lea    0xe9a(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x180(%rbp),%rdi
call   1030 <system@plt>
mov    -0x184(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x184(%rbp)
jmp    1135 <usb_mount+0x15>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usb_mount>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    $0x1,%ebx
lea    0xec6(%rip),%r14
mov    %rsp,%r15
lea    0xee9(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    $0x80,%esi
mov    %r14,%rdx
mov    %ebx,%ecx
mov    %ebx,%r8d
call   1040 <snprintf@plt>
mov    %r15,%rdi
call   1030 <system@plt>
mov    %r15,%rdi
mov    $0x80,%esi
mov    %r12,%rdx
mov    %ebx,%ecx
mov    %ebx,%r8d
call   1040 <snprintf@plt>
mov    %r15,%rdi
call   1030 <system@plt>
add    $0x1,%ebx
cmp    $0x10,%ebx
jne    1150 <usb_mount+0x30>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [45 x i8] c"/bin/mount -t vfat /dev/sda%d /tmp/mnt/usb%d\00"
@.str.1 = [45 x i8] c"/bin/mount -t ntfs /dev/sda%d /tmp/mnt/usb%d\00"
define i32 @usb_mount() {
%1 = alloca [128 x i8]
%2 = alloca [128 x i8]
%3 = alloca [128 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 1, i32* %4
br label %6
6: ; preds = %22, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 16
br i1 %8, label %9, label %25
9: ; preds = %6
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%11 = load i32, i32* %4
%12 = load i32, i32* %4
%13 = call i32 @snprintf(i8* %10, i32 128, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %12)
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%15 = call i32 @system(i8* %14)
%16 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%17 = load i32, i32* %4
%18 = load i32, i32* %4
%19 = call i32 @snprintf(i8* %16, i32 128, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %18)
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%21 = call i32 @system(i8* %20)
br label %22
22: ; preds = %9
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %6
25: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"/bin/mount -t vfat /dev/sda%d /tmp/mnt/usb%d\00"
@.str.1 = [45 x i8] c"/bin/mount -t ntfs /dev/sda%d /tmp/mnt/usb%d\00"
define i32 @usb_mount() {
%1 = alloca [128 x i8]
%2 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 1, %0 ], [ %9, %3 ]
%5 = call i32 @snprintf(i8* %2, i32 128, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %4)
%6 = call i32 @system(i8* %2)
%7 = call i32 @snprintf(i8* %2, i32 128, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %4)
%8 = call i32 @system(i8* %2)
%9 = add nuw nsw i32 %4, 1
%10 = icmp eq i32 %9, 16
br i1 %10, label %11, label %3
11: ; preds = %3
ret i32 0
}